OLD | NEW |
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 | 6 |
7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/json_stream.h" | 10 #include "vm/json_stream.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // value is still the default value. | 48 // value is still the default value. |
49 EXPECT_EQ(0, metric.value()); | 49 EXPECT_EQ(0, metric.value()); |
50 // Call LeakyValue to confirm that Value returns constant 99. | 50 // Call LeakyValue to confirm that Value returns constant 99. |
51 EXPECT_EQ(99, metric.LeakyValue()); | 51 EXPECT_EQ(99, metric.LeakyValue()); |
52 | 52 |
53 // Serialize to JSON. | 53 // Serialize to JSON. |
54 JSONStream js; | 54 JSONStream js; |
55 metric.PrintJSON(&js); | 55 metric.PrintJSON(&js); |
56 const char* json = js.ToCString(); | 56 const char* json = js.ToCString(); |
57 EXPECT_STREQ("{\"type\":\"Counter\",\"name\":\"a.b.c\",\"description\":" | 57 EXPECT_STREQ("{\"type\":\"Counter\",\"name\":\"a.b.c\",\"description\":" |
58 "\"foobar\",\"unit\":\"byte\",\"id\":\"metrics\\/vm\\/a.b.c\"" | 58 "\"foobar\",\"unit\":\"byte\"," |
| 59 "\"id\":\"metrics\\/native\\/a.b.c\"" |
59 ",\"value\":99.000000}", json); | 60 ",\"value\":99.000000}", json); |
60 } | 61 } |
61 | 62 |
62 } // namespace dart | 63 } // namespace dart |
OLD | NEW |