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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 15353002: Add a call to CheckIsolateState in all paths of Dart_GetField and Dart_SetField. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
===================================================================
--- runtime/vm/dart_api_impl_test.cc (revision 22888)
+++ runtime/vm/dart_api_impl_test.cc (working copy)
@@ -3516,6 +3516,53 @@
}
+TEST_CASE(GetField_CheckIsolate) {
+ const char* kScriptChars =
+ "class TestClass {\n"
+ " static int fld2 = 11;\n"
+ " static void testMain() {\n"
+ " }\n"
+ "}\n";
+ Dart_Handle result;
+ int64_t value = 0;
+
+ // Create a test library and Load up a test script in it.
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ Dart_Handle cls = Dart_GetClass(lib, NewString("TestClass"));
+ EXPECT_VALID(cls);
+
+ result = Dart_GetField(cls, NewString("fld2"));
+ EXPECT_VALID(result);
+ result = Dart_IntegerToInt64(result, &value);
+ EXPECT_EQ(11, value);
+}
+
+
+TEST_CASE(SetField_CheckIsolate) {
+ const char* kScriptChars =
+ "class TestClass {\n"
+ " static int fld2 = 11;\n"
+ " static void testMain() {\n"
+ " }\n"
+ "}\n";
+ Dart_Handle result;
+ int64_t value = 0;
+
+ // Create a test library and Load up a test script in it.
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ Dart_Handle cls = Dart_GetClass(lib, NewString("TestClass"));
+ EXPECT_VALID(cls);
+
+ result = Dart_SetField(cls, NewString("fld2"), Dart_NewInteger(13));
+ EXPECT_VALID(result);
+
+ result = Dart_GetField(cls, NewString("fld2"));
+ EXPECT_VALID(result);
+ result = Dart_IntegerToInt64(result, &value);
+ EXPECT_EQ(13, value);
+}
+
+
TEST_CASE(New) {
const char* kScriptChars =
"class MyClass {\n"
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698