OLD | NEW |
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/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/globals.h" | 6 #include "vm/globals.h" |
7 #include "vm/json_stream.h" | 7 #include "vm/json_stream.h" |
8 #include "vm/trace_buffer.h" | 8 #include "vm/trace_buffer.h" |
9 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
| 13 #ifndef PRODUCT |
| 14 |
13 TEST_CASE(TraceBufferEmpty) { | 15 TEST_CASE(TraceBufferEmpty) { |
14 Isolate* isolate = Isolate::Current(); | 16 Isolate* isolate = Isolate::Current(); |
15 TraceBuffer::Init(isolate, 3); | 17 TraceBuffer::Init(isolate, 3); |
16 TraceBuffer* trace_buffer = isolate->trace_buffer(); | 18 TraceBuffer* trace_buffer = isolate->trace_buffer(); |
17 { | 19 { |
18 JSONStream js; | 20 JSONStream js; |
19 trace_buffer->PrintToJSONStream(&js); | 21 trace_buffer->PrintToJSONStream(&js); |
20 EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"members\":[]}", js.ToCString()); | 22 EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"members\":[]}", js.ToCString()); |
21 } | 23 } |
22 delete trace_buffer; | 24 delete trace_buffer; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 TraceBuffer* trace_buffer = isolate->trace_buffer(); | 98 TraceBuffer* trace_buffer = isolate->trace_buffer(); |
97 trace_buffer->TraceF("foo %d %s", 99, "bar"); | 99 trace_buffer->TraceF("foo %d %s", 99, "bar"); |
98 { | 100 { |
99 JSONStream js; | 101 JSONStream js; |
100 trace_buffer->PrintToJSONStream(&js); | 102 trace_buffer->PrintToJSONStream(&js); |
101 EXPECT_SUBSTRING("foo 99 bar", js.ToCString()); | 103 EXPECT_SUBSTRING("foo 99 bar", js.ToCString()); |
102 } | 104 } |
103 delete trace_buffer; | 105 delete trace_buffer; |
104 } | 106 } |
105 | 107 |
| 108 #endif // !PRODUCT |
| 109 |
106 } // namespace dart | 110 } // namespace dart |
OLD | NEW |