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 "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 " static void foo() { \n" | 1384 " static void foo() { \n" |
1385 " moo('good news'); \n" | 1385 " moo('good news'); \n" |
1386 " } \n" | 1386 " } \n" |
1387 "} \n" | 1387 "} \n" |
1388 "void main() { \n" | 1388 "void main() { \n" |
1389 " A.foo(); \n" | 1389 " A.foo(); \n" |
1390 "} \n"; | 1390 "} \n"; |
1391 | 1391 |
1392 Dart_SetIsolateEventHandler(&TestIsolateID); | 1392 Dart_SetIsolateEventHandler(&TestIsolateID); |
1393 Dart_Isolate isolate = TestCase::CreateTestIsolate(); | 1393 Dart_Isolate isolate = TestCase::CreateTestIsolate(); |
1394 ASSERT(isolate != NULL); | 1394 ASSERT(isolate != ILLEGAL_ISOLATE); |
1395 Dart_EnterScope(); | 1395 Dart_EnterScope(); |
1396 LoadScript(kScriptChars); | 1396 LoadScript(kScriptChars); |
1397 Dart_Handle retval = Invoke("main"); | 1397 Dart_Handle retval = Invoke("main"); |
1398 EXPECT_VALID(retval); | 1398 EXPECT_VALID(retval); |
1399 EXPECT(test_isolate_id != ILLEGAL_ISOLATE_ID); | 1399 EXPECT(test_isolate_id != ILLEGAL_ISOLATE_ID); |
1400 EXPECT(Dart_GetIsolate(test_isolate_id) == isolate); | 1400 EXPECT(Dart_GetIsolate(test_isolate_id) == isolate); |
1401 EXPECT(Dart_GetIsolateId(isolate) == test_isolate_id); | 1401 EXPECT(Dart_GetIsolateId(isolate) == test_isolate_id); |
1402 Dart_ExitScope(); | 1402 Dart_ExitScope(); |
1403 Dart_ShutdownIsolate(); | 1403 Dart_ShutdownIsolate(); |
1404 EXPECT(verify_callback == 0x5); // Only created and shutdown events. | 1404 EXPECT(verify_callback == 0x5); // Only created and shutdown events. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 " moo('good news'); \n" | 1476 " moo('good news'); \n" |
1477 " loop = check(); \n" | 1477 " loop = check(); \n" |
1478 " } \n" | 1478 " } \n" |
1479 " } \n" | 1479 " } \n" |
1480 "} \n" | 1480 "} \n" |
1481 "void main() { \n" | 1481 "void main() { \n" |
1482 " A.foo(); \n" | 1482 " A.foo(); \n" |
1483 "} \n"; | 1483 "} \n"; |
1484 | 1484 |
1485 Dart_Isolate isolate = TestCase::CreateTestIsolate(); | 1485 Dart_Isolate isolate = TestCase::CreateTestIsolate(); |
1486 ASSERT(isolate != NULL); | 1486 ASSERT(isolate != ILLEGAL_ISOLATE); |
1487 Dart_EnterScope(); | 1487 Dart_EnterScope(); |
1488 LoadScript(kScriptChars); | 1488 LoadScript(kScriptChars); |
1489 | 1489 |
1490 Dart_Handle result = Dart_SetNativeResolver(script_lib, | 1490 Dart_Handle result = Dart_SetNativeResolver(script_lib, |
1491 &InterruptNativeResolver, | 1491 &InterruptNativeResolver, |
1492 NULL); | 1492 NULL); |
1493 EXPECT_VALID(result); | 1493 EXPECT_VALID(result); |
1494 | 1494 |
1495 Dart_Handle retval = Invoke("main"); | 1495 Dart_Handle retval = Invoke("main"); |
1496 EXPECT_VALID(retval); | 1496 EXPECT_VALID(retval); |
(...skipping 13 matching lines...) Expand all Loading... |
1510 // Wait for the test isolate to be created. | 1510 // Wait for the test isolate to be created. |
1511 { | 1511 { |
1512 MonitorLocker ml(sync); | 1512 MonitorLocker ml(sync); |
1513 while (interrupt_isolate_id == ILLEGAL_ISOLATE_ID) { | 1513 while (interrupt_isolate_id == ILLEGAL_ISOLATE_ID) { |
1514 ml.Wait(); | 1514 ml.Wait(); |
1515 } | 1515 } |
1516 } | 1516 } |
1517 EXPECT(interrupt_isolate_id != ILLEGAL_ISOLATE_ID); | 1517 EXPECT(interrupt_isolate_id != ILLEGAL_ISOLATE_ID); |
1518 | 1518 |
1519 Dart_Isolate isolate = Dart_GetIsolate(interrupt_isolate_id); | 1519 Dart_Isolate isolate = Dart_GetIsolate(interrupt_isolate_id); |
1520 EXPECT(isolate != NULL); | 1520 EXPECT(isolate != ILLEGAL_ISOLATE); |
1521 Dart_InterruptIsolate(isolate); | 1521 Dart_InterruptIsolate(isolate); |
1522 | 1522 |
1523 // Wait for the test isolate to be interrupted. | 1523 // Wait for the test isolate to be interrupted. |
1524 { | 1524 { |
1525 MonitorLocker ml(sync); | 1525 MonitorLocker ml(sync); |
1526 while (!isolate_interrupted || !pause_event_handled) { | 1526 while (!isolate_interrupted || !pause_event_handled) { |
1527 ml.Wait(); | 1527 ml.Wait(); |
1528 } | 1528 } |
1529 } | 1529 } |
1530 EXPECT(isolate_interrupted); | 1530 EXPECT(isolate_interrupted); |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2308 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13," | 2308 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13," |
2309 " null, 4, 13, 3, 14, 10," | 2309 " null, 4, 13, 3, 14, 10," |
2310 " null, 5, 17, 5, 18, 9, 19, 12," | 2310 " null, 5, 17, 5, 18, 9, 19, 12," |
2311 " null, 6, 21, 1," | 2311 " null, 6, 21, 1," |
2312 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," | 2312 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," |
2313 " null, 9, 29, 1]", | 2313 " null, 9, 29, 1]", |
2314 tokens_cstr); | 2314 tokens_cstr); |
2315 } | 2315 } |
2316 | 2316 |
2317 } // namespace dart | 2317 } // namespace dart |
OLD | NEW |