5
5
#include " flutter/runtime/dart_isolate.h"
6
6
7
7
#include " flutter/fml/paths.h"
8
- #include " flutter/testing/fixture_test.h"
9
8
#include " flutter/runtime/dart_vm.h"
10
9
#include " flutter/runtime/dart_vm_lifecycle.h"
11
10
#include " flutter/testing/dart_isolate_runner.h"
11
+ #include " flutter/testing/fixture_test.h"
12
12
#include " flutter/testing/testing.h"
13
13
14
14
namespace flutter {
@@ -17,8 +17,8 @@ namespace testing {
17
17
const std::string kernel_file_name = " no_plugin_registrant_kernel_blob.bin" ;
18
18
19
19
class DartIsolateTest : public FixtureTest {
20
- public:
21
- DartIsolateTest () : FixtureTest(kernel_file_name) {}
20
+ public:
21
+ DartIsolateTest () : FixtureTest(kernel_file_name) {}
22
22
};
23
23
24
24
TEST_F (DartIsolateTest, DartPluginRegistrantIsNotPresent) {
@@ -36,7 +36,14 @@ TEST_F(DartIsolateTest, DartPluginRegistrantIsNotPresent) {
36
36
latch.Signal ();
37
37
})));
38
38
39
- const auto settings = CreateSettingsForFixture ();
39
+ auto settings = CreateSettingsForFixture ();
40
+ auto did_throw_exception = false ;
41
+ settings.unhandled_exception_callback = [&](const std::string& error,
42
+ const std::string& stack_trace) {
43
+ did_throw_exception = true ;
44
+ return true ;
45
+ };
46
+
40
47
auto vm_ref = DartVMRef::Create (settings);
41
48
auto thread = CreateNewThread ();
42
49
TaskRunners task_runners (GetCurrentTestName (), //
@@ -46,11 +53,10 @@ TEST_F(DartIsolateTest, DartPluginRegistrantIsNotPresent) {
46
53
thread //
47
54
);
48
55
49
-
50
- auto kernel_file_path = fml::paths::JoinPaths ({GetFixturesPath (), kernel_file_name});
51
- auto isolate = RunDartCodeInIsolate (vm_ref, settings, task_runners,
52
- " main" , {},
53
- kernel_file_path);
56
+ auto kernel_file_path =
57
+ fml::paths::JoinPaths ({GetFixturesPath (), kernel_file_name});
58
+ auto isolate = RunDartCodeInIsolate (vm_ref, settings, task_runners, " main" ,
59
+ {}, kernel_file_path);
54
60
55
61
ASSERT_TRUE (isolate);
56
62
ASSERT_EQ (isolate->get ()->GetPhase (), DartIsolate::Phase::Running);
@@ -59,6 +65,7 @@ TEST_F(DartIsolateTest, DartPluginRegistrantIsNotPresent) {
59
65
60
66
ASSERT_EQ (messages.size (), 1u );
61
67
ASSERT_EQ (messages[0 ], " main() was called" );
68
+ ASSERT_FALSE (did_throw_exception);
62
69
}
63
70
64
71
} // namespace testing
0 commit comments