Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 1130753006: Hide Isolate pointer from embedder (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/dart_api_impl_test.cc
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 9783558ff43e75608ee943742d071f158fcdcb3d..4fff0cae7750a953248a6a51a820388f1bc29f33 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -3681,30 +3681,32 @@ UNIT_TEST_CASE(Isolates) {
Dart_Isolate isolate = Dart_CurrentIsolate();
EXPECT_EQ(iso_1, isolate);
Dart_ExitIsolate();
- EXPECT(NULL == Dart_CurrentIsolate());
+ EXPECT(ILLEGAL_ISOLATE == Dart_CurrentIsolate());
Dart_Isolate iso_2 = TestCase::CreateTestIsolate();
EXPECT_EQ(iso_2, Dart_CurrentIsolate());
Dart_ExitIsolate();
- EXPECT(NULL == Dart_CurrentIsolate());
+ EXPECT(ILLEGAL_ISOLATE == Dart_CurrentIsolate());
Dart_EnterIsolate(iso_2);
EXPECT_EQ(iso_2, Dart_CurrentIsolate());
Dart_ShutdownIsolate();
- EXPECT(NULL == Dart_CurrentIsolate());
+ EXPECT(ILLEGAL_ISOLATE == Dart_CurrentIsolate());
Dart_EnterIsolate(iso_1);
EXPECT_EQ(iso_1, Dart_CurrentIsolate());
Dart_ShutdownIsolate();
- EXPECT(NULL == Dart_CurrentIsolate());
+ EXPECT(ILLEGAL_ISOLATE == Dart_CurrentIsolate());
}
UNIT_TEST_CASE(CurrentIsolateData) {
intptr_t mydata = 12345;
char* err;
+ // We expect that Dart_Port and Dart_Isolate are the same size.
+ EXPECT_EQ(sizeof(Dart_Port), sizeof(Dart_Isolate));
Dart_Isolate isolate =
Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer,
reinterpret_cast<void*>(mydata),
&err);
- EXPECT(isolate != NULL);
+ EXPECT(isolate != ILLEGAL_ISOLATE);
EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_CurrentIsolateData()));
EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_IsolateData(isolate)));
Dart_ShutdownIsolate();
@@ -3756,7 +3758,7 @@ static void MyMessageNotifyCallback(Dart_Isolate dest_isolate) {
UNIT_TEST_CASE(SetMessageCallbacks) {
Dart_Isolate dart_isolate = TestCase::CreateTestIsolate();
Dart_SetMessageNotifyCallback(&MyMessageNotifyCallback);
- Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
+ Isolate* isolate = Api::CastIsolate(dart_isolate);
EXPECT_EQ(&MyMessageNotifyCallback, isolate->message_notify_callback());
Dart_ShutdownIsolate();
}
@@ -7326,11 +7328,11 @@ static Dart_Isolate RunLoopTestCallback(const char* script_name,
" };\n"
"}\n";
- if (Dart_CurrentIsolate() != NULL) {
+ if (Dart_CurrentIsolate() != ILLEGAL_ISOLATE) {
Dart_ExitIsolate();
}
Dart_Isolate isolate = TestCase::CreateTestIsolate(script_name);
- ASSERT(isolate != NULL);
+ ASSERT(isolate != ILLEGAL_ISOLATE);
if (Dart_IsServiceIsolate(isolate)) {
return isolate;
}
@@ -7476,7 +7478,7 @@ void BusyLoop_start(uword unused) {
shared_isolate = Dart_CreateIsolate(NULL, NULL,
bin::isolate_snapshot_buffer,
NULL, &error);
- EXPECT(shared_isolate != NULL);
+ EXPECT(shared_isolate != ILLEGAL_ISOLATE);
Dart_EnterScope();
Dart_Handle url = NewString(TestCase::url());
Dart_Handle source = NewString(kScriptChars);
@@ -7575,7 +7577,7 @@ TEST_CASE(IsolateInterrupt) {
{
MonitorLocker ml(sync);
// Wait for our isolate to finish.
- while (shared_isolate != NULL) {
+ while (shared_isolate != ILLEGAL_ISOLATE) {
ml.Wait();
}
}
@@ -7604,11 +7606,11 @@ UNIT_TEST_CASE(IsolateShutdown) {
Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL,
bin::isolate_snapshot_buffer,
my_data, &err);
- if (isolate == NULL) {
+ if (isolate == ILLEGAL_ISOLATE) {
OS::Print("Creation of isolate failed '%s'\n", err);
free(err);
}
- EXPECT(isolate != NULL);
+ EXPECT(isolate != ILLEGAL_ISOLATE);
// The shutdown callback has not been called.
EXPECT_EQ(0, reinterpret_cast<intptr_t>(saved_callback_data));
@@ -7654,11 +7656,11 @@ UNIT_TEST_CASE(IsolateShutdownRunDartCode) {
Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL,
bin::isolate_snapshot_buffer,
NULL, &err);
- if (isolate == NULL) {
+ if (isolate == ILLEGAL_ISOLATE) {
OS::Print("Creation of isolate failed '%s'\n", err);
free(err);
}
- EXPECT(isolate != NULL);
+ EXPECT(isolate != ILLEGAL_ISOLATE);
Isolate::SetShutdownCallback(IsolateShutdownRunDartCodeTestCallback);
@@ -7681,7 +7683,7 @@ UNIT_TEST_CASE(IsolateShutdownRunDartCode) {
// The shutdown callback has not been called.
EXPECT_EQ(0, add_result);
- EXPECT(isolate != NULL);
+ EXPECT(isolate != ILLEGAL_ISOLATE);
// Shutdown the isolate.
Dart_ShutdownIsolate();

Powered by Google App Engine
This is Rietveld 408576698