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

Unified Diff: runtime/vm/debugger_test.cc

Issue 2904793002: Allow setting breakpoints in literal function initializers of fields. (Closed)
Patch Set: Add comments Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/debugger_test.cc
diff --git a/runtime/vm/debugger_test.cc b/runtime/vm/debugger_test.cc
index 8963195085e74d01175739853ea99276dd2cade9..86792f04667e8069d61b474fcd552009f44f26f4 100644
--- a/runtime/vm/debugger_test.cc
+++ b/runtime/vm/debugger_test.cc
@@ -71,6 +71,45 @@ TEST_CASE(Debugger_GetBreakpointsById) {
EXPECT(debugger->GetBreakpointById(bp_id2) != NULL);
}
+TEST_CASE(Debugger_SetBreakpointInFunctionLiteralFieldInitializers) {
+ const char* kScriptChars =
+ "main() {\n"
+ " var c = new MyClass();\n"
+ " c.closure(1, 2);\n"
+ " closure(3, 4);\n"
+ "}\n"
+ "class MyClass {\n"
+ " var closure = (int a, int b) {\n"
+ " return a + b;\n"
+ " };\n"
+ "}\n"
+ "var closure = (int a, int b) {\n"
+ " return a + b;\n"
+ "};\n";
siva 2017/05/24 19:51:23 Can we add more tests 1. => function tests e.g var
sivachandra 2017/05/26 07:17:58 Done.
+ SetFlagScope<bool> sfs(&FLAG_remove_script_timestamps_for_test, true);
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ EXPECT_VALID(lib);
+
+ Isolate* isolate = Isolate::Current();
+ Debugger* debugger = isolate->debugger();
+
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle result = Dart_SetBreakpoint(url, 8);
+ EXPECT_VALID(result);
+ EXPECT(Dart_IsInteger(result));
+ int64_t bp_id1 = 0;
+ EXPECT_VALID(Dart_IntegerToInt64(result, &bp_id1));
+
+ result = Dart_SetBreakpoint(url, 12);
+ EXPECT_VALID(result);
+ EXPECT(Dart_IsInteger(result));
+ int64_t bp_id2 = 0;
+ EXPECT_VALID(Dart_IntegerToInt64(result, &bp_id2));
+
+ EXPECT(debugger->GetBreakpointById(bp_id1) != NULL);
+ EXPECT(debugger->GetBreakpointById(bp_id2) != NULL);
siva 2017/05/24 19:51:23 Should test if the breakpoint is actually hit by r
sivachandra 2017/05/26 07:17:58 Done.
+}
+
TEST_CASE(Debugger_RemoveBreakpoint) {
const char* kScriptChars =
"main() {\n"
« runtime/vm/debugger.cc ('K') | « runtime/vm/debugger.cc ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698