OLD | NEW |
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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
7 #include "include/dart_debugger_api.h" | 7 #include "include/dart_debugger_api.h" |
8 #include "include/dart_mirrors_api.h" | 8 #include "include/dart_mirrors_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 3857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3868 Dart_Handle name; | 3868 Dart_Handle name; |
3869 | 3869 |
3870 // Load imported lib. | 3870 // Load imported lib. |
3871 Dart_Handle url = NewString("library_url"); | 3871 Dart_Handle url = NewString("library_url"); |
3872 Dart_Handle source = NewString(kImportedScriptChars); | 3872 Dart_Handle source = NewString(kImportedScriptChars); |
3873 Dart_Handle imported_lib = Dart_LoadLibrary(url, source); | 3873 Dart_Handle imported_lib = Dart_LoadLibrary(url, source); |
3874 Dart_Handle prefix = NewString(""); | 3874 Dart_Handle prefix = NewString(""); |
3875 EXPECT_VALID(imported_lib); | 3875 EXPECT_VALID(imported_lib); |
3876 Dart_Handle result = Dart_LibraryImportLibrary(lib, imported_lib, prefix); | 3876 Dart_Handle result = Dart_LibraryImportLibrary(lib, imported_lib, prefix); |
3877 EXPECT_VALID(result); | 3877 EXPECT_VALID(result); |
| 3878 result = Dart_FinalizeLoading(false); |
| 3879 EXPECT_VALID(result); |
3878 result = Dart_Invoke(imported_lib, NewString("test2"), 0, NULL); | 3880 result = Dart_Invoke(imported_lib, NewString("test2"), 0, NULL); |
3879 EXPECT_VALID(result); | 3881 EXPECT_VALID(result); |
3880 | 3882 |
3881 // Instance field. | 3883 // Instance field. |
3882 name = NewString("instance_fld"); | 3884 name = NewString("instance_fld"); |
3883 TestFieldNotFound(lib, name); | 3885 TestFieldNotFound(lib, name); |
3884 TestFieldNotFound(type, name); | 3886 TestFieldNotFound(type, name); |
3885 TestFieldOk(instance, name, false, "instance"); | 3887 TestFieldOk(instance, name, false, "instance"); |
3886 | 3888 |
3887 // Hidden instance field. | 3889 // Hidden instance field. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4084 "}\n" | 4086 "}\n" |
4085 "NativeFields testMain() {\n" | 4087 "NativeFields testMain() {\n" |
4086 " NativeFields obj = new NativeFields(10, 20);\n" | 4088 " NativeFields obj = new NativeFields(10, 20);\n" |
4087 " return obj;\n" | 4089 " return obj;\n" |
4088 "}\n"; | 4090 "}\n"; |
4089 Dart_Handle result; | 4091 Dart_Handle result; |
4090 | 4092 |
4091 const int kNumNativeFields = 4; | 4093 const int kNumNativeFields = 4; |
4092 | 4094 |
4093 // Create a test library. | 4095 // Create a test library. |
4094 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, | 4096 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL, |
4095 native_field_lookup); | 4097 USER_TEST_URI, false); |
4096 | 4098 |
4097 // Create a native wrapper class with native fields. | 4099 // Create a native wrapper class with native fields. |
4098 result = Dart_CreateNativeWrapperClass( | 4100 result = Dart_CreateNativeWrapperClass( |
4099 lib, | 4101 lib, |
4100 NewString("NativeFieldsWrapper"), | 4102 NewString("NativeFieldsWrapper"), |
4101 kNumNativeFields); | 4103 kNumNativeFields); |
| 4104 EXPECT_VALID(result); |
| 4105 result = Dart_FinalizeLoading(false); |
| 4106 EXPECT_VALID(result); |
4102 | 4107 |
4103 // Load up a test script in the test library. | 4108 // Load up a test script in the test library. |
4104 | 4109 |
4105 // Invoke a function which returns an object of type NativeFields. | 4110 // Invoke a function which returns an object of type NativeFields. |
4106 result = Dart_Invoke(lib, NewString("testMain"), 0, NULL); | 4111 result = Dart_Invoke(lib, NewString("testMain"), 0, NULL); |
4107 EXPECT_VALID(result); | 4112 EXPECT_VALID(result); |
4108 DARTSCOPE(Isolate::Current()); | 4113 DARTSCOPE(Isolate::Current()); |
4109 Instance& obj = Instance::Handle(); | 4114 Instance& obj = Instance::Handle(); |
4110 obj ^= Api::UnwrapHandle(result); | 4115 obj ^= Api::UnwrapHandle(result); |
4111 const Class& cls = Class::Handle(obj.clazz()); | 4116 const Class& cls = Class::Handle(obj.clazz()); |
(...skipping 19 matching lines...) Expand all Loading... |
4131 " final int fld2;\n" | 4136 " final int fld2;\n" |
4132 " static int fld3;\n" | 4137 " static int fld3;\n" |
4133 " static const int fld4 = 10;\n" | 4138 " static const int fld4 = 10;\n" |
4134 "}\n" | 4139 "}\n" |
4135 "NativeFields testMain() {\n" | 4140 "NativeFields testMain() {\n" |
4136 " NativeFields obj = new NativeFields(10, 20);\n" | 4141 " NativeFields obj = new NativeFields(10, 20);\n" |
4137 " return obj;\n" | 4142 " return obj;\n" |
4138 "}\n"; | 4143 "}\n"; |
4139 Dart_Handle result; | 4144 Dart_Handle result; |
4140 // Create a test library and Load up a test script in it. | 4145 // Create a test library and Load up a test script in it. |
4141 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 4146 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL, |
| 4147 USER_TEST_URI, false); |
4142 | 4148 |
4143 // Invoke a function which returns an object of type NativeFields. | 4149 // Invoke a function which returns an object of type NativeFields. |
4144 result = Dart_Invoke(lib, NewString("testMain"), 0, NULL); | 4150 result = Dart_Invoke(lib, NewString("testMain"), 0, NULL); |
4145 | 4151 |
4146 // We expect this to fail as class "NativeFields" extends | 4152 // We expect this to fail as class "NativeFields" extends |
4147 // "NativeFieldsWrapper" and there is no definition of it either | 4153 // "NativeFieldsWrapper" and there is no definition of it either |
4148 // in the dart code or through the native field injection mechanism. | 4154 // in the dart code or through the native field injection mechanism. |
4149 EXPECT(Dart_IsError(result)); | 4155 EXPECT(Dart_IsError(result)); |
4150 } | 4156 } |
4151 | 4157 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4430 " static const int fld4 = 10;\n" | 4436 " static const int fld4 = 10;\n" |
4431 "}\n" | 4437 "}\n" |
4432 "NativeFields testMain() {\n" | 4438 "NativeFields testMain() {\n" |
4433 " NativeFields obj = new NativeFields(10, 20);\n" | 4439 " NativeFields obj = new NativeFields(10, 20);\n" |
4434 " return obj;\n" | 4440 " return obj;\n" |
4435 "}\n"; | 4441 "}\n"; |
4436 const int kNumNativeFields = 4; | 4442 const int kNumNativeFields = 4; |
4437 | 4443 |
4438 // Create a test library. | 4444 // Create a test library. |
4439 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, | 4445 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, |
4440 native_field_lookup); | 4446 native_field_lookup, |
| 4447 USER_TEST_URI, |
| 4448 false); |
4441 | 4449 |
4442 // Create a native wrapper class with native fields. | 4450 // Create a native wrapper class with native fields. |
4443 Dart_Handle result = Dart_CreateNativeWrapperClass( | 4451 Dart_Handle result = Dart_CreateNativeWrapperClass( |
4444 lib, | 4452 lib, |
4445 NewString("NativeFieldsWrapper"), | 4453 NewString("NativeFieldsWrapper"), |
4446 kNumNativeFields); | 4454 kNumNativeFields); |
4447 EXPECT_VALID(result); | 4455 EXPECT_VALID(result); |
| 4456 result = Dart_FinalizeLoading(false); |
| 4457 EXPECT_VALID(result); |
4448 | 4458 |
4449 // Load up a test script in it. | 4459 // Load up a test script in it. |
4450 | 4460 |
4451 // Invoke a function which returns an object of type NativeFields. | 4461 // Invoke a function which returns an object of type NativeFields. |
4452 Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain"), 0, NULL); | 4462 Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain"), 0, NULL); |
4453 EXPECT_VALID(retobj); | 4463 EXPECT_VALID(retobj); |
4454 | 4464 |
4455 // Now access and set various instance fields of the returned object. | 4465 // Now access and set various instance fields of the returned object. |
4456 TestNativeFields(retobj); | 4466 TestNativeFields(retobj); |
4457 | 4467 |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5222 | 5232 |
5223 // Load lib2 | 5233 // Load lib2 |
5224 url = NewString("library2_url"); | 5234 url = NewString("library2_url"); |
5225 source = NewString(kLibrary2Chars); | 5235 source = NewString(kLibrary2Chars); |
5226 Dart_Handle lib2 = Dart_LoadLibrary(url, source); | 5236 Dart_Handle lib2 = Dart_LoadLibrary(url, source); |
5227 EXPECT_VALID(lib2); | 5237 EXPECT_VALID(lib2); |
5228 | 5238 |
5229 // Import lib2 from lib1 | 5239 // Import lib2 from lib1 |
5230 Dart_Handle result = Dart_LibraryImportLibrary(lib1, lib2, Dart_Null()); | 5240 Dart_Handle result = Dart_LibraryImportLibrary(lib1, lib2, Dart_Null()); |
5231 EXPECT_VALID(result); | 5241 EXPECT_VALID(result); |
| 5242 result = Dart_FinalizeLoading(false); |
| 5243 EXPECT_VALID(result); |
5232 | 5244 |
5233 // We can invoke both private and non-private local functions. | 5245 // We can invoke both private and non-private local functions. |
5234 EXPECT_VALID(Dart_Invoke(lib1, NewString("local"), 0, NULL)); | 5246 EXPECT_VALID(Dart_Invoke(lib1, NewString("local"), 0, NULL)); |
5235 EXPECT_VALID(Dart_Invoke(lib1, NewString("_local"), 0, NULL)); | 5247 EXPECT_VALID(Dart_Invoke(lib1, NewString("_local"), 0, NULL)); |
5236 | 5248 |
5237 // We can only invoke non-private imported functions. | 5249 // We can only invoke non-private imported functions. |
5238 EXPECT_VALID(Dart_Invoke(lib1, NewString("imported"), 0, NULL)); | 5250 EXPECT_VALID(Dart_Invoke(lib1, NewString("imported"), 0, NULL)); |
5239 EXPECT_ERROR(Dart_Invoke(lib1, NewString("_imported"), 0, NULL), | 5251 EXPECT_ERROR(Dart_Invoke(lib1, NewString("_imported"), 0, NULL), |
5240 "did not find top-level function '_imported'"); | 5252 "did not find top-level function '_imported'"); |
5241 } | 5253 } |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5765 "Dart_LoadScript expects argument 'source' to be of type String.", | 5777 "Dart_LoadScript expects argument 'source' to be of type String.", |
5766 Dart_GetError(result)); | 5778 Dart_GetError(result)); |
5767 | 5779 |
5768 result = Dart_LoadScript(url, error, 0, 0); | 5780 result = Dart_LoadScript(url, error, 0, 0); |
5769 EXPECT(Dart_IsError(result)); | 5781 EXPECT(Dart_IsError(result)); |
5770 EXPECT_STREQ("incoming error", Dart_GetError(result)); | 5782 EXPECT_STREQ("incoming error", Dart_GetError(result)); |
5771 | 5783 |
5772 // Load a script successfully. | 5784 // Load a script successfully. |
5773 result = Dart_LoadScript(url, source, 0, 0); | 5785 result = Dart_LoadScript(url, source, 0, 0); |
5774 EXPECT_VALID(result); | 5786 EXPECT_VALID(result); |
| 5787 Dart_FinalizeLoading(false); |
5775 | 5788 |
5776 result = Dart_Invoke(result, NewString("main"), 0, NULL); | 5789 result = Dart_Invoke(result, NewString("main"), 0, NULL); |
5777 EXPECT_VALID(result); | 5790 EXPECT_VALID(result); |
5778 EXPECT(Dart_IsInteger(result)); | 5791 EXPECT(Dart_IsInteger(result)); |
5779 int64_t value = 0; | 5792 int64_t value = 0; |
5780 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); | 5793 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); |
5781 EXPECT_EQ(12345, value); | 5794 EXPECT_EQ(12345, value); |
5782 | 5795 |
5783 // Further calls to LoadScript are errors. | 5796 // Further calls to LoadScript are errors. |
5784 result = Dart_LoadScript(url, source, 0, 0); | 5797 result = Dart_LoadScript(url, source, 0, 0); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6032 "class _B {}\n" | 6045 "class _B {}\n" |
6033 "abstract class _C {}\n" | 6046 "abstract class _C {}\n" |
6034 "\n" | 6047 "\n" |
6035 "_compare(String a, String b) => a.compareTo(b);\n" | 6048 "_compare(String a, String b) => a.compareTo(b);\n" |
6036 "sort(list) => list.sort(_compare);\n"; | 6049 "sort(list) => list.sort(_compare);\n"; |
6037 | 6050 |
6038 Dart_Handle url = NewString("library_url"); | 6051 Dart_Handle url = NewString("library_url"); |
6039 Dart_Handle source = NewString(kLibraryChars); | 6052 Dart_Handle source = NewString(kLibraryChars); |
6040 Dart_Handle lib = Dart_LoadLibrary(url, source); | 6053 Dart_Handle lib = Dart_LoadLibrary(url, source); |
6041 EXPECT_VALID(lib); | 6054 EXPECT_VALID(lib); |
| 6055 Dart_Handle result = Dart_FinalizeLoading(false); |
| 6056 EXPECT_VALID(result); |
6042 | 6057 |
6043 Dart_Handle list = Dart_LibraryGetClassNames(lib); | 6058 Dart_Handle list = Dart_LibraryGetClassNames(lib); |
6044 EXPECT_VALID(list); | 6059 EXPECT_VALID(list); |
6045 EXPECT(Dart_IsList(list)); | 6060 EXPECT(Dart_IsList(list)); |
6046 | 6061 |
6047 // Sort the list. | 6062 // Sort the list. |
6048 const int kNumArgs = 1; | 6063 const int kNumArgs = 1; |
6049 Dart_Handle args[1]; | 6064 Dart_Handle args[1]; |
6050 args[0] = list; | 6065 args[0] = list; |
6051 EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args)); | 6066 EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args)); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6083 "}\n" | 6098 "}\n" |
6084 "\n" | 6099 "\n" |
6085 "_compare(String a, String b) => a.compareTo(b);\n" | 6100 "_compare(String a, String b) => a.compareTo(b);\n" |
6086 "sort(list) => list.sort(_compare);\n"; | 6101 "sort(list) => list.sort(_compare);\n"; |
6087 | 6102 |
6088 // Get the functions from a library. | 6103 // Get the functions from a library. |
6089 Dart_Handle url = NewString("library_url"); | 6104 Dart_Handle url = NewString("library_url"); |
6090 Dart_Handle source = NewString(kLibraryChars); | 6105 Dart_Handle source = NewString(kLibraryChars); |
6091 Dart_Handle lib = Dart_LoadLibrary(url, source); | 6106 Dart_Handle lib = Dart_LoadLibrary(url, source); |
6092 EXPECT_VALID(lib); | 6107 EXPECT_VALID(lib); |
| 6108 Dart_Handle result = Dart_FinalizeLoading(false); |
| 6109 EXPECT_VALID(result); |
6093 | 6110 |
6094 Dart_Handle list = Dart_GetFunctionNames(lib); | 6111 Dart_Handle list = Dart_GetFunctionNames(lib); |
6095 EXPECT_VALID(list); | 6112 EXPECT_VALID(list); |
6096 EXPECT(Dart_IsList(list)); | 6113 EXPECT(Dart_IsList(list)); |
6097 | 6114 |
6098 // Sort the list. | 6115 // Sort the list. |
6099 const int kNumArgs = 1; | 6116 const int kNumArgs = 1; |
6100 Dart_Handle args[1]; | 6117 Dart_Handle args[1]; |
6101 args[0] = list; | 6118 args[0] = list; |
6102 EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args)); | 6119 EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args)); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6198 "int foobar() => foo.bar();"; | 6215 "int foobar() => foo.bar();"; |
6199 Dart_Handle url2 = NewString("library2_url"); | 6216 Dart_Handle url2 = NewString("library2_url"); |
6200 Dart_Handle source2 = NewString(kLibrary2Chars); | 6217 Dart_Handle source2 = NewString(kLibrary2Chars); |
6201 Dart_Handle lib2 = Dart_LoadLibrary(url2, source2); | 6218 Dart_Handle lib2 = Dart_LoadLibrary(url2, source2); |
6202 EXPECT_VALID(lib2); | 6219 EXPECT_VALID(lib2); |
6203 EXPECT(Dart_IsLibrary(lib2)); | 6220 EXPECT(Dart_IsLibrary(lib2)); |
6204 | 6221 |
6205 Dart_Handle prefix = NewString("foo"); | 6222 Dart_Handle prefix = NewString("foo"); |
6206 Dart_Handle result = Dart_LibraryImportLibrary(lib2, lib1, prefix); | 6223 Dart_Handle result = Dart_LibraryImportLibrary(lib2, lib1, prefix); |
6207 EXPECT_VALID(result); | 6224 EXPECT_VALID(result); |
| 6225 result = Dart_FinalizeLoading(false); |
| 6226 EXPECT_VALID(result); |
6208 | 6227 |
6209 // Lib1 is imported under a library prefix and therefore 'foo' should | 6228 // Lib1 is imported under a library prefix and therefore 'foo' should |
6210 // not be found directly in lib2. | 6229 // not be found directly in lib2. |
6211 Dart_Handle method_name = NewString("foo"); | 6230 Dart_Handle method_name = NewString("foo"); |
6212 result = Dart_Invoke(lib2, method_name, 0, NULL); | 6231 result = Dart_Invoke(lib2, method_name, 0, NULL); |
6213 EXPECT_ERROR(result, "Dart_Invoke: did not find top-level function 'foo'"); | 6232 EXPECT_ERROR(result, "Dart_Invoke: did not find top-level function 'foo'"); |
6214 | 6233 |
6215 // Check that lib1 is available under the prefix in lib2. | 6234 // Check that lib1 is available under the prefix in lib2. |
6216 method_name = NewString("foobar"); | 6235 method_name = NewString("foobar"); |
6217 result = Dart_Invoke(lib2, method_name, 0, NULL); | 6236 result = Dart_Invoke(lib2, method_name, 0, NULL); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6380 const char* kSourceChars = | 6399 const char* kSourceChars = |
6381 "part of library1_name;\n" | 6400 "part of library1_name;\n" |
6382 "class NewClass extends OldClass{\n" | 6401 "class NewClass extends OldClass{\n" |
6383 " bar() => 'bar';\n" | 6402 " bar() => 'bar';\n" |
6384 "}\n"; | 6403 "}\n"; |
6385 Dart_Handle url = NewString("library1_url"); | 6404 Dart_Handle url = NewString("library1_url"); |
6386 Dart_Handle source = NewString(kLibrary1Chars); | 6405 Dart_Handle source = NewString(kLibrary1Chars); |
6387 Dart_Handle lib = Dart_LoadLibrary(url, source); | 6406 Dart_Handle lib = Dart_LoadLibrary(url, source); |
6388 EXPECT_VALID(lib); | 6407 EXPECT_VALID(lib); |
6389 EXPECT(Dart_IsLibrary(lib)); | 6408 EXPECT(Dart_IsLibrary(lib)); |
| 6409 Dart_Handle result = Dart_FinalizeLoading(false); |
| 6410 EXPECT_VALID(result); |
6390 | 6411 |
6391 // Call a dynamic function on OldClass. | 6412 // Call a dynamic function on OldClass. |
6392 Dart_Handle type = Dart_GetType(lib, NewString("OldClass"), 0, NULL); | 6413 Dart_Handle type = Dart_GetType(lib, NewString("OldClass"), 0, NULL); |
6393 EXPECT_VALID(type); | 6414 EXPECT_VALID(type); |
6394 Dart_Handle recv = Dart_New(type, Dart_Null(), 0, NULL); | 6415 Dart_Handle recv = Dart_New(type, Dart_Null(), 0, NULL); |
6395 Dart_Handle result = Dart_Invoke(recv, NewString("foo"), 0, NULL); | 6416 result = Dart_Invoke(recv, NewString("foo"), 0, NULL); |
6396 EXPECT_VALID(result); | 6417 EXPECT_VALID(result); |
6397 EXPECT(Dart_IsString(result)); | 6418 EXPECT(Dart_IsString(result)); |
6398 const char* result_cstr = ""; | 6419 const char* result_cstr = ""; |
6399 EXPECT_VALID(Dart_StringToCString(result, &result_cstr)); | 6420 EXPECT_VALID(Dart_StringToCString(result, &result_cstr)); |
6400 EXPECT_STREQ("foo", result_cstr); | 6421 EXPECT_STREQ("foo", result_cstr); |
6401 | 6422 |
6402 // Load a source file late. | 6423 // Load a source file late. |
6403 url = NewString("source_url"); | 6424 url = NewString("source_url"); |
6404 source = NewString(kSourceChars); | 6425 source = NewString(kSourceChars); |
6405 EXPECT_VALID(Dart_LoadSource(lib, url, source)); | 6426 EXPECT_VALID(Dart_LoadSource(lib, url, source)); |
| 6427 result = Dart_FinalizeLoading(false); |
| 6428 EXPECT_VALID(result); |
6406 | 6429 |
6407 // Call a dynamic function on NewClass in the updated library. | 6430 // Call a dynamic function on NewClass in the updated library. |
6408 type = Dart_GetType(lib, NewString("NewClass"), 0, NULL); | 6431 type = Dart_GetType(lib, NewString("NewClass"), 0, NULL); |
6409 EXPECT_VALID(type); | 6432 EXPECT_VALID(type); |
6410 recv = Dart_New(type, Dart_Null(), 0, NULL); | 6433 recv = Dart_New(type, Dart_Null(), 0, NULL); |
6411 result = Dart_Invoke(recv, NewString("bar"), 0, NULL); | 6434 result = Dart_Invoke(recv, NewString("bar"), 0, NULL); |
6412 EXPECT_VALID(result); | 6435 EXPECT_VALID(result); |
6413 EXPECT(Dart_IsString(result)); | 6436 EXPECT(Dart_IsString(result)); |
6414 result_cstr = ""; | 6437 result_cstr = ""; |
6415 EXPECT_VALID(Dart_StringToCString(result, &result_cstr)); | 6438 EXPECT_VALID(Dart_StringToCString(result, &result_cstr)); |
(...skipping 21 matching lines...) Expand all Loading... |
6437 source = NewString(kSourceChars); | 6460 source = NewString(kSourceChars); |
6438 | 6461 |
6439 Dart_Handle result = Dart_LoadSource(lib, url, source); | 6462 Dart_Handle result = Dart_LoadSource(lib, url, source); |
6440 EXPECT_VALID(result); | 6463 EXPECT_VALID(result); |
6441 | 6464 |
6442 url = NewString("patch_url"); | 6465 url = NewString("patch_url"); |
6443 source = NewString(kPatchChars); | 6466 source = NewString(kPatchChars); |
6444 | 6467 |
6445 result = Dart_LibraryLoadPatch(lib, url, source); | 6468 result = Dart_LibraryLoadPatch(lib, url, source); |
6446 EXPECT_VALID(result); | 6469 EXPECT_VALID(result); |
| 6470 result = Dart_FinalizeLoading(false); |
| 6471 EXPECT_VALID(result); |
6447 | 6472 |
6448 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 6473 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
6449 EXPECT_VALID(result); | 6474 EXPECT_VALID(result); |
6450 EXPECT(Dart_IsInteger(result)); | 6475 EXPECT(Dart_IsInteger(result)); |
6451 int64_t value = 0; | 6476 int64_t value = 0; |
6452 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); | 6477 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); |
6453 EXPECT_EQ(42, value); | 6478 EXPECT_EQ(42, value); |
6454 } | 6479 } |
6455 | 6480 |
6456 | 6481 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6584 EXPECT(false); | 6609 EXPECT(false); |
6585 } | 6610 } |
6586 } | 6611 } |
6587 result = Dart_SetNativeResolver(result, &PatchNativeResolver, NULL); | 6612 result = Dart_SetNativeResolver(result, &PatchNativeResolver, NULL); |
6588 EXPECT_VALID(result); | 6613 EXPECT_VALID(result); |
6589 | 6614 |
6590 Dart_Handle script_url = NewString("theScript"); | 6615 Dart_Handle script_url = NewString("theScript"); |
6591 source = NewString(kScriptChars); | 6616 source = NewString(kScriptChars); |
6592 Dart_Handle test_script = Dart_LoadScript(script_url, source, 0, 0); | 6617 Dart_Handle test_script = Dart_LoadScript(script_url, source, 0, 0); |
6593 EXPECT_VALID(test_script); | 6618 EXPECT_VALID(test_script); |
| 6619 result = Dart_FinalizeLoading(false); |
| 6620 EXPECT_VALID(result); |
6594 | 6621 |
6595 // Make sure that we can compile all of the patched code. | 6622 // Make sure that we can compile all of the patched code. |
6596 result = Dart_CompileAll(); | 6623 result = Dart_CompileAll(); |
6597 EXPECT_VALID(result); | 6624 EXPECT_VALID(result); |
6598 | 6625 |
6599 result = Dart_Invoke(test_script, NewString("e1"), 0, NULL); | 6626 result = Dart_Invoke(test_script, NewString("e1"), 0, NULL); |
6600 EXPECT_ERROR(result, "No top-level method 'unpatched'"); | 6627 EXPECT_ERROR(result, "No top-level method 'unpatched'"); |
6601 | 6628 |
6602 int64_t value = 0; | 6629 int64_t value = 0; |
6603 result = Dart_Invoke(test_script, NewString("m1"), 0, NULL); | 6630 result = Dart_Invoke(test_script, NewString("m1"), 0, NULL); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6686 Dart_Handle error = Dart_NewApiError("incoming error"); | 6713 Dart_Handle error = Dart_NewApiError("incoming error"); |
6687 Dart_Handle result; | 6714 Dart_Handle result; |
6688 | 6715 |
6689 // Load a test script. | 6716 // Load a test script. |
6690 Dart_Handle url = NewString(TestCase::url()); | 6717 Dart_Handle url = NewString(TestCase::url()); |
6691 Dart_Handle source = NewString(kScriptChars); | 6718 Dart_Handle source = NewString(kScriptChars); |
6692 result = Dart_SetLibraryTagHandler(library_handler); | 6719 result = Dart_SetLibraryTagHandler(library_handler); |
6693 EXPECT_VALID(result); | 6720 EXPECT_VALID(result); |
6694 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); | 6721 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); |
6695 EXPECT_VALID(lib); | 6722 EXPECT_VALID(lib); |
| 6723 result = Dart_FinalizeLoading(false); |
| 6724 EXPECT_VALID(result); |
6696 EXPECT(Dart_IsLibrary(lib)); | 6725 EXPECT(Dart_IsLibrary(lib)); |
6697 Dart_Handle type = Dart_GetType(lib, NewString("Test"), 0, NULL); | 6726 Dart_Handle type = Dart_GetType(lib, NewString("Test"), 0, NULL); |
6698 EXPECT_VALID(type); | 6727 EXPECT_VALID(type); |
6699 | 6728 |
6700 result = Dart_SetNativeResolver(Dart_Null(), &MyNativeResolver1, NULL); | 6729 result = Dart_SetNativeResolver(Dart_Null(), &MyNativeResolver1, NULL); |
6701 EXPECT(Dart_IsError(result)); | 6730 EXPECT(Dart_IsError(result)); |
6702 EXPECT_STREQ( | 6731 EXPECT_STREQ( |
6703 "Dart_SetNativeResolver expects argument 'library' to be non-null.", | 6732 "Dart_SetNativeResolver expects argument 'library' to be non-null.", |
6704 Dart_GetError(result)); | 6733 Dart_GetError(result)); |
6705 | 6734 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6778 result = Dart_LoadScript(url, source, 0, 0); | 6807 result = Dart_LoadScript(url, source, 0, 0); |
6779 | 6808 |
6780 url = NewString("library1_dart"); | 6809 url = NewString("library1_dart"); |
6781 source = NewString(kLibrary1Chars); | 6810 source = NewString(kLibrary1Chars); |
6782 Dart_LoadLibrary(url, source); | 6811 Dart_LoadLibrary(url, source); |
6783 | 6812 |
6784 url = NewString("library2_dart"); | 6813 url = NewString("library2_dart"); |
6785 source = NewString(kLibrary2Chars); | 6814 source = NewString(kLibrary2Chars); |
6786 Dart_LoadLibrary(url, source); | 6815 Dart_LoadLibrary(url, source); |
6787 | 6816 |
| 6817 Dart_FinalizeLoading(false); |
| 6818 |
6788 result = Dart_Invoke(result, NewString("main"), 0, NULL); | 6819 result = Dart_Invoke(result, NewString("main"), 0, NULL); |
6789 EXPECT_VALID(result); | 6820 EXPECT_VALID(result); |
6790 } | 6821 } |
6791 | 6822 |
6792 | 6823 |
6793 // Test that if the same name is imported from two libraries, it is | 6824 // Test that if the same name is imported from two libraries, it is |
6794 // an error if that name is referenced. | 6825 // an error if that name is referenced. |
6795 TEST_CASE(ImportLibrary3) { | 6826 TEST_CASE(ImportLibrary3) { |
6796 const char* kScriptChars = | 6827 const char* kScriptChars = |
6797 "import 'library2_dart';\n" | 6828 "import 'library2_dart';\n" |
(...skipping 16 matching lines...) Expand all Loading... |
6814 result = Dart_LoadScript(url, source, 0, 0); | 6845 result = Dart_LoadScript(url, source, 0, 0); |
6815 EXPECT_VALID(result); | 6846 EXPECT_VALID(result); |
6816 | 6847 |
6817 url = NewString("library2_dart"); | 6848 url = NewString("library2_dart"); |
6818 source = NewString(kLibrary2Chars); | 6849 source = NewString(kLibrary2Chars); |
6819 Dart_LoadLibrary(url, source); | 6850 Dart_LoadLibrary(url, source); |
6820 | 6851 |
6821 url = NewString("library1_dart"); | 6852 url = NewString("library1_dart"); |
6822 source = NewString(kLibrary1Chars); | 6853 source = NewString(kLibrary1Chars); |
6823 Dart_LoadLibrary(url, source); | 6854 Dart_LoadLibrary(url, source); |
| 6855 result = Dart_FinalizeLoading(false); |
| 6856 EXPECT_VALID(result); |
6824 | 6857 |
6825 result = Dart_Invoke(result, NewString("main"), 0, NULL); | 6858 result = Dart_Invoke(result, NewString("main"), 0, NULL); |
6826 EXPECT(Dart_IsError(result)); | 6859 EXPECT(Dart_IsError(result)); |
6827 EXPECT_SUBSTRING("NoSuchMethodError", Dart_GetError(result)); | 6860 EXPECT_SUBSTRING("NoSuchMethodError", Dart_GetError(result)); |
6828 } | 6861 } |
6829 | 6862 |
6830 | 6863 |
6831 // Test that if the same name is imported from two libraries, it is | 6864 // Test that if the same name is imported from two libraries, it is |
6832 // not an error if that name is not used. | 6865 // not an error if that name is not used. |
6833 TEST_CASE(ImportLibrary4) { | 6866 TEST_CASE(ImportLibrary4) { |
(...skipping 17 matching lines...) Expand all Loading... |
6851 result = Dart_LoadScript(url, source, 0, 0); | 6884 result = Dart_LoadScript(url, source, 0, 0); |
6852 EXPECT_VALID(result); | 6885 EXPECT_VALID(result); |
6853 | 6886 |
6854 url = NewString("library2_dart"); | 6887 url = NewString("library2_dart"); |
6855 source = NewString(kLibrary2Chars); | 6888 source = NewString(kLibrary2Chars); |
6856 Dart_LoadLibrary(url, source); | 6889 Dart_LoadLibrary(url, source); |
6857 | 6890 |
6858 url = NewString("library1_dart"); | 6891 url = NewString("library1_dart"); |
6859 source = NewString(kLibrary1Chars); | 6892 source = NewString(kLibrary1Chars); |
6860 Dart_LoadLibrary(url, source); | 6893 Dart_LoadLibrary(url, source); |
| 6894 Dart_FinalizeLoading(false); |
6861 | 6895 |
6862 result = Dart_Invoke(result, NewString("main"), 0, NULL); | 6896 result = Dart_Invoke(result, NewString("main"), 0, NULL); |
6863 EXPECT_VALID(result); | 6897 EXPECT_VALID(result); |
6864 } | 6898 } |
6865 | 6899 |
6866 | 6900 |
6867 TEST_CASE(ImportLibrary5) { | 6901 TEST_CASE(ImportLibrary5) { |
6868 const char* kScriptChars = | 6902 const char* kScriptChars = |
6869 "import 'lib.dart';\n" | 6903 "import 'lib.dart';\n" |
6870 "abstract class Y {\n" | 6904 "abstract class Y {\n" |
(...skipping 10 matching lines...) Expand all Loading... |
6881 // Create a test library and Load up a test script in it. | 6915 // Create a test library and Load up a test script in it. |
6882 Dart_Handle url = NewString(TestCase::url()); | 6916 Dart_Handle url = NewString(TestCase::url()); |
6883 Dart_Handle source = NewString(kScriptChars); | 6917 Dart_Handle source = NewString(kScriptChars); |
6884 result = Dart_SetLibraryTagHandler(library_handler); | 6918 result = Dart_SetLibraryTagHandler(library_handler); |
6885 EXPECT_VALID(result); | 6919 EXPECT_VALID(result); |
6886 result = Dart_LoadScript(url, source, 0, 0); | 6920 result = Dart_LoadScript(url, source, 0, 0); |
6887 | 6921 |
6888 url = NewString("lib.dart"); | 6922 url = NewString("lib.dart"); |
6889 source = NewString(kLibraryChars); | 6923 source = NewString(kLibraryChars); |
6890 Dart_LoadLibrary(url, source); | 6924 Dart_LoadLibrary(url, source); |
| 6925 Dart_FinalizeLoading(false); |
6891 | 6926 |
6892 result = Dart_Invoke(result, NewString("main"), 0, NULL); | 6927 result = Dart_Invoke(result, NewString("main"), 0, NULL); |
6893 EXPECT_VALID(result); | 6928 EXPECT_VALID(result); |
6894 } | 6929 } |
6895 | 6930 |
6896 | 6931 |
6897 void NewNativePort_send123(Dart_Port dest_port_id, | 6932 void NewNativePort_send123(Dart_Port dest_port_id, |
6898 Dart_CObject *message) { | 6933 Dart_CObject *message) { |
6899 // Gets a send port message. | 6934 // Gets a send port message. |
6900 EXPECT_NOTNULL(message); | 6935 EXPECT_NOTNULL(message); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7020 } | 7055 } |
7021 Dart_Isolate isolate = TestCase::CreateTestIsolate(); | 7056 Dart_Isolate isolate = TestCase::CreateTestIsolate(); |
7022 ASSERT(isolate != NULL); | 7057 ASSERT(isolate != NULL); |
7023 Dart_EnterScope(); | 7058 Dart_EnterScope(); |
7024 Dart_Handle url = NewString(TestCase::url()); | 7059 Dart_Handle url = NewString(TestCase::url()); |
7025 Dart_Handle source = NewString(kScriptChars); | 7060 Dart_Handle source = NewString(kScriptChars); |
7026 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler); | 7061 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler); |
7027 EXPECT_VALID(result); | 7062 EXPECT_VALID(result); |
7028 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); | 7063 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); |
7029 EXPECT_VALID(lib); | 7064 EXPECT_VALID(lib); |
| 7065 result = Dart_FinalizeLoading(false); |
| 7066 EXPECT_VALID(result); |
7030 Dart_ExitScope(); | 7067 Dart_ExitScope(); |
7031 Dart_ExitIsolate(); | 7068 Dart_ExitIsolate(); |
7032 bool retval = Dart_IsolateMakeRunnable(isolate); | 7069 bool retval = Dart_IsolateMakeRunnable(isolate); |
7033 EXPECT(retval); | 7070 EXPECT(retval); |
7034 return isolate; | 7071 return isolate; |
7035 } | 7072 } |
7036 | 7073 |
7037 | 7074 |
7038 // The error string from the last unhandled exception. This value is only | 7075 // The error string from the last unhandled exception. This value is only |
7039 // valid until the next Dart_ExitScope(). | 7076 // valid until the next Dart_ExitScope(). |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7161 bin::snapshot_buffer, | 7198 bin::snapshot_buffer, |
7162 NULL, &error); | 7199 NULL, &error); |
7163 EXPECT(shared_isolate != NULL); | 7200 EXPECT(shared_isolate != NULL); |
7164 Dart_EnterScope(); | 7201 Dart_EnterScope(); |
7165 Dart_Handle url = NewString(TestCase::url()); | 7202 Dart_Handle url = NewString(TestCase::url()); |
7166 Dart_Handle source = NewString(kScriptChars); | 7203 Dart_Handle source = NewString(kScriptChars); |
7167 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler); | 7204 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler); |
7168 EXPECT_VALID(result); | 7205 EXPECT_VALID(result); |
7169 lib = Dart_LoadScript(url, source, 0, 0); | 7206 lib = Dart_LoadScript(url, source, 0, 0); |
7170 EXPECT_VALID(lib); | 7207 EXPECT_VALID(lib); |
| 7208 result = Dart_FinalizeLoading(false); |
| 7209 EXPECT_VALID(result); |
7171 result = | 7210 result = |
7172 Dart_SetNativeResolver(lib, &IsolateInterruptTestNativeLookup, NULL); | 7211 Dart_SetNativeResolver(lib, &IsolateInterruptTestNativeLookup, NULL); |
7173 DART_CHECK_VALID(result); | 7212 DART_CHECK_VALID(result); |
7174 | 7213 |
7175 sync->Notify(); | 7214 sync->Notify(); |
7176 sync->Exit(); | 7215 sync->Exit(); |
7177 } | 7216 } |
7178 | 7217 |
7179 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 7218 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
7180 EXPECT(Dart_IsError(result)); | 7219 EXPECT(Dart_IsError(result)); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7346 Isolate::SetShutdownCallback(IsolateShutdownRunDartCodeTestCallback); | 7385 Isolate::SetShutdownCallback(IsolateShutdownRunDartCodeTestCallback); |
7347 | 7386 |
7348 { | 7387 { |
7349 Dart_EnterScope(); | 7388 Dart_EnterScope(); |
7350 Dart_Handle url = NewString(TestCase::url()); | 7389 Dart_Handle url = NewString(TestCase::url()); |
7351 Dart_Handle source = NewString(kScriptChars); | 7390 Dart_Handle source = NewString(kScriptChars); |
7352 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler); | 7391 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler); |
7353 EXPECT_VALID(result); | 7392 EXPECT_VALID(result); |
7354 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); | 7393 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); |
7355 EXPECT_VALID(lib); | 7394 EXPECT_VALID(lib); |
| 7395 result = Dart_FinalizeLoading(false); |
| 7396 EXPECT_VALID(result); |
7356 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 7397 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
7357 EXPECT_VALID(result); | 7398 EXPECT_VALID(result); |
7358 Dart_ExitScope(); | 7399 Dart_ExitScope(); |
7359 } | 7400 } |
7360 | 7401 |
7361 | 7402 |
7362 // The shutdown callback has not been called. | 7403 // The shutdown callback has not been called. |
7363 EXPECT_EQ(0, add_result); | 7404 EXPECT_EQ(0, add_result); |
7364 | 7405 |
7365 EXPECT(isolate != NULL); | 7406 EXPECT(isolate != NULL); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7526 // Load a test script. | 7567 // Load a test script. |
7527 Dart_Handle url = NewString(TestCase::url()); | 7568 Dart_Handle url = NewString(TestCase::url()); |
7528 Dart_Handle source = NewString(kScriptChars); | 7569 Dart_Handle source = NewString(kScriptChars); |
7529 result = Dart_SetLibraryTagHandler(library_handler); | 7570 result = Dart_SetLibraryTagHandler(library_handler); |
7530 EXPECT_VALID(result); | 7571 EXPECT_VALID(result); |
7531 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); | 7572 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); |
7532 EXPECT_VALID(lib); | 7573 EXPECT_VALID(lib); |
7533 EXPECT(Dart_IsLibrary(lib)); | 7574 EXPECT(Dart_IsLibrary(lib)); |
7534 result = Dart_SetNativeResolver(lib, &MyNativeClosureResolver, NULL); | 7575 result = Dart_SetNativeResolver(lib, &MyNativeClosureResolver, NULL); |
7535 EXPECT_VALID(result); | 7576 EXPECT_VALID(result); |
| 7577 result = Dart_FinalizeLoading(false); |
| 7578 EXPECT_VALID(result); |
7536 | 7579 |
7537 result = Dart_Invoke(lib, NewString("testMain"), 0, NULL); | 7580 result = Dart_Invoke(lib, NewString("testMain"), 0, NULL); |
7538 EXPECT_VALID(result); | 7581 EXPECT_VALID(result); |
7539 EXPECT(Dart_IsInteger(result)); | 7582 EXPECT(Dart_IsInteger(result)); |
7540 int64_t value = 0; | 7583 int64_t value = 0; |
7541 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); | 7584 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); |
7542 EXPECT_EQ(0, value); | 7585 EXPECT_EQ(0, value); |
7543 } | 7586 } |
7544 | 7587 |
7545 | 7588 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7673 // Load a test script. | 7716 // Load a test script. |
7674 Dart_Handle url = NewString(TestCase::url()); | 7717 Dart_Handle url = NewString(TestCase::url()); |
7675 Dart_Handle source = NewString(kScriptChars); | 7718 Dart_Handle source = NewString(kScriptChars); |
7676 result = Dart_SetLibraryTagHandler(library_handler); | 7719 result = Dart_SetLibraryTagHandler(library_handler); |
7677 EXPECT_VALID(result); | 7720 EXPECT_VALID(result); |
7678 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); | 7721 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); |
7679 EXPECT_VALID(lib); | 7722 EXPECT_VALID(lib); |
7680 EXPECT(Dart_IsLibrary(lib)); | 7723 EXPECT(Dart_IsLibrary(lib)); |
7681 result = Dart_SetNativeResolver(lib, &MyStaticNativeClosureResolver, NULL); | 7724 result = Dart_SetNativeResolver(lib, &MyStaticNativeClosureResolver, NULL); |
7682 EXPECT_VALID(result); | 7725 EXPECT_VALID(result); |
| 7726 result = Dart_FinalizeLoading(false); |
| 7727 EXPECT_VALID(result); |
7683 | 7728 |
7684 result = Dart_Invoke(lib, NewString("testMain"), 0, NULL); | 7729 result = Dart_Invoke(lib, NewString("testMain"), 0, NULL); |
7685 EXPECT_VALID(result); | 7730 EXPECT_VALID(result); |
7686 EXPECT(Dart_IsInteger(result)); | 7731 EXPECT(Dart_IsInteger(result)); |
7687 int64_t value = 0; | 7732 int64_t value = 0; |
7688 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); | 7733 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); |
7689 EXPECT_EQ(0, value); | 7734 EXPECT_EQ(0, value); |
7690 } | 7735 } |
7691 | 7736 |
7692 | 7737 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8349 // Create a test library and Load up a test script in it. | 8394 // Create a test library and Load up a test script in it. |
8350 Dart_Handle lib1 = TestCase::LoadTestScript(kLoadFirst, NULL); | 8395 Dart_Handle lib1 = TestCase::LoadTestScript(kLoadFirst, NULL); |
8351 Dart_Handle dart_args[1]; | 8396 Dart_Handle dart_args[1]; |
8352 dart_args[0] = Dart_NewInteger(0); | 8397 dart_args[0] = Dart_NewInteger(0); |
8353 result = Dart_Invoke(lib1, NewString("start"), 1, dart_args); | 8398 result = Dart_Invoke(lib1, NewString("start"), 1, dart_args); |
8354 EXPECT_VALID(result); | 8399 EXPECT_VALID(result); |
8355 | 8400 |
8356 Dart_Handle source = NewString(kLoadSecond); | 8401 Dart_Handle source = NewString(kLoadSecond); |
8357 Dart_Handle url = NewString(TestCase::url()); | 8402 Dart_Handle url = NewString(TestCase::url()); |
8358 Dart_LoadSource(TestCase::lib(), url, source); | 8403 Dart_LoadSource(TestCase::lib(), url, source); |
| 8404 result = Dart_FinalizeLoading(false); |
| 8405 EXPECT_VALID(result); |
8359 | 8406 |
8360 dart_args[0] = Dart_NewInteger(1); | 8407 dart_args[0] = Dart_NewInteger(1); |
8361 result = Dart_Invoke(lib1, NewString("start"), 1, dart_args); | 8408 result = Dart_Invoke(lib1, NewString("start"), 1, dart_args); |
8362 EXPECT_VALID(result); | 8409 EXPECT_VALID(result); |
8363 } | 8410 } |
8364 | 8411 |
8365 | 8412 |
8366 // Test external strings and optimized code. | 8413 // Test external strings and optimized code. |
8367 static void ExternalStringDeoptimize_Finalize(void* peer) { | 8414 static void ExternalStringDeoptimize_Finalize(void* peer) { |
8368 delete[] reinterpret_cast<char*>(peer); | 8415 delete[] reinterpret_cast<char*>(peer); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8559 NewString("main"), | 8606 NewString("main"), |
8560 1, | 8607 1, |
8561 dart_args); | 8608 dart_args); |
8562 int64_t value = 0; | 8609 int64_t value = 0; |
8563 result = Dart_IntegerToInt64(result, &value); | 8610 result = Dart_IntegerToInt64(result, &value); |
8564 EXPECT_VALID(result); | 8611 EXPECT_VALID(result); |
8565 EXPECT_EQ(6, value); | 8612 EXPECT_EQ(6, value); |
8566 } | 8613 } |
8567 | 8614 |
8568 } // namespace dart | 8615 } // namespace dart |
OLD | NEW |