| 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 "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_api_message.h" | 10 #include "vm/dart_api_message.h" |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 | 994 |
| 995 { | 995 { |
| 996 // Create an Isolate using the full snapshot, load a script and create | 996 // Create an Isolate using the full snapshot, load a script and create |
| 997 // a script snapshot of the script. | 997 // a script snapshot of the script. |
| 998 TestCase::CreateTestIsolateFromSnapshot(full_snapshot); | 998 TestCase::CreateTestIsolateFromSnapshot(full_snapshot); |
| 999 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. | 999 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. |
| 1000 | 1000 |
| 1001 // Load the library. | 1001 // Load the library. |
| 1002 Dart_Handle import_lib = Dart_LoadLibrary(Dart_NewString("dart:import-lib"), | 1002 Dart_Handle import_lib = Dart_LoadLibrary(Dart_NewString("dart:import-lib"), |
| 1003 Dart_NewString(kLibScriptChars)); | 1003 Dart_NewString(kLibScriptChars)); |
| 1004 Dart_Handle prefix = Dart_NewString(""); |
| 1004 EXPECT_VALID(import_lib); | 1005 EXPECT_VALID(import_lib); |
| 1005 | 1006 |
| 1006 // Create a test library and Load up a test script in it. | 1007 // Create a test library and Load up a test script in it. |
| 1007 TestCase::LoadTestScript(kScriptChars, NULL); | 1008 TestCase::LoadTestScript(kScriptChars, NULL); |
| 1008 | 1009 |
| 1009 EXPECT_VALID(Dart_LibraryImportLibrary(TestCase::lib(), import_lib)); | 1010 EXPECT_VALID(Dart_LibraryImportLibrary(TestCase::lib(), |
| 1011 import_lib, |
| 1012 prefix)); |
| 1010 | 1013 |
| 1011 // Get list of library URLs loaded and save the count. | 1014 // Get list of library URLs loaded and save the count. |
| 1012 Dart_Handle libs = Dart_GetLibraryURLs(); | 1015 Dart_Handle libs = Dart_GetLibraryURLs(); |
| 1013 EXPECT(Dart_IsList(libs)); | 1016 EXPECT(Dart_IsList(libs)); |
| 1014 Dart_ListLength(libs, &expected_num_libs); | 1017 Dart_ListLength(libs, &expected_num_libs); |
| 1015 | 1018 |
| 1016 // Write out the script snapshot. | 1019 // Write out the script snapshot. |
| 1017 result = Dart_CreateScriptSnapshot(&buffer, &size); | 1020 result = Dart_CreateScriptSnapshot(&buffer, &size); |
| 1018 EXPECT_VALID(result); | 1021 EXPECT_VALID(result); |
| 1019 script_snapshot = reinterpret_cast<uint8_t*>(malloc(size)); | 1022 script_snapshot = reinterpret_cast<uint8_t*>(malloc(size)); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 EXPECT(Dart_ErrorHasException(result)); | 1565 EXPECT(Dart_ErrorHasException(result)); |
| 1563 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", | 1566 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", |
| 1564 Dart_GetError(result)); | 1567 Dart_GetError(result)); |
| 1565 | 1568 |
| 1566 Dart_ExitScope(); | 1569 Dart_ExitScope(); |
| 1567 } | 1570 } |
| 1568 | 1571 |
| 1569 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 1572 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 1570 | 1573 |
| 1571 } // namespace dart | 1574 } // namespace dart |
| OLD | NEW |