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

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

Issue 206213004: Add a VM page to the observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
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 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 956
957 // Request malformed native code. 957 // Request malformed native code.
958 service_msg = EvalF(h_lib, "[port, ['code', 'native%" Px "'], [], []]", 958 service_msg = EvalF(h_lib, "[port, ['code', 'native%" Px "'], [], []]",
959 address); 959 address);
960 Service::HandleIsolateMessage(isolate, service_msg); 960 Service::HandleIsolateMessage(isolate, service_msg);
961 handler.HandleNextMessage(); 961 handler.HandleNextMessage();
962 EXPECT_SUBSTRING("\"message\":\"Malformed code id:", handler.msg()); 962 EXPECT_SUBSTRING("\"message\":\"Malformed code id:", handler.msg());
963 } 963 }
964 964
965 965
966 TEST_CASE(Service_Cpu) { 966 TEST_CASE(Service_VM) {
967 const char* kScript = 967 const char* kScript =
968 "var port;\n" // Set to our mock port by C++. 968 "var port;\n" // Set to our mock port by C++.
969 "\n" 969 "\n"
970 "main() {\n" 970 "main() {\n"
971 "}"; 971 "}";
972 972
973 Isolate* isolate = Isolate::Current(); 973 Isolate* isolate = Isolate::Current();
974 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 974 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
975 EXPECT_VALID(lib); 975 EXPECT_VALID(lib);
976 976
977 // Build a mock message handler and wrap it in a dart port. 977 // Build a mock message handler and wrap it in a dart port.
978 ServiceTestMessageHandler handler; 978 ServiceTestMessageHandler handler;
979 Dart_Port port_id = PortMap::CreatePort(&handler); 979 Dart_Port port_id = PortMap::CreatePort(&handler);
980 Dart_Handle port = 980 Dart_Handle port =
981 Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id)); 981 Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id));
982 EXPECT_VALID(port); 982 EXPECT_VALID(port);
983 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port)); 983 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
984 984
985 Instance& service_msg = Instance::Handle(); 985 Instance& service_msg = Instance::Handle();
986 service_msg = Eval(lib, "[port, ['cpu'], [], []]"); 986 service_msg = Eval(lib, "[port, ['vm'], [], []]");
987 987
988 Service::HandleRootMessage(service_msg); 988 Service::HandleRootMessage(service_msg);
989 handler.HandleNextMessage(); 989 handler.HandleNextMessage();
990 EXPECT_SUBSTRING("\"type\":\"CPU\"", handler.msg()); 990 EXPECT_SUBSTRING("\"type\":\"VM\",\"id\":\"vm\"", handler.msg());
991 EXPECT_SUBSTRING("\"architecture\"", handler.msg());
992 EXPECT_SUBSTRING("\"version\"", handler.msg());
993 EXPECT_SUBSTRING("\"uptime\"", handler.msg());
994 EXPECT_SUBSTRING("\"isolates\"", handler.msg());
991 } 995 }
992 996
993 997
994 TEST_CASE(Service_Coverage) { 998 TEST_CASE(Service_Coverage) {
995 const char* kScript = 999 const char* kScript =
996 "var port;\n" // Set to our mock port by C++. 1000 "var port;\n" // Set to our mock port by C++.
997 "\n" 1001 "\n"
998 "var x = 7;\n" 1002 "var x = 7;\n"
999 "main() {\n" 1003 "main() {\n"
1000 " x = x * x;\n" 1004 " x = x * x;\n"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 EXPECT_SUBSTRING("\"type\":\"Profile\"", handler.msg()); 1240 EXPECT_SUBSTRING("\"type\":\"Profile\"", handler.msg());
1237 1241
1238 service_msg = Eval(h_lib, "[port, ['profile'], ['tags'], ['hidden']]"); 1242 service_msg = Eval(h_lib, "[port, ['profile'], ['tags'], ['hidden']]");
1239 Service::HandleIsolateMessage(isolate, service_msg); 1243 Service::HandleIsolateMessage(isolate, service_msg);
1240 handler.HandleNextMessage(); 1244 handler.HandleNextMessage();
1241 // Expect error. 1245 // Expect error.
1242 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); 1246 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg());
1243 } 1247 }
1244 1248
1245 } // namespace dart 1249 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service/running_isolates.dart ('k') | tests/standalone/vmservice/isolate_bad_class_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698