| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "vm/dart_api_impl.h" | 5 #include "vm/dart_api_impl.h" |
| 6 #include "vm/dart_api_message.h" | 6 #include "vm/dart_api_message.h" |
| 7 #include "vm/debugger.h" | 7 #include "vm/debugger.h" |
| 8 #include "vm/message.h" | 8 #include "vm/message.h" |
| 9 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 " x.add('won');\n" | 46 " x.add('won');\n" |
| 47 " x.add('too');\n" | 47 " x.add('too');\n" |
| 48 " return x.toString();\n" | 48 " return x.toString();\n" |
| 49 "}\n"; | 49 "}\n"; |
| 50 SetFlagScope<bool> sfs(&FLAG_remove_script_timestamps_for_test, true); | 50 SetFlagScope<bool> sfs(&FLAG_remove_script_timestamps_for_test, true); |
| 51 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 51 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 52 EXPECT_VALID(lib); | 52 EXPECT_VALID(lib); |
| 53 Library& vmlib = Library::Handle(); | 53 Library& vmlib = Library::Handle(); |
| 54 vmlib ^= Api::UnwrapHandle(lib); | 54 vmlib ^= Api::UnwrapHandle(lib); |
| 55 EXPECT(!vmlib.IsNull()); | 55 EXPECT(!vmlib.IsNull()); |
| 56 const String& private_key = String::Handle(vmlib.private_key()); |
| 56 | 57 |
| 57 Isolate* isolate = Isolate::Current(); | 58 Isolate* isolate = Isolate::Current(); |
| 58 Debugger* debugger = isolate->debugger(); | 59 Debugger* debugger = isolate->debugger(); |
| 59 | 60 |
| 60 // Empty case. | 61 // Empty case. |
| 61 { | 62 { |
| 62 JSONStream js; | 63 JSONStream js; |
| 63 { | 64 { |
| 64 JSONArray jsarr(&js); | 65 JSONArray jsarr(&js); |
| 65 debugger->PrintBreakpointsToJSONArray(&jsarr); | 66 debugger->PrintBreakpointsToJSONArray(&jsarr); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 76 { | 77 { |
| 77 JSONArray jsarr(&js); | 78 JSONArray jsarr(&js); |
| 78 debugger->PrintBreakpointsToJSONArray(&jsarr); | 79 debugger->PrintBreakpointsToJSONArray(&jsarr); |
| 79 } | 80 } |
| 80 ExpectSubstringF( | 81 ExpectSubstringF( |
| 81 js.ToCString(), | 82 js.ToCString(), |
| 82 "[{\"type\":\"Breakpoint\",\"fixedId\":true,\"id\":\"breakpoints\\/2\"," | 83 "[{\"type\":\"Breakpoint\",\"fixedId\":true,\"id\":\"breakpoints\\/2\"," |
| 83 "\"breakpointNumber\":2,\"resolved\":false," | 84 "\"breakpointNumber\":2,\"resolved\":false," |
| 84 "\"location\":{\"type\":\"UnresolvedSourceLocation\"," | 85 "\"location\":{\"type\":\"UnresolvedSourceLocation\"," |
| 85 "\"script\":{\"type\":\"@Script\",\"fixedId\":true," | 86 "\"script\":{\"type\":\"@Script\",\"fixedId\":true," |
| 86 "\"id\":\"libraries\\/%" Pd | 87 "\"id\":\"libraries\\/%s" |
| 87 "\\/scripts\\/test-lib\\/0\"," | 88 "\\/scripts\\/test-lib\\/0\"," |
| 88 "\"uri\":\"test-lib\"," | 89 "\"uri\":\"test-lib\"," |
| 89 "\"_kind\":\"script\"},\"line\":3}}," | 90 "\"_kind\":\"script\"},\"line\":3}}," |
| 90 "{\"type\":\"Breakpoint\",\"fixedId\":true,\"id\":\"breakpoints\\/1\"," | 91 "{\"type\":\"Breakpoint\",\"fixedId\":true,\"id\":\"breakpoints\\/1\"," |
| 91 "\"breakpointNumber\":1,\"resolved\":false," | 92 "\"breakpointNumber\":1,\"resolved\":false," |
| 92 "\"location\":{\"type\":\"UnresolvedSourceLocation\"," | 93 "\"location\":{\"type\":\"UnresolvedSourceLocation\"," |
| 93 "\"script\":{\"type\":\"@Script\",\"fixedId\":true," | 94 "\"script\":{\"type\":\"@Script\",\"fixedId\":true," |
| 94 "\"id\":\"libraries\\/%" Pd | 95 "\"id\":\"libraries\\/%s" |
| 95 "\\/scripts\\/test-lib\\/0\"," | 96 "\\/scripts\\/test-lib\\/0\"," |
| 96 "\"uri\":\"test-lib\"," | 97 "\"uri\":\"test-lib\"," |
| 97 "\"_kind\":\"script\"},\"line\":2}}]", | 98 "\"_kind\":\"script\"},\"line\":2}}]", |
| 98 vmlib.index(), vmlib.index()); | 99 private_key.ToCString(), private_key.ToCString()); |
| 99 } | 100 } |
| 100 } | 101 } |
| 101 | 102 |
| 102 | 103 |
| 103 static bool saw_paused_event = false; | 104 static bool saw_paused_event = false; |
| 104 | 105 |
| 105 static void InspectPausedEvent(Dart_IsolateId isolate_id, | 106 static void InspectPausedEvent(Dart_IsolateId isolate_id, |
| 106 intptr_t bp_id, | 107 intptr_t bp_id, |
| 107 const Dart_CodeLocation& loc) { | 108 const Dart_CodeLocation& loc) { |
| 108 Isolate* isolate = Isolate::Current(); | 109 Isolate* isolate = Isolate::Current(); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 "enter(bar1) enter(bar2) enter(bar3) enter(foo) " | 432 "enter(bar1) enter(bar2) enter(bar3) enter(foo) " |
| 432 "enter(bar3) enter(foo) " | 433 "enter(bar3) enter(foo) " |
| 433 "exit(foo) exit(bar3) exit(bar2) exit(bar1) ", | 434 "exit(foo) exit(bar3) exit(bar2) exit(bar1) ", |
| 434 result_cstr); | 435 result_cstr); |
| 435 EXPECT(saw_paused_event); | 436 EXPECT(saw_paused_event); |
| 436 } | 437 } |
| 437 | 438 |
| 438 #endif // !PRODUCT | 439 #endif // !PRODUCT |
| 439 | 440 |
| 440 } // namespace dart | 441 } // namespace dart |
| OLD | NEW |