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

Unified Diff: runtime/vm/debugger_test.cc

Issue 113513004: Handle vmservice messages while at breakpoint. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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
« no previous file with comments | « runtime/vm/debugger_api_impl_test.cc ('k') | runtime/vm/json_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_test.cc
===================================================================
--- runtime/vm/debugger_test.cc (revision 0)
+++ runtime/vm/debugger_test.cc (working copy)
@@ -0,0 +1,57 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "vm/debugger.h"
+#include "vm/unit_test.h"
+
+namespace dart {
+
+TEST_CASE(Debugger_PrintBreakpointsToJSONArray) {
+ const char* kScriptChars =
+ "void main() {\n"
+ " print('won');\n"
+ " print('too');\n"
+ " print('free');\n"
+ " print('for');\n"
+ "}\n";
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ EXPECT_VALID(lib);
+
+ Isolate* isolate = Isolate::Current();
+ Debugger* debugger = isolate->debugger();
+ const String& url = String::Handle(String::New(TestCase::url()));
+
+ // Empty case.
+ {
+ JSONStream js;
+ {
+ JSONArray jsarr(&js);
+ debugger->PrintBreakpointsToJSONArray(&jsarr);
+ }
+ EXPECT_STREQ("[]", js.ToCString());
+ }
+
+ // Test with a couple of breakpoints.
+ debugger->SetBreakpointAtLine(url, 2);
+ debugger->SetBreakpointAtLine(url, 3);
+ {
+ JSONStream js;
+ {
+ JSONArray jsarr(&js);
+ debugger->PrintBreakpointsToJSONArray(&jsarr);
+ }
+ EXPECT_STREQ(
+ "[{\"type\":\"Breakpoint\",\"id\":2,"
+ "\"enabled\":true,\"resolved\":false,"
+ "\"location\":{\"type\":\"Location\",\"libId\":12,"
+ "\"script\":\"dart:test-lib\",\"tokenPos\":12}},"
+ "{\"type\":\"Breakpoint\",\"id\":1,"
+ "\"enabled\":true,\"resolved\":false,"
+ "\"location\":{\"type\":\"Location\",\"libId\":12,"
+ "\"script\":\"dart:test-lib\",\"tokenPos\":6}}]",
+ js.ToCString());
+ }
+}
+
+} // namespace dart
« no previous file with comments | « runtime/vm/debugger_api_impl_test.cc ('k') | runtime/vm/json_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698