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

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

Issue 1174313002: Allow setting break-on-exceptions option over the service protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/service.cc » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/assert.h" 5 #include "platform/assert.h"
6 #include "vm/report.h" 6 #include "vm/report.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
11 TEST_CASE(TraceJSWarning) { 11 TEST_CASE(TraceJSWarning) {
12 Isolate* isolate = Isolate::Current(); 12 Isolate* isolate = Isolate::Current();
13 TraceBuffer::Init(isolate, 3); 13 TraceBuffer::Init(isolate, 3);
14 TraceBuffer* trace_buffer = isolate->trace_buffer(); 14 TraceBuffer* trace_buffer = isolate->trace_buffer();
15 const String& url = String::Handle(isolate, String::New("Plug")); 15 const String& url = String::Handle(isolate, String::New("Plug"));
16 const String& source = String::Handle(isolate, String::New("240 100")); 16 const String& source = String::Handle(isolate, String::New("240 100"));
17 const Script& script = Script::Handle(isolate, 17 const Script& script = Script::Handle(isolate,
18 Script::New(url, source, RawScript::kScriptTag)); 18 Script::New(url, source, RawScript::kEvaluateTag));
19 script.Tokenize(String::Handle(String::New(""))); 19 script.Tokenize(String::Handle(String::New("")));
20 { 20 {
21 const intptr_t token_pos = 0; 21 const intptr_t token_pos = 0;
22 const char* message = "High Voltage"; 22 const char* message = "High Voltage";
23 Report::MessageF(Report::kJSWarning, script, token_pos, "%s", message); 23 Report::MessageF(Report::kJSWarning, script, token_pos, "%s", message);
24 { 24 {
25 JSONStream js; 25 JSONStream js;
26 trace_buffer->PrintToJSONStream(&js); 26 trace_buffer->PrintToJSONStream(&js);
27 EXPECT_SUBSTRING("{\"type\":\"TraceBuffer\",\"members\":[" 27 EXPECT_SUBSTRING("{\"type\":\"TraceBuffer\",\"members\":["
28 "{\"type\":\"TraceBufferEntry\",\"time\":", 28 "{\"type\":\"TraceBufferEntry\",\"time\":",
29 js.ToCString()); 29 js.ToCString());
30 // Skip time. 30 // Skip time.
31 EXPECT_SUBSTRING("\"message\":{\"type\":\"JSCompatibilityWarning\"," 31 EXPECT_SUBSTRING("\"message\":{\"type\":\"JSCompatibilityWarning\","
32 "\"script\":{\"type\":\"@Script\",\"fixedId\":true," 32 "\"script\":{\"type\":\"@Script\"",
33 "\"id\":\"libraries\\/-1\\/scripts\\/Plug\"," 33 js.ToCString());
34 "\"uri\":\"Plug\"," 34 // Skip object ring id.
35 "\"_kind\":\"script\"},\"tokenPos\":0," 35 EXPECT_SUBSTRING("\"uri\":\"Plug\","
36 "\"_kind\":\"evaluate\"},\"tokenPos\":0,"
36 "\"message\":{\"type\":\"@Instance\"", 37 "\"message\":{\"type\":\"@Instance\"",
37 js.ToCString()); 38 js.ToCString());
38 // Skip private _OneByteString. 39 // Skip private _OneByteString.
39 EXPECT_SUBSTRING("\"valueAsString\":\"High Voltage\"", 40 EXPECT_SUBSTRING("\"valueAsString\":\"High Voltage\"",
40 js.ToCString()); 41 js.ToCString());
41 } 42 }
42 } 43 }
43 { 44 {
44 const intptr_t token_pos = 1; 45 const intptr_t token_pos = 1;
45 const char* message = "Low Voltage"; 46 const char* message = "Low Voltage";
46 Report::MessageF(Report::kJSWarning, script, token_pos, "%s", message); 47 Report::MessageF(Report::kJSWarning, script, token_pos, "%s", message);
47 } 48 }
48 EXPECT_EQ(2, trace_buffer->Length()); 49 EXPECT_EQ(2, trace_buffer->Length());
49 EXPECT_SUBSTRING("{\"type\":\"JSCompatibilityWarning\",\"script\":{\"type\":" 50 EXPECT_SUBSTRING("{\"type\":\"JSCompatibilityWarning\",\"script\":{\"type\":"
50 "\"@Script\",\"fixedId\":true," 51 "\"@Script\"",
51 "\"id\":\"libraries\\/-1\\/scripts\\/Plug\"," 52 trace_buffer->At(0)->message);
52 "\"uri\":\"Plug\"," 53 // Skip object ring id.
53 "\"_kind\":\"script\"},\"tokenPos\":0," 54 EXPECT_SUBSTRING("\"uri\":\"Plug\","
55 "\"_kind\":\"evaluate\"},\"tokenPos\":0,"
54 "\"message\":{\"type\":\"@Instance\"", 56 "\"message\":{\"type\":\"@Instance\"",
55 trace_buffer->At(0)->message); 57 trace_buffer->At(0)->message);
56 // Skip private _OneByteString. 58 // Skip private _OneByteString.
57 EXPECT_SUBSTRING("\"valueAsString\":\"High Voltage\"", 59 EXPECT_SUBSTRING("\"valueAsString\":\"High Voltage\"",
58 trace_buffer->At(0)->message); 60 trace_buffer->At(0)->message);
59 61
60 EXPECT_SUBSTRING("{\"type\":\"JSCompatibilityWarning\",\"script\":{\"type\":" 62 EXPECT_SUBSTRING("{\"type\":\"JSCompatibilityWarning\",\"script\":{\"type\":"
61 "\"@Script\",\"fixedId\":true," 63 "\"@Script\"",
62 "\"id\":\"libraries\\/-1\\/scripts\\/Plug\"," 64 trace_buffer->At(1)->message);
63 "\"uri\":\"Plug\"," 65 // Skip object ring id.
64 "\"_kind\":\"script\"},\"tokenPos\":1," 66 EXPECT_SUBSTRING("\"uri\":\"Plug\","
67 "\"_kind\":\"evaluate\"},\"tokenPos\":1,"
65 "\"message\":{\"type\":\"@Instance\"", 68 "\"message\":{\"type\":\"@Instance\"",
66 trace_buffer->At(1)->message); 69 trace_buffer->At(1)->message);
67 // Skip private _OneByteString. 70 // Skip private _OneByteString.
68 EXPECT_SUBSTRING("\"valueAsString\":\"Low Voltage\"", 71 EXPECT_SUBSTRING("\"valueAsString\":\"Low Voltage\"",
69 trace_buffer->At(1)->message); 72 trace_buffer->At(1)->message);
70 73
71 delete trace_buffer; 74 delete trace_buffer;
72 } 75 }
73 76
74 } // namespace dart 77 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698