Skip to content

Commit bad75cb

Browse files
authored
Merge pull request #5 from flutter/fix/flutter-test-template-additional-args
Syncing with main branch (#8872)
2 parents 860e9fb + f30155f commit bad75cb

9 files changed

Lines changed: 108 additions & 30 deletions

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ Mohamed El Sayed <devblooming@tutanota.com>
2626
Edwin Ludik <edwin.ludik@gmail.com>
2727
Japnit Singh <truejswalia@gmail.com>
2828
Dmitry Kandalov <dmitry.kandalov@gmail.com>
29+
Kazuya Chikamatsu <kazu.chika.shima@gmail.com>

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
### Fixed
1212

1313
- Silent failure when opening Flutter projects without `.idea` directory in IntelliJ IDEA, by removing `FlutterProjectOpenProcessor` and migrating configuration logic to `FlutterInitializer`. (#8845)
14+
- Gutter buttons not running tests with non-ASCII characters in their names. (#7985)
15+
- Freeze from JX Browser close. (#8864)
1416

1517
## 90.0.0
1618

src/io/flutter/jxbrowser/EmbeddedBrowserEngine.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
*/
66
package io.flutter.jxbrowser;
77

8-
import com.intellij.openapi.application.ApplicationListener;
8+
import com.intellij.openapi.Disposable;
99
import com.intellij.openapi.application.ApplicationManager;
1010
import com.intellij.openapi.diagnostic.Logger;
1111
import com.intellij.openapi.util.SystemInfo;
12+
import io.flutter.utils.OpenApiUtils;
1213
import com.teamdev.jxbrowser.engine.Engine;
1314
import com.teamdev.jxbrowser.engine.EngineOptions;
1415
import com.teamdev.jxbrowser.engine.PasswordStore;
@@ -22,7 +23,7 @@
2223
import static com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED;
2324
import static com.teamdev.jxbrowser.engine.RenderingMode.OFF_SCREEN;
2425

25-
public class EmbeddedBrowserEngine {
26+
public class EmbeddedBrowserEngine implements Disposable {
2627
private static final @NotNull Logger LOG = PluginLogger.createLogger(EmbeddedBrowserEngine.class);
2728
private final Engine engine;
2829

@@ -60,22 +61,22 @@ public EmbeddedBrowserEngine() {
6061
}
6162
engine = temp;
6263

63-
ApplicationManager.getApplication().addApplicationListener(new ApplicationListener() {
64-
@Override
65-
public boolean canExitApplication() {
66-
try {
67-
if (engine != null && !engine.isClosed()) {
68-
engine.close();
69-
}
64+
}
65+
66+
@Override
67+
public void dispose() {
68+
OpenApiUtils.safeExecuteOnPooledThread(() -> {
69+
try {
70+
if (engine != null && !engine.isClosed()) {
71+
engine.close();
7072
}
71-
catch (Exception ex) {
72-
if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) {
73-
LOG.info(ex);
74-
} else {
75-
LOG.info("Exception when closing JX Browser engine: " + ex.getMessage());
76-
}
73+
}
74+
catch (Exception ex) {
75+
if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) {
76+
LOG.info(ex);
77+
} else {
78+
LOG.info("Exception when closing JX Browser engine: " + ex.getMessage());
7779
}
78-
return true;
7980
}
8081
});
8182
}

src/io/flutter/jxbrowser/EmbeddedJxBrowser.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import io.flutter.settings.FlutterSettings;
2929
import io.flutter.utils.AsyncUtils;
3030
import io.flutter.utils.JxBrowserUtils;
31+
import io.flutter.utils.OpenApiUtils;
3132
import io.flutter.utils.ZoomLevelSelector;
3233
import io.flutter.view.EmbeddedBrowser;
3334
import io.flutter.view.EmbeddedTab;
@@ -98,7 +99,18 @@ public void loadUrl(String url) {
9899

99100
@Override
100101
public void close() {
101-
this.browser.close();
102+
OpenApiUtils.safeExecuteOnPooledThread(() -> {
103+
try {
104+
this.browser.close();
105+
}
106+
catch (Exception ex) {
107+
if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) {
108+
LOG.info(ex);
109+
} else {
110+
LOG.info("Exception when closing JX Browser instance: " + ex.getMessage());
111+
}
112+
}
113+
});
102114
}
103115

104116
@Override

src/io/flutter/run/common/CommonTestConfigUtils.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,16 @@ public String findTestName(@Nullable PsiElement elt) {
130130
final DartCallExpression call = findEnclosingTestCall(elt, getTestsFromOutline(elt.getContainingFile()));
131131
if (call == null) return null;
132132

133+
return extractTestName(call);
134+
}
135+
136+
@VisibleForTesting
137+
@Nullable
138+
public String extractTestName(@NotNull DartCallExpression call) {
133139
final DartStringLiteralExpression lit = DartSyntax.getArgument(call, 0, DartStringLiteralExpression.class);
134140
if (lit == null) return null;
135141

136-
final String name = DartSyntax.unquote(lit);
137-
if (name == null) return null;
138-
139-
return StringUtil.escapeProperty(name, false);
142+
return DartSyntax.unquote(lit);
140143
}
141144

142145
/**

src/io/flutter/view/EmbeddedBrowser.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,15 @@ public void projectClosing(@NotNull Project project) {
6969
final Map<String, BrowserTab> tabs = windows.get(window);
7070
for (final String tabName : tabs.keySet()) {
7171
final BrowserTab tab = tabs.get(tabName);
72-
if (tab.embeddedTab != null) {
73-
try {
74-
tab.embeddedTab.close();
72+
final EmbeddedTab embeddedTab = tab.embeddedTab;
73+
if (embeddedTab != null) {
74+
try {
75+
embeddedTab.close();
76+
}
77+
catch (Exception ex) {
78+
logger().info(ex);
79+
}
7580
}
76-
catch (Exception ex) {
77-
logger().info(ex);
78-
}
79-
}
8081
}
8182
tabs.clear();
8283
}

src/io/flutter/widgetpreview/WidgetPreviewPanel.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,12 @@ public void dispose() {
264264
// Dispose the browser tab
265265
final EmbeddedTab tab = browserTabRef.getAndSet(null);
266266
if (tab != null) {
267-
tab.close();
267+
try {
268+
tab.close();
269+
}
270+
catch (Exception ex) {
271+
LOG.info(ex);
272+
}
268273
}
269274
}
270275
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2026 The Chromium Authors. All rights reserved.
3+
* Use of this source code is governed by a BSD-style license that can be
4+
* found in the LICENSE file.
5+
*/
6+
package io.flutter.run.common;
7+
8+
import com.intellij.psi.PsiElement;
9+
import com.intellij.psi.impl.source.tree.LeafPsiElement;
10+
import com.jetbrains.lang.dart.psi.DartCallExpression;
11+
import io.flutter.AbstractDartElementTest;
12+
import io.flutter.dart.DartSyntax;
13+
import io.flutter.run.test.TestConfigUtils;
14+
import org.junit.Test;
15+
16+
import static org.junit.Assert.assertEquals;
17+
import static org.junit.Assert.assertNotNull;
18+
19+
public class CommonTestConfigUtilsTest extends AbstractDartElementTest {
20+
@Test
21+
public void extractTestNameShouldNotEscapeNonAscii() throws Exception {
22+
run(() -> {
23+
final PsiElement testKeyword = setUpDartElement(
24+
"main() { test('テスト', () {}); }", "test", LeafPsiElement.class);
25+
final DartCallExpression call =
26+
DartSyntax.findEnclosingFunctionCall(testKeyword, "test");
27+
assertNotNull(call);
28+
29+
final String name = TestConfigUtils.getInstance().extractTestName(call);
30+
assertEquals("テスト", name);
31+
});
32+
}
33+
}

tool/kokoro/deploy.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,26 @@ echo "kokoro build start"
1010
echo "kokoro build finished"
1111

1212
echo "kokoro deploy start"
13-
./bin/plugin deploy --channel=dev
13+
14+
KOKORO_TOKEN_FILE="${KOKORO_KEYSTORE_DIR}/${FLUTTER_KEYSTORE_ID}_${FLUTTER_KEYSTORE_NAME}"
15+
if [ ! -f "$KOKORO_TOKEN_FILE" ]; then
16+
echo "Error: Keystore token file not found at $KOKORO_TOKEN_FILE"
17+
exit 1
18+
fi
19+
TOKEN=$(cat "$KOKORO_TOKEN_FILE")
20+
21+
ZIP_FILE="build/distributions/flutter-intellij-kokoro.zip"
22+
if [ ! -f "$ZIP_FILE" ]; then
23+
echo "Error: Zip file not found at $ZIP_FILE"
24+
exit 1
25+
fi
26+
27+
echo "Uploading $ZIP_FILE to JetBrains Marketplace..."
28+
curl -if --fail \
29+
--header "Authorization: Bearer $TOKEN" \
30+
-F pluginId=9212 \
31+
-F file=@"$ZIP_FILE" \
32+
-F channel=dev \
33+
https://plugins.jetbrains.com/plugin/uploadPlugin
1434

1535
echo "kokoro deploy finished"

0 commit comments

Comments
 (0)