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

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

Issue 1053053002: Tidy up the service protocol. Begin improving the documentation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 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/service/service.idl ('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 "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "include/dart_debugger_api.h" 7 #include "include/dart_debugger_api.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 Dart_Port port_id = PortMap::CreatePort(&handler); 1072 Dart_Port port_id = PortMap::CreatePort(&handler);
1073 Dart_Handle port = Api::NewHandle(isolate, SendPort::New(port_id)); 1073 Dart_Handle port = Api::NewHandle(isolate, SendPort::New(port_id));
1074 EXPECT_VALID(port); 1074 EXPECT_VALID(port);
1075 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port)); 1075 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
1076 1076
1077 Array& service_msg = Array::Handle(); 1077 Array& service_msg = Array::Handle();
1078 service_msg = EvalVM(lib, "[0, port, 'getVM', [], []]"); 1078 service_msg = EvalVM(lib, "[0, port, 'getVM', [], []]");
1079 1079
1080 Service::HandleRootMessage(service_msg); 1080 Service::HandleRootMessage(service_msg);
1081 handler.HandleNextMessage(); 1081 handler.HandleNextMessage();
1082 EXPECT_SUBSTRING("\"type\":\"VM\",\"id\":\"vm\"", handler.msg()); 1082 EXPECT_SUBSTRING("\"type\":\"VM\"", handler.msg());
1083 EXPECT_SUBSTRING("\"targetCPU\"", handler.msg()); 1083 EXPECT_SUBSTRING("\"targetCPU\"", handler.msg());
1084 EXPECT_SUBSTRING("\"hostCPU\"", handler.msg()); 1084 EXPECT_SUBSTRING("\"hostCPU\"", handler.msg());
1085 EXPECT_SUBSTRING("\"version\"", handler.msg()); 1085 EXPECT_SUBSTRING("\"version\"", handler.msg());
1086 EXPECT_SUBSTRING("\"startTime\"", handler.msg()); 1086 EXPECT_SUBSTRING("\"startTime\"", handler.msg());
1087 EXPECT_SUBSTRING("\"isolates\"", handler.msg()); 1087 EXPECT_SUBSTRING("\"isolates\"", handler.msg());
1088 } 1088 }
1089 1089
1090 1090
1091 TEST_CASE(Service_Flags) { 1091 TEST_CASE(Service_Flags) {
1092 const char* kScript = 1092 const char* kScript =
(...skipping 12 matching lines...) Expand all
1105 Dart_Handle port = Api::NewHandle(isolate, SendPort::New(port_id)); 1105 Dart_Handle port = Api::NewHandle(isolate, SendPort::New(port_id));
1106 EXPECT_VALID(port); 1106 EXPECT_VALID(port);
1107 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port)); 1107 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
1108 1108
1109 Array& service_msg = Array::Handle(); 1109 Array& service_msg = Array::Handle();
1110 service_msg = EvalVM(lib, "[0, port, 'getFlagList', [], []]"); 1110 service_msg = EvalVM(lib, "[0, port, 'getFlagList', [], []]");
1111 1111
1112 // Make sure we can get the FlagList. 1112 // Make sure we can get the FlagList.
1113 Service::HandleRootMessage(service_msg); 1113 Service::HandleRootMessage(service_msg);
1114 handler.HandleNextMessage(); 1114 handler.HandleNextMessage();
1115 EXPECT_SUBSTRING("\"type\":\"FlagList\",\"id\":\"flags\"", handler.msg()); 1115 EXPECT_SUBSTRING("\"type\":\"FlagList\"", handler.msg());
1116 EXPECT_SUBSTRING( 1116 EXPECT_SUBSTRING(
1117 "\"name\":\"service_testing_flag\",\"comment\":\"Comment\"," 1117 "\"name\":\"service_testing_flag\",\"comment\":\"Comment\","
1118 "\"flagType\":\"bool\",\"valueAsString\":\"false\"", 1118 "\"flagType\":\"bool\",\"valueAsString\":\"false\"",
1119 handler.msg()); 1119 handler.msg());
1120 1120
1121 // Modify a flag through the vm service. 1121 // Modify a flag through the vm service.
1122 service_msg = EvalVM(lib, 1122 service_msg = EvalVM(lib,
1123 "[0, port, 'setFlag', " 1123 "[0, port, 'setFlag', "
1124 "['name', 'value'], ['service_testing_flag', 'true']]"); 1124 "['name', 'value'], ['service_testing_flag', 'true']]");
1125 Service::HandleRootMessage(service_msg); 1125 Service::HandleRootMessage(service_msg);
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 Eval(lib, "[0, port, 'getCpuProfile', ['tags'], ['Bogus']]"); 1472 Eval(lib, "[0, port, 'getCpuProfile', ['tags'], ['Bogus']]");
1473 Service::HandleIsolateMessage(isolate, service_msg); 1473 Service::HandleIsolateMessage(isolate, service_msg);
1474 handler.HandleNextMessage(); 1474 handler.HandleNextMessage();
1475 // Expect error. 1475 // Expect error.
1476 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); 1476 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg());
1477 } 1477 }
1478 1478
1479 #endif // !defined(TARGET_ARCH_ARM64) 1479 #endif // !defined(TARGET_ARCH_ARM64)
1480 1480
1481 } // namespace dart 1481 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service/service.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698