| Index: runtime/vm/custom_isolate_test.cc
|
| ===================================================================
|
| --- runtime/vm/custom_isolate_test.cc (revision 34429)
|
| +++ runtime/vm/custom_isolate_test.cc (working copy)
|
| @@ -26,7 +26,7 @@
|
| static const char* kCustomIsolateScriptChars =
|
| "import 'dart:isolate';\n"
|
| "\n"
|
| - "RawReceivePort mainPort;\n"
|
| + "final RawReceivePort mainPort = new RawReceivePort();\n"
|
| "\n"
|
| "echo(arg) native \"native_echo\";\n"
|
| "\n"
|
| @@ -170,18 +170,9 @@
|
| Dart_EnterScope();
|
| Dart_Handle result;
|
|
|
| - // Reload all the test classes here.
|
| - //
|
| - // TODO(turnidge): Use the create isolate callback instead?
|
| - Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars,
|
| - NativeLookup);
|
| + Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url()));
|
| EXPECT_VALID(lib);
|
|
|
| - Dart_Handle recv_port = Dart_GetReceivePort(Dart_GetMainPortId());
|
| - EXPECT_VALID(recv_port);
|
| - result = Dart_SetField(lib, NewString("mainPort"), recv_port);
|
| - EXPECT_VALID(result);
|
| -
|
| result = Dart_Invoke(lib, NewString(main_), 0, NULL);
|
| EXPECT_VALID(result);
|
| free(const_cast<char*>(main_));
|
| @@ -287,17 +278,30 @@
|
| Dart_Isolate new_isolate = TestCase::CreateTestIsolate();
|
| EXPECT(new_isolate != NULL);
|
| Dart_SetMessageNotifyCallback(&NotifyMessage);
|
| - Dart_Port new_port = Dart_GetMainPortId();
|
| + Dart_EnterScope();
|
| + // Reload all the test classes here.
|
| + //
|
| + // TODO(turnidge): Use the create isolate callback instead?
|
| + Dart_Handle lib = TestCase::LoadTestScript(kCustomIsolateScriptChars,
|
| + NativeLookup);
|
| + EXPECT_VALID(lib);
|
|
|
| + Dart_Handle main_port = Dart_GetField(lib, NewString("mainPort"));
|
| + EXPECT_VALID(main_port);
|
| + Dart_Port main_port_id;
|
| + Dart_Handle err = Dart_PortGetId(main_port, &main_port_id);
|
| + EXPECT_VALID(err);
|
| +
|
| OS::Print("-- Adding StartEvent to queue --\n");
|
| event_queue->Add(new StartEvent(new_isolate, isolate_main));
|
|
|
| // Restore the original isolate.
|
| + Dart_ExitScope();
|
| Dart_ExitIsolate();
|
| Dart_EnterIsolate(saved_isolate);
|
| Dart_EnterScope();
|
|
|
| - Dart_Handle send_port = Dart_NewSendPort(new_port);
|
| + Dart_Handle send_port = Dart_NewSendPort(main_port_id);
|
| EXPECT_VALID(send_port);
|
| Dart_SetReturnValue(args, send_port);
|
|
|
|
|