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

Unified Diff: vm/dart_api_impl_test.cc

Issue 11293163: Throw illegal argument exception when (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « no previous file | vm/exceptions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/dart_api_impl_test.cc
===================================================================
--- vm/dart_api_impl_test.cc (revision 14907)
+++ vm/dart_api_impl_test.cc (working copy)
@@ -3282,6 +3282,41 @@
}
+TEST_CASE(NegativeNativeFieldInIsolateMessage) {
+ const char* kScriptChars =
+ "import 'dart:isolate';\n"
+ "import 'dart:nativewrappers';\n"
+ "echo() {\n"
+ " port.receive((msg, reply) {\n"
+ " reply.send('echoing ${msg(1)}}');\n"
+ " });\n"
+ "}\n"
+ "class Test extends NativeFieldWrapperClass2 {\n"
+ " Test(this.i, this.j);\n"
+ " int i, j;\n"
+ "}\n"
+ "main() {\n"
+ " var snd = spawnFunction(echo);\n"
+ " var obj = new Test(1,2);\n"
+ " snd.send(obj, port.toSendPort());\n"
+ " port.receive((msg, reply) {\n"
+ " print('from worker ${msg}');\n"
+ " });\n"
+ "}\n";
+
+ DARTSCOPE_NOCHECKS(Isolate::Current());
+
+ // Create a test library and Load up a test script in it.
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+
+ // Invoke 'main' which should spawn an isolate and try to send an
+ // object with native fields over to the spawned isolate. This
+ // should result in an unhandled exception which is checked.
+ Dart_Handle retobj = Dart_Invoke(lib, NewString("main"), 0, NULL);
+ EXPECT(Dart_IsError(retobj));
+}
+
+
TEST_CASE(GetStaticField_RunsInitializer) {
const char* kScriptChars =
"class TestClass {\n"
« no previous file with comments | « no previous file | vm/exceptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698