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

Side by Side Diff: runtime/vm/dart_api_impl_test.cc

Issue 10837070: Remove old isolate API and update all code in the repository to use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/isolate_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "platform/json.h" 7 #include "platform/json.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 5918 matching lines...) Expand 10 before | Expand all | Expand 10 after
5929 } 5929 }
5930 5930
5931 5931
5932 static bool RunLoopTestCallback(const char* script_name, 5932 static bool RunLoopTestCallback(const char* script_name,
5933 const char* main, 5933 const char* main,
5934 void* data, 5934 void* data,
5935 char** error) { 5935 char** error) {
5936 const char* kScriptChars = 5936 const char* kScriptChars =
5937 "#import('builtin');\n" 5937 "#import('builtin');\n"
5938 "#import('dart:isolate');\n" 5938 "#import('dart:isolate');\n"
5939 "class MyIsolate extends Isolate {\n" 5939 "void entry() {\n"
5940 " MyIsolate() : super() { }\n" 5940 " port.receive((message, replyTo) {\n"
5941 " void main() {\n" 5941 " if (message) {\n"
5942 " port.receive((message, replyTo) {\n" 5942 " throw new Exception('MakeChildExit');\n"
5943 " if (message) {\n" 5943 " } else {\n"
5944 " throw new Exception('MakeChildExit');\n" 5944 " replyTo.call('hello');\n"
5945 " } else {\n" 5945 " port.close();\n"
5946 " replyTo.call('hello');\n" 5946 " }\n"
5947 " port.close();\n" 5947 " });\n"
5948 " }\n"
5949 " });\n"
5950 " }\n"
5951 "}\n" 5948 "}\n"
5952 "\n" 5949 "\n"
5953 "void main(exc_child, exc_parent) {\n" 5950 "void main(exc_child, exc_parent) {\n"
5954 " new MyIsolate().spawn().then((port) {\n" 5951 " var port = spawnFunction(entry);\n"
5955 " port.call(exc_child).then((message) {\n" 5952 " port.call(exc_child).then((message) {\n"
5956 " if (message != 'hello') throw new Exception('ShouldNotHappen');\n" 5953 " if (message != 'hello') throw new Exception('ShouldNotHappen');\n"
5957 " if (exc_parent) throw new Exception('MakeParentExit');\n" 5954 " if (exc_parent) throw new Exception('MakeParentExit');\n"
5958 " });\n"
5959 " });\n" 5955 " });\n"
5960 "}\n"; 5956 "}\n";
5961 5957
5962 if (Dart_CurrentIsolate() != NULL) { 5958 if (Dart_CurrentIsolate() != NULL) {
5963 Dart_ExitIsolate(); 5959 Dart_ExitIsolate();
5964 } 5960 }
5965 Dart_Isolate isolate = TestCase::CreateTestIsolate(); 5961 Dart_Isolate isolate = TestCase::CreateTestIsolate();
5966 ASSERT(isolate != NULL); 5962 ASSERT(isolate != NULL);
5967 Dart_EnterScope(); 5963 Dart_EnterScope();
5968 Dart_Handle url = Dart_NewString(TestCase::url()); 5964 Dart_Handle url = Dart_NewString(TestCase::url());
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
6537 EXPECT(Dart_IsString(str)); 6533 EXPECT(Dart_IsString(str));
6538 len = -1; 6534 len = -1;
6539 EXPECT_VALID(Dart_StringLength(str, &len)); 6535 EXPECT_VALID(Dart_StringLength(str, &len));
6540 EXPECT_EQ(0, len); 6536 EXPECT_EQ(0, len);
6541 } 6537 }
6542 6538
6543 6539
6544 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 6540 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
6545 6541
6546 } // namespace dart 6542 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/isolate_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698