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

Unified Diff: runtime/vm/metrics_test.cc

Issue 1263513002: VM: Load allocation-top and -end via Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fixed cc tests Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/metrics_test.cc
diff --git a/runtime/vm/metrics_test.cc b/runtime/vm/metrics_test.cc
index faf425bffd3d3ae85563d7a704b1dec85550823e..b4fe97f615527d3a296c8e3e32a8ae3846c75924 100644
--- a/runtime/vm/metrics_test.cc
+++ b/runtime/vm/metrics_test.cc
@@ -14,11 +14,8 @@
namespace dart {
UNIT_TEST_CASE(Metric_Simple) {
- Isolate::Flags vm_flags;
- Dart_IsolateFlags api_flags;
- vm_flags.CopyTo(&api_flags);
- Isolate* isolate = Isolate::Init(NULL, api_flags);
- EXPECT_EQ(isolate, Isolate::Current());
+ Dart_CreateIsolate(
+ NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL, NULL);
Metric metric;
// Initialize metric.
@@ -28,6 +25,7 @@ UNIT_TEST_CASE(Metric_Simple) {
EXPECT_EQ(1, metric.value());
metric.set_value(44);
EXPECT_EQ(44, metric.value());
+ Dart_ShutdownIsolate();
}
class MyMetric : public Metric {
@@ -43,29 +41,30 @@ class MyMetric : public Metric {
};
UNIT_TEST_CASE(Metric_OnDemand) {
- Isolate::Flags vm_flags;
- Dart_IsolateFlags api_flags;
- vm_flags.CopyTo(&api_flags);
- Isolate* isolate = Isolate::Init(NULL, api_flags);
- EXPECT_EQ(isolate, Isolate::Current());
- StackZone zone(isolate);
- HANDLESCOPE(isolate);
- MyMetric metric;
+ Dart_CreateIsolate(
+ NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL, NULL);
+ {
+ Isolate* isolate = Isolate::Current();
+ StackZone zone(isolate);
+ HANDLESCOPE(isolate);
+ MyMetric metric;
- metric.Init(Isolate::Current(), "a.b.c", "foobar", Metric::kByte);
- // value is still the default value.
- EXPECT_EQ(0, metric.value());
- // Call LeakyValue to confirm that Value returns constant 99.
- EXPECT_EQ(99, metric.LeakyValue());
+ metric.Init(Isolate::Current(), "a.b.c", "foobar", Metric::kByte);
+ // value is still the default value.
+ EXPECT_EQ(0, metric.value());
+ // Call LeakyValue to confirm that Value returns constant 99.
+ EXPECT_EQ(99, metric.LeakyValue());
- // Serialize to JSON.
- JSONStream js;
- metric.PrintJSON(&js);
- const char* json = js.ToCString();
- EXPECT_STREQ("{\"type\":\"Counter\",\"name\":\"a.b.c\",\"description\":"
- "\"foobar\",\"unit\":\"byte\","
- "\"fixedId\":true,\"id\":\"metrics\\/native\\/a.b.c\""
- ",\"value\":99.000000}", json);
+ // Serialize to JSON.
+ JSONStream js;
+ metric.PrintJSON(&js);
+ const char* json = js.ToCString();
+ EXPECT_STREQ("{\"type\":\"Counter\",\"name\":\"a.b.c\",\"description\":"
+ "\"foobar\",\"unit\":\"byte\","
+ "\"fixedId\":true,\"id\":\"metrics\\/native\\/a.b.c\""
+ ",\"value\":99.000000}", json);
+ }
+ Dart_ShutdownIsolate();
}
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698