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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 static int closure_hit_count = 0; | 74 static int closure_hit_count = 0; |
75 int64_t closure_bp_id[4]; | 75 int64_t closure_bp_id[4]; |
76 static void PausedInClosuresHandler(Dart_IsolateId isolate_id, | 76 static void PausedInClosuresHandler(Dart_IsolateId isolate_id, |
77 intptr_t bp_id, | 77 intptr_t bp_id, |
78 const Dart_CodeLocation& location) { | 78 const Dart_CodeLocation& location) { |
79 EXPECT(bp_id == closure_bp_id[closure_hit_count]); | 79 EXPECT(bp_id == closure_bp_id[closure_hit_count]); |
80 closure_hit_count++; | 80 closure_hit_count++; |
81 } | 81 } |
82 | 82 |
| 83 TEST_CASE(Debugger_SetBreakpointInPartOfLibrary) { |
| 84 const char* kMainScript = "main() {}\n"; |
| 85 const char* kLib = "library test_lib;\n"; |
| 86 const char* kLibPart = |
| 87 "part of test_lib;\n" |
| 88 "void func(int a, int b) {\n" |
| 89 " return a + b;\n" |
| 90 "}\n"; |
| 91 SetFlagScope<bool> sfs(&FLAG_remove_script_timestamps_for_test, true); |
| 92 Dart_Handle root_lib = TestCase::LoadTestScript(kMainScript, NULL); |
| 93 EXPECT_VALID(root_lib); |
| 94 |
| 95 Dart_Handle url = NewString("test_lib_url"); |
| 96 Dart_Handle lib_source = NewString(kLib); |
| 97 Dart_Handle lib = Dart_LoadLibrary(url, Dart_Null(), lib_source, 0, 0); |
| 98 EXPECT_VALID(lib); |
| 99 EXPECT(Dart_IsLibrary(lib)); |
| 100 |
| 101 Dart_Handle part_url = NewString("part_url"); |
| 102 Dart_Handle part_source = NewString(kLibPart); |
| 103 Dart_Handle result = |
| 104 Dart_LoadSource(lib, part_url, Dart_Null(), part_source, 0, 0); |
| 105 EXPECT_VALID(result); |
| 106 EXPECT(Dart_IsLibrary(result)); |
| 107 EXPECT(Dart_IdentityEquals(lib, result)); |
| 108 |
| 109 result = Dart_SetBreakpoint(part_url, 3); |
| 110 EXPECT_VALID(result); |
| 111 EXPECT(Dart_IsInteger(result)); |
| 112 } |
| 113 |
83 TEST_CASE(Debugger_SetBreakpointInFunctionLiteralFieldInitializers) { | 114 TEST_CASE(Debugger_SetBreakpointInFunctionLiteralFieldInitializers) { |
84 const char* kScriptChars = | 115 const char* kScriptChars = |
85 "main() {\n" | 116 "main() {\n" |
86 " var c = new MyClass();\n" | 117 " var c = new MyClass();\n" |
87 " c.closure(1, 2);\n" | 118 " c.closure(1, 2);\n" |
88 " MyClass.staticClosure(7, 8);\n" | 119 " MyClass.staticClosure(7, 8);\n" |
89 " closure(3, 4);\n" | 120 " closure(3, 4);\n" |
90 " closureSingleLine(5, 6);\n" | 121 " closureSingleLine(5, 6);\n" |
91 "}\n" | 122 "}\n" |
92 "class MyClass {\n" | 123 "class MyClass {\n" |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 "enter(bar1) enter(bar2) enter(bar3) enter(foo) " | 615 "enter(bar1) enter(bar2) enter(bar3) enter(foo) " |
585 "enter(bar3) enter(foo) " | 616 "enter(bar3) enter(foo) " |
586 "exit(foo) exit(bar3) exit(bar2) exit(bar1) ", | 617 "exit(foo) exit(bar3) exit(bar2) exit(bar1) ", |
587 result_cstr); | 618 result_cstr); |
588 EXPECT(saw_paused_event); | 619 EXPECT(saw_paused_event); |
589 } | 620 } |
590 | 621 |
591 #endif // !PRODUCT | 622 #endif // !PRODUCT |
592 | 623 |
593 } // namespace dart | 624 } // namespace dart |
OLD | NEW |