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

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

Issue 216883008: Use tokenPos instead of line/col in the vm service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js / handle multiple reloads Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.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 "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "vm/dart_api_impl.h" 6 #include "vm/dart_api_impl.h"
7 #include "vm/dart_entry.h" 7 #include "vm/dart_entry.h"
8 #include "vm/debugger.h" 8 #include "vm/debugger.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/message_handler.h" 10 #include "vm/message_handler.h"
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 Service::HandleRootMessage(service_msg); 992 Service::HandleRootMessage(service_msg);
993 handler.HandleNextMessage(); 993 handler.HandleNextMessage();
994 EXPECT_SUBSTRING("\"type\":\"VM\",\"id\":\"vm\"", handler.msg()); 994 EXPECT_SUBSTRING("\"type\":\"VM\",\"id\":\"vm\"", handler.msg());
995 EXPECT_SUBSTRING("\"architecture\"", handler.msg()); 995 EXPECT_SUBSTRING("\"architecture\"", handler.msg());
996 EXPECT_SUBSTRING("\"version\"", handler.msg()); 996 EXPECT_SUBSTRING("\"version\"", handler.msg());
997 EXPECT_SUBSTRING("\"uptime\"", handler.msg()); 997 EXPECT_SUBSTRING("\"uptime\"", handler.msg());
998 EXPECT_SUBSTRING("\"isolates\"", handler.msg()); 998 EXPECT_SUBSTRING("\"isolates\"", handler.msg());
999 } 999 }
1000 1000
1001 1001
1002 TEST_CASE(Service_Scripts) {
1003 const char* kScript =
1004 "var port;\n" // Set to our mock port by C++.
1005 "\n"
1006 "main() {\n"
1007 "}";
1008
1009 Isolate* isolate = Isolate::Current();
1010 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, NULL);
1011 EXPECT_VALID(h_lib);
1012
1013 // Build a mock message handler and wrap it in a dart port.
1014 ServiceTestMessageHandler handler;
1015 Dart_Port port_id = PortMap::CreatePort(&handler);
1016 Dart_Handle port =
1017 Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id));
1018 EXPECT_VALID(port);
1019 EXPECT_VALID(Dart_SetField(h_lib, NewString("port"), port));
1020
1021 Instance& service_msg = Instance::Handle();
1022 service_msg = Eval(h_lib, "[port, ['scripts', 'dart:test-lib'], [], []]");
1023 Service::HandleIsolateMessage(isolate, service_msg);
1024 handler.HandleNextMessage();
1025 EXPECT_STREQ(
1026 "{\"type\":\"Script\",\"id\":\"scripts\\/dart%3Atest-lib\","
1027 "\"name\":\"dart:test-lib\",\"user_name\":\"dart:test-lib\","
1028 "\"kind\":\"script\","
1029 "\"source\":\"var port;\\n\\nmain() {\\n}\","
1030 "\"tokenPosTable\":[[1,0,1,1,5,2,9],[3,5,1,6,5,7,6,8,8],[4,10,1]]}",
1031 handler.msg());
1032 }
1033
1034
1002 TEST_CASE(Service_Coverage) { 1035 TEST_CASE(Service_Coverage) {
1003 const char* kScript = 1036 const char* kScript =
1004 "var port;\n" // Set to our mock port by C++. 1037 "var port;\n" // Set to our mock port by C++.
1005 "\n" 1038 "\n"
1006 "var x = 7;\n" 1039 "var x = 7;\n"
1007 "main() {\n" 1040 "main() {\n"
1008 " x = x * x;\n" 1041 " x = x * x;\n"
1009 " x = x / 13;\n" 1042 " x = x / 13;\n"
1010 "}"; 1043 "}";
1011 1044
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 EXPECT_SUBSTRING("\"type\":\"Profile\"", handler.msg()); 1320 EXPECT_SUBSTRING("\"type\":\"Profile\"", handler.msg());
1288 1321
1289 service_msg = Eval(h_lib, "[port, ['profile'], ['tags'], ['hidden']]"); 1322 service_msg = Eval(h_lib, "[port, ['profile'], ['tags'], ['hidden']]");
1290 Service::HandleIsolateMessage(isolate, service_msg); 1323 Service::HandleIsolateMessage(isolate, service_msg);
1291 handler.HandleNextMessage(); 1324 handler.HandleNextMessage();
1292 // Expect error. 1325 // Expect error.
1293 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); 1326 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg());
1294 } 1327 }
1295 1328
1296 } // namespace dart 1329 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698