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

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

Issue 197763004: I forgot to filter a machine-dependent field in the service unit test. (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
« no previous file with comments | « no previous file | 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 int key_len = strlen(key); 44 int key_len = strlen(key);
45 int old_len = strlen(_msg); 45 int old_len = strlen(_msg);
46 char* new_msg = reinterpret_cast<char*>(malloc(old_len + 1)); 46 char* new_msg = reinterpret_cast<char*>(malloc(old_len + 1));
47 int old_pos = 0; 47 int old_pos = 0;
48 int new_pos = 0; 48 int new_pos = 0;
49 while (_msg[old_pos] != '\0') { 49 while (_msg[old_pos] != '\0') {
50 if (_msg[old_pos] == '\"') { 50 if (_msg[old_pos] == '\"') {
51 old_pos++; 51 old_pos++;
52 if ((old_len - old_pos) > key_len && 52 if ((old_len - old_pos) > key_len &&
53 strncmp(&_msg[old_pos], key, key_len) == 0 && 53 strncmp(&_msg[old_pos], key, key_len) == 0 &&
54 _msg[old_pos + key_len + 2] == '\"') { 54 _msg[old_pos + key_len] == '\"') {
55 old_pos += (key_len + 2); 55 old_pos += (key_len + 2);
56 // Skip until next , or }. 56 // Skip until next , or }.
57 while (_msg[old_pos] != '\0' && 57 while (_msg[old_pos] != '\0' &&
58 _msg[old_pos] != ',' && 58 _msg[old_pos] != ',' &&
59 _msg[old_pos] != '}') { 59 _msg[old_pos] != '}') {
60 old_pos++; 60 old_pos++;
61 } 61 }
62 if (_msg[old_pos] == ',') { 62 if (_msg[old_pos] == ',') {
63 old_pos++; 63 old_pos++;
64 } 64 }
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 "{\"type\":\"Smi\",\"id\":\"objects\\/int-123\"," 447 "{\"type\":\"Smi\",\"id\":\"objects\\/int-123\","
448 "\"class\":{\"type\":\"@Class\",\"id\":\"classes\\/42\"," 448 "\"class\":{\"type\":\"@Class\",\"id\":\"classes\\/42\","
449 "\"user_name\":\"int\"},\"preview\":\"123\"}", 449 "\"user_name\":\"int\"},\"preview\":\"123\"}",
450 handler.msg()); 450 handler.msg());
451 451
452 // object id ring / valid 452 // object id ring / valid
453 service_msg = Eval(lib, "[port, ['objects', '$validId'], [], []]"); 453 service_msg = Eval(lib, "[port, ['objects', '$validId'], [], []]");
454 Service::HandleIsolateMessage(isolate, service_msg); 454 Service::HandleIsolateMessage(isolate, service_msg);
455 handler.HandleNextMessage(); 455 handler.HandleNextMessage();
456 handler.filterMsg("name"); 456 handler.filterMsg("name");
457 handler.filterMsg("size");
457 EXPECT_STREQ( 458 EXPECT_STREQ(
458 "{\"type\":\"String\",\"id\":\"objects\\/1\"," 459 "{\"type\":\"String\",\"id\":\"objects\\/1\","
459 "\"class\":{\"type\":\"@Class\",\"id\":\"classes\\/60\"," 460 "\"class\":{\"type\":\"@Class\",\"id\":\"classes\\/60\","
460 "\"user_name\":\"String\"},\"preview\":\"\\\"value\\\"\"," 461 "\"user_name\":\"String\"},\"preview\":\"\\\"value\\\"\","
461 "\"fields\":[],\"size\":24}", 462 "\"fields\":[],}",
462 handler.msg()); 463 handler.msg());
463 464
464 // object id ring / invalid => expired 465 // object id ring / invalid => expired
465 service_msg = Eval(lib, "[port, ['objects', '99999999'], [], []]"); 466 service_msg = Eval(lib, "[port, ['objects', '99999999'], [], []]");
466 Service::HandleIsolateMessage(isolate, service_msg); 467 Service::HandleIsolateMessage(isolate, service_msg);
467 handler.HandleNextMessage(); 468 handler.HandleNextMessage();
468 handler.filterMsg("name"); 469 handler.filterMsg("name");
469 EXPECT_STREQ( 470 EXPECT_STREQ(
470 "{\"type\":\"Null\",\"id\":\"objects\\/expired\"," 471 "{\"type\":\"Null\",\"id\":\"objects\\/expired\","
471 "\"preview\":\"<expired>\"}", 472 "\"preview\":\"<expired>\"}",
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 Service::HandleIsolateMessage(isolate, service_msg); 980 Service::HandleIsolateMessage(isolate, service_msg);
980 handler.HandleNextMessage(); 981 handler.HandleNextMessage();
981 EXPECT_STREQ("alpha", handler.msg()); 982 EXPECT_STREQ("alpha", handler.msg());
982 service_msg = Eval(lib, "[port, ['beta'], [], []]"); 983 service_msg = Eval(lib, "[port, ['beta'], [], []]");
983 Service::HandleIsolateMessage(isolate, service_msg); 984 Service::HandleIsolateMessage(isolate, service_msg);
984 handler.HandleNextMessage(); 985 handler.HandleNextMessage();
985 EXPECT_STREQ("beta", handler.msg()); 986 EXPECT_STREQ("beta", handler.msg());
986 } 987 }
987 988
988 } // namespace dart 989 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698