Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: runtime/vm/debugger_test.cc

Issue 2912763005: Hit breakpoints in single line closures. (Closed)
Patch Set: Enable a test with dartk which now passes Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/debugger.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 result = Dart_SetBreakpoint(url, 17); 123 result = Dart_SetBreakpoint(url, 17);
124 EXPECT_VALID(result); 124 EXPECT_VALID(result);
125 EXPECT(Dart_IsInteger(result)); 125 EXPECT(Dart_IsInteger(result));
126 EXPECT_VALID(Dart_IntegerToInt64(result, &closure_bp_id[2])); 126 EXPECT_VALID(Dart_IntegerToInt64(result, &closure_bp_id[2]));
127 127
128 result = Dart_SetBreakpoint(url, 19); 128 result = Dart_SetBreakpoint(url, 19);
129 EXPECT_VALID(result); 129 EXPECT_VALID(result);
130 EXPECT(Dart_IsInteger(result)); 130 EXPECT(Dart_IsInteger(result));
131 EXPECT_VALID(Dart_IntegerToInt64(result, &closure_bp_id[3])); 131 EXPECT_VALID(Dart_IntegerToInt64(result, &closure_bp_id[3]));
132 132
133 // Cannot set breakpoint at the start of the class definition.
134 // The implicit constructor token position matches that of the
135 // class definition's token position. So, we do not want to
136 // allow setting breakpoints in implicit consturctors.
137 result = Dart_SetBreakpoint(url, 8);
138 EXPECT_ERROR(result, "could not set breakpoint at line 8");
139
133 result = Dart_SetBreakpoint(url, 20); 140 result = Dart_SetBreakpoint(url, 20);
134 EXPECT_ERROR(result, "could not set breakpoint at line 20"); 141 EXPECT_ERROR(result, "could not set breakpoint at line 20");
135 142
136 EXPECT(debugger->GetBreakpointById(closure_bp_id[0]) != NULL); 143 EXPECT(debugger->GetBreakpointById(closure_bp_id[0]) != NULL);
137 EXPECT(debugger->GetBreakpointById(closure_bp_id[1]) != NULL); 144 EXPECT(debugger->GetBreakpointById(closure_bp_id[1]) != NULL);
138 EXPECT(debugger->GetBreakpointById(closure_bp_id[2]) != NULL); 145 EXPECT(debugger->GetBreakpointById(closure_bp_id[2]) != NULL);
139 EXPECT(debugger->GetBreakpointById(closure_bp_id[3]) != NULL); 146 EXPECT(debugger->GetBreakpointById(closure_bp_id[3]) != NULL);
140 147
141 Dart_SetPausedEventHandler(PausedInClosuresHandler); 148 Dart_SetPausedEventHandler(PausedInClosuresHandler);
142 result = Dart_Invoke(lib, NewString("main"), 0, NULL); 149 result = Dart_Invoke(lib, NewString("main"), 0, NULL);
143 EXPECT_VALID(result); 150 EXPECT_VALID(result);
144 // TODO(sivachandra): Understand why a breakpoint on a single line 151 EXPECT(closure_hit_count == 4);
145 // functional literal is not being hit. When that issue is resolved,
146 // adjust this test to check hitting the breakpoint at line 19 also.
147 EXPECT(closure_hit_count == 3);
148 } 152 }
149 153
150 TEST_CASE(Debugger_RemoveBreakpoint) { 154 TEST_CASE(Debugger_RemoveBreakpoint) {
151 const char* kScriptChars = 155 const char* kScriptChars =
152 "main() {\n" 156 "main() {\n"
153 " var x = new StringBuffer();\n" 157 " var x = new StringBuffer();\n"
154 " x.add('won');\n" 158 " x.add('won');\n"
155 " x.add('too');\n" 159 " x.add('too');\n"
156 " return x.toString();\n" 160 " return x.toString();\n"
157 "}\n"; 161 "}\n";
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 "enter(bar1) enter(bar2) enter(bar3) enter(foo) " 584 "enter(bar1) enter(bar2) enter(bar3) enter(foo) "
581 "enter(bar3) enter(foo) " 585 "enter(bar3) enter(foo) "
582 "exit(foo) exit(bar3) exit(bar2) exit(bar1) ", 586 "exit(foo) exit(bar3) exit(bar2) exit(bar1) ",
583 result_cstr); 587 result_cstr);
584 EXPECT(saw_paused_event); 588 EXPECT(saw_paused_event);
585 } 589 }
586 590
587 #endif // !PRODUCT 591 #endif // !PRODUCT
588 592
589 } // namespace dart 593 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698