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

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

Issue 501583007: Treat null like the object it is in the Observatory and Service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sync and build Created 6 years, 3 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.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 "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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 EXPECT_VALID(valid_id); 516 EXPECT_VALID(valid_id);
517 EXPECT_VALID(Dart_SetField(lib, NewString("validId"), valid_id)); 517 EXPECT_VALID(Dart_SetField(lib, NewString("validId"), valid_id));
518 518
519 Array& service_msg = Array::Handle(); 519 Array& service_msg = Array::Handle();
520 520
521 // null 521 // null
522 service_msg = Eval(lib, "[0, port, ['objects', 'null'], [], []]"); 522 service_msg = Eval(lib, "[0, port, ['objects', 'null'], [], []]");
523 Service::HandleIsolateMessage(isolate, service_msg); 523 Service::HandleIsolateMessage(isolate, service_msg);
524 handler.HandleNextMessage(); 524 handler.HandleNextMessage();
525 handler.filterMsg("vmName"); 525 handler.filterMsg("vmName");
526 EXPECT_STREQ( 526 EXPECT_SUBSTRING(
527 "{\"type\":\"Null\",\"id\":\"objects\\/null\"," 527 "{\"type\":\"Null\",\"id\":\"objects\\/null\","
528 "\"valueAsString\":\"null\"}", 528 "\"valueAsString\":\"null\",\"class\":",
529 handler.msg()); 529 handler.msg());
530 530
531 // not initialized 531 // not initialized
532 service_msg = Eval(lib, "[0, port, ['objects', 'not-initialized'], [], []]"); 532 service_msg = Eval(lib, "[0, port, ['objects', 'not-initialized'], [], []]");
533 Service::HandleIsolateMessage(isolate, service_msg); 533 Service::HandleIsolateMessage(isolate, service_msg);
534 handler.HandleNextMessage(); 534 handler.HandleNextMessage();
535 handler.filterMsg("vmName"); 535 handler.filterMsg("vmName");
536 EXPECT_STREQ( 536 EXPECT_STREQ(
537 "{\"type\":\"Null\",\"id\":\"objects\\/not-initialized\"," 537 "{\"type\":\"Null\",\"id\":\"objects\\/not-initialized\","
538 "\"valueAsString\":\"<not initialized>\"}", 538 "\"valueAsString\":\"<not initialized>\"}",
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 Service::HandleIsolateMessage(isolate, service_msg); 1094 Service::HandleIsolateMessage(isolate, service_msg);
1095 handler.HandleNextMessage(); 1095 handler.HandleNextMessage();
1096 ExpectSubstringF(handler.msg(), "\"type\":\"InstanceSet\""); 1096 ExpectSubstringF(handler.msg(), "\"type\":\"InstanceSet\"");
1097 ExpectSubstringF(handler.msg(), "\"totalCount\":2"); 1097 ExpectSubstringF(handler.msg(), "\"totalCount\":2");
1098 ExpectSubstringF(handler.msg(), "\"sampleCount\":2"); 1098 ExpectSubstringF(handler.msg(), "\"sampleCount\":2");
1099 // TODO(koda): Actually parse the response. 1099 // TODO(koda): Actually parse the response.
1100 static const intptr_t kInstanceListId = 0; 1100 static const intptr_t kInstanceListId = 0;
1101 ExpectSubstringF(handler.msg(), "\"id\":\"objects\\/%" Pd "\",\"length\":2", 1101 ExpectSubstringF(handler.msg(), "\"id\":\"objects\\/%" Pd "\",\"length\":2",
1102 kInstanceListId); 1102 kInstanceListId);
1103 Array& list = Array::Handle(); 1103 Array& list = Array::Handle();
1104 list ^= isolate->object_id_ring()->GetObjectForId(kInstanceListId); 1104 ObjectIdRing::LookupResult kind;
1105 list ^= isolate->object_id_ring()->GetObjectForId(kInstanceListId, &kind);
1105 EXPECT_EQ(2, list.Length()); 1106 EXPECT_EQ(2, list.Length());
1106 // The list should contain {b0, b1}. 1107 // The list should contain {b0, b1}.
1107 EXPECT((list.At(0) == b0.raw() && list.At(1) == b1.raw()) || 1108 EXPECT((list.At(0) == b0.raw() && list.At(1) == b1.raw()) ||
1108 (list.At(0) == b1.raw() && list.At(1) == b0.raw())); 1109 (list.At(0) == b1.raw() && list.At(1) == b0.raw()));
1109 // ... and if limit is 1, we one get one of them. 1110 // ... and if limit is 1, we one get one of them.
1110 service_msg = EvalF(lib, "[0, port, ['classes', '%" Pd "', 'instances']," 1111 service_msg = EvalF(lib, "[0, port, ['classes', '%" Pd "', 'instances'],"
1111 "['limit'], ['1']]", class_b.id()); 1112 "['limit'], ['1']]", class_b.id());
1112 Service::HandleIsolateMessage(isolate, service_msg); 1113 Service::HandleIsolateMessage(isolate, service_msg);
1113 handler.HandleNextMessage(); 1114 handler.HandleNextMessage();
1114 ExpectSubstringF(handler.msg(), "\"totalCount\":2"); 1115 ExpectSubstringF(handler.msg(), "\"totalCount\":2");
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 address); 1318 address);
1318 EXPECT_SUBSTRING(buffer, handler.msg()); 1319 EXPECT_SUBSTRING(buffer, handler.msg());
1319 } 1320 }
1320 1321
1321 // Request native code at address. Expect the null code object back. 1322 // Request native code at address. Expect the null code object back.
1322 address = last; 1323 address = last;
1323 service_msg = EvalF(lib, "[0, port, ['code', 'native-%" Px "'], [], []]", 1324 service_msg = EvalF(lib, "[0, port, ['code', 'native-%" Px "'], [], []]",
1324 address); 1325 address);
1325 Service::HandleIsolateMessage(isolate, service_msg); 1326 Service::HandleIsolateMessage(isolate, service_msg);
1326 handler.HandleNextMessage(); 1327 handler.HandleNextMessage();
1327 EXPECT_STREQ("{\"type\":\"Null\",\"id\":\"objects\\/null\"," 1328 EXPECT_SUBSTRING("{\"type\":\"Null\",\"id\":\"objects\\/null\","
1328 "\"valueAsString\":\"null\"}", 1329 "\"valueAsString\":\"null\"",
1329 handler.msg()); 1330 handler.msg());
1330 1331
1331 // Request malformed native code. 1332 // Request malformed native code.
1332 service_msg = EvalF(lib, "[0, port, ['code', 'native%" Px "'], [], []]", 1333 service_msg = EvalF(lib, "[0, port, ['code', 'native%" Px "'], [], []]",
1333 address); 1334 address);
1334 Service::HandleIsolateMessage(isolate, service_msg); 1335 Service::HandleIsolateMessage(isolate, service_msg);
1335 handler.HandleNextMessage(); 1336 handler.HandleNextMessage();
1336 EXPECT_SUBSTRING("\"message\":\"Malformed code id:", handler.msg()); 1337 EXPECT_SUBSTRING("\"message\":\"Malformed code id:", handler.msg());
1337 } 1338 }
1338 1339
1339 1340
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 service_msg = Eval(lib, "[0, port, ['profile'], ['tags'], ['hidden']]"); 2025 service_msg = Eval(lib, "[0, port, ['profile'], ['tags'], ['hidden']]");
2025 Service::HandleIsolateMessage(isolate, service_msg); 2026 Service::HandleIsolateMessage(isolate, service_msg);
2026 handler.HandleNextMessage(); 2027 handler.HandleNextMessage();
2027 // Expect error. 2028 // Expect error.
2028 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); 2029 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg());
2029 } 2030 }
2030 2031
2031 #endif // !defined(TARGET_ARCH_ARM64) 2032 #endif // !defined(TARGET_ARCH_ARM64)
2032 2033
2033 } // namespace dart 2034 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698