| 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 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 EXPECT_VALID(surrogates_string_result); | 1589 EXPECT_VALID(surrogates_string_result); |
| 1590 EXPECT(Dart_IsString(surrogates_string_result)); | 1590 EXPECT(Dart_IsString(surrogates_string_result)); |
| 1591 | 1591 |
| 1592 Dart_Handle crappy_string_result; | 1592 Dart_Handle crappy_string_result; |
| 1593 crappy_string_result = | 1593 crappy_string_result = |
| 1594 Dart_Invoke(lib, NewString("getCrappyString"), 0, NULL); | 1594 Dart_Invoke(lib, NewString("getCrappyString"), 0, NULL); |
| 1595 EXPECT_VALID(crappy_string_result); | 1595 EXPECT_VALID(crappy_string_result); |
| 1596 EXPECT(Dart_IsString(crappy_string_result)); | 1596 EXPECT(Dart_IsString(crappy_string_result)); |
| 1597 | 1597 |
| 1598 { | 1598 { |
| 1599 HANDLESCOPE(isolate); | 1599 DARTSCOPE(isolate); |
| 1600 | 1600 |
| 1601 { | 1601 { |
| 1602 StackZone zone(Isolate::Current()); | 1602 StackZone zone(Isolate::Current()); |
| 1603 uint8_t* buffer; | 1603 uint8_t* buffer; |
| 1604 MessageWriter writer(&buffer, &zone_allocator); | 1604 MessageWriter writer(&buffer, &zone_allocator); |
| 1605 Smi& smi = Smi::Handle(); | 1605 Smi& smi = Smi::Handle(); |
| 1606 smi ^= Api::UnwrapHandle(smi_result); | 1606 smi ^= Api::UnwrapHandle(smi_result); |
| 1607 writer.WriteMessage(smi); | 1607 writer.WriteMessage(smi); |
| 1608 intptr_t buffer_len = writer.BytesWritten(); | 1608 intptr_t buffer_len = writer.BytesWritten(); |
| 1609 | 1609 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 | 1680 |
| 1681 TestCase::CreateTestIsolate(); | 1681 TestCase::CreateTestIsolate(); |
| 1682 Isolate* isolate = Isolate::Current(); | 1682 Isolate* isolate = Isolate::Current(); |
| 1683 EXPECT(isolate != NULL); | 1683 EXPECT(isolate != NULL); |
| 1684 Dart_EnterScope(); | 1684 Dart_EnterScope(); |
| 1685 | 1685 |
| 1686 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 1686 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 1687 EXPECT_VALID(lib); | 1687 EXPECT_VALID(lib); |
| 1688 | 1688 |
| 1689 { | 1689 { |
| 1690 HANDLESCOPE(isolate); | 1690 DARTSCOPE(isolate); |
| 1691 { | 1691 { |
| 1692 // Generate a list of nulls from Dart code. | 1692 // Generate a list of nulls from Dart code. |
| 1693 ApiNativeScope scope; | 1693 ApiNativeScope scope; |
| 1694 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList"); | 1694 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList"); |
| 1695 EXPECT_NOTNULL(root); | 1695 EXPECT_NOTNULL(root); |
| 1696 EXPECT_EQ(Dart_CObject_kArray, root->type); | 1696 EXPECT_EQ(Dart_CObject_kArray, root->type); |
| 1697 EXPECT_EQ(kArrayLength, root->value.as_array.length); | 1697 EXPECT_EQ(kArrayLength, root->value.as_array.length); |
| 1698 for (int i = 0; i < kArrayLength; i++) { | 1698 for (int i = 0; i < kArrayLength; i++) { |
| 1699 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type); | 1699 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type); |
| 1700 } | 1700 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 | 1798 |
| 1799 TestCase::CreateTestIsolate(); | 1799 TestCase::CreateTestIsolate(); |
| 1800 Isolate* isolate = Isolate::Current(); | 1800 Isolate* isolate = Isolate::Current(); |
| 1801 EXPECT(isolate != NULL); | 1801 EXPECT(isolate != NULL); |
| 1802 Dart_EnterScope(); | 1802 Dart_EnterScope(); |
| 1803 | 1803 |
| 1804 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 1804 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 1805 EXPECT_VALID(lib); | 1805 EXPECT_VALID(lib); |
| 1806 | 1806 |
| 1807 { | 1807 { |
| 1808 HANDLESCOPE(isolate); | 1808 DARTSCOPE(isolate); |
| 1809 { | 1809 { |
| 1810 // Generate a list of nulls from Dart code. | 1810 // Generate a list of nulls from Dart code. |
| 1811 ApiNativeScope scope; | 1811 ApiNativeScope scope; |
| 1812 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList"); | 1812 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList"); |
| 1813 EXPECT_NOTNULL(root); | 1813 EXPECT_NOTNULL(root); |
| 1814 EXPECT_EQ(Dart_CObject_kArray, root->type); | 1814 EXPECT_EQ(Dart_CObject_kArray, root->type); |
| 1815 EXPECT_EQ(kArrayLength, root->value.as_array.length); | 1815 EXPECT_EQ(kArrayLength, root->value.as_array.length); |
| 1816 for (int i = 0; i < kArrayLength; i++) { | 1816 for (int i = 0; i < kArrayLength; i++) { |
| 1817 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type); | 1817 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type); |
| 1818 } | 1818 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 | 2030 |
| 2031 TestCase::CreateTestIsolate(); | 2031 TestCase::CreateTestIsolate(); |
| 2032 Isolate* isolate = Isolate::Current(); | 2032 Isolate* isolate = Isolate::Current(); |
| 2033 EXPECT(isolate != NULL); | 2033 EXPECT(isolate != NULL); |
| 2034 Dart_EnterScope(); | 2034 Dart_EnterScope(); |
| 2035 | 2035 |
| 2036 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 2036 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 2037 EXPECT_VALID(lib); | 2037 EXPECT_VALID(lib); |
| 2038 | 2038 |
| 2039 { | 2039 { |
| 2040 HANDLESCOPE(isolate); | 2040 DARTSCOPE(isolate); |
| 2041 | 2041 |
| 2042 { | 2042 { |
| 2043 // Generate a list of strings from Dart code. | 2043 // Generate a list of strings from Dart code. |
| 2044 ApiNativeScope scope; | 2044 ApiNativeScope scope; |
| 2045 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList"); | 2045 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList"); |
| 2046 EXPECT_NOTNULL(root); | 2046 EXPECT_NOTNULL(root); |
| 2047 EXPECT_EQ(Dart_CObject_kArray, root->type); | 2047 EXPECT_EQ(Dart_CObject_kArray, root->type); |
| 2048 EXPECT_EQ(kArrayLength, root->value.as_array.length); | 2048 EXPECT_EQ(kArrayLength, root->value.as_array.length); |
| 2049 for (int i = 0; i < kArrayLength; i++) { | 2049 for (int i = 0; i < kArrayLength; i++) { |
| 2050 Dart_CObject* element = root->value.as_array.values[i]; | 2050 Dart_CObject* element = root->value.as_array.values[i]; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 | 2235 |
| 2236 TestCase::CreateTestIsolate(); | 2236 TestCase::CreateTestIsolate(); |
| 2237 Isolate* isolate = Isolate::Current(); | 2237 Isolate* isolate = Isolate::Current(); |
| 2238 EXPECT(isolate != NULL); | 2238 EXPECT(isolate != NULL); |
| 2239 Dart_EnterScope(); | 2239 Dart_EnterScope(); |
| 2240 | 2240 |
| 2241 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 2241 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 2242 EXPECT_VALID(lib); | 2242 EXPECT_VALID(lib); |
| 2243 | 2243 |
| 2244 { | 2244 { |
| 2245 HANDLESCOPE(isolate); | 2245 DARTSCOPE(isolate); |
| 2246 { | 2246 { |
| 2247 // Generate a list of strings from Dart code. | 2247 // Generate a list of strings from Dart code. |
| 2248 ApiNativeScope scope; | 2248 ApiNativeScope scope; |
| 2249 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList"); | 2249 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList"); |
| 2250 EXPECT_NOTNULL(root); | 2250 EXPECT_NOTNULL(root); |
| 2251 EXPECT_EQ(Dart_CObject_kArray, root->type); | 2251 EXPECT_EQ(Dart_CObject_kArray, root->type); |
| 2252 EXPECT_EQ(kArrayLength, root->value.as_array.length); | 2252 EXPECT_EQ(kArrayLength, root->value.as_array.length); |
| 2253 for (int i = 0; i < kArrayLength; i++) { | 2253 for (int i = 0; i < kArrayLength; i++) { |
| 2254 Dart_CObject* element = root->value.as_array.values[i]; | 2254 Dart_CObject* element = root->value.as_array.values[i]; |
| 2255 EXPECT_EQ(root->value.as_array.values[0], element); | 2255 EXPECT_EQ(root->value.as_array.values[0], element); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2454 | 2454 |
| 2455 TestCase::CreateTestIsolate(); | 2455 TestCase::CreateTestIsolate(); |
| 2456 Isolate* isolate = Isolate::Current(); | 2456 Isolate* isolate = Isolate::Current(); |
| 2457 EXPECT(isolate != NULL); | 2457 EXPECT(isolate != NULL); |
| 2458 Dart_EnterScope(); | 2458 Dart_EnterScope(); |
| 2459 | 2459 |
| 2460 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 2460 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 2461 EXPECT_VALID(lib); | 2461 EXPECT_VALID(lib); |
| 2462 | 2462 |
| 2463 { | 2463 { |
| 2464 HANDLESCOPE(isolate); | 2464 DARTSCOPE(isolate); |
| 2465 { | 2465 { |
| 2466 // Generate a list of Uint8Lists from Dart code. | 2466 // Generate a list of Uint8Lists from Dart code. |
| 2467 ApiNativeScope scope; | 2467 ApiNativeScope scope; |
| 2468 Dart_CObject* root = GetDeserializedDartMessage(lib, "getTypedDataList"); | 2468 Dart_CObject* root = GetDeserializedDartMessage(lib, "getTypedDataList"); |
| 2469 EXPECT_NOTNULL(root); | 2469 EXPECT_NOTNULL(root); |
| 2470 EXPECT_EQ(Dart_CObject_kArray, root->type); | 2470 EXPECT_EQ(Dart_CObject_kArray, root->type); |
| 2471 struct { | 2471 struct { |
| 2472 Dart_TypedData_Type type; | 2472 Dart_TypedData_Type type; |
| 2473 int size; | 2473 int size; |
| 2474 } expected[] = { | 2474 } expected[] = { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2685 result = Dart_RunLoop(); | 2685 result = Dart_RunLoop(); |
| 2686 EXPECT(Dart_IsError(result)); | 2686 EXPECT(Dart_IsError(result)); |
| 2687 EXPECT(Dart_ErrorHasException(result)); | 2687 EXPECT(Dart_ErrorHasException(result)); |
| 2688 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", | 2688 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", |
| 2689 Dart_GetError(result)); | 2689 Dart_GetError(result)); |
| 2690 | 2690 |
| 2691 Dart_ExitScope(); | 2691 Dart_ExitScope(); |
| 2692 } | 2692 } |
| 2693 | 2693 |
| 2694 } // namespace dart | 2694 } // namespace dart |
| OLD | NEW |