Index: test/cctest/test-trace-event.cc |
diff --git a/test/cctest/test-trace-event.cc b/test/cctest/test-trace-event.cc |
index a889e088f667dcdcd5907b8e2c48a5459920c920..b6851349ce8c9b7c27a28568bfc04034f305c5c5 100644 |
--- a/test/cctest/test-trace-event.cc |
+++ b/test/cctest/test-trace-event.cc |
@@ -256,3 +256,28 @@ TEST(TestEventWithId) { |
i::V8::SetPlatformForTesting(old_platform); |
} |
+ |
+TEST(TestEventInContext) { |
+ v8::Platform* old_platform = i::V8::GetCurrentPlatform(); |
+ MockTracingPlatform platform(old_platform); |
+ i::V8::SetPlatformForTesting(&platform); |
+ |
+ static uint64_t isolate_id = 21; |
+ uint64_t* isolate_ptr = &isolate_id; |
+ { |
+ TRACE_EVENT_SCOPED_CONTEXT("v8-cat", "Isolate", isolate_ptr); |
+ TRACE_EVENT0("v8-cat", "e"); |
+ } |
+ |
+ CHECK_EQ(3, GET_TRACE_OBJECTS_LIST->length()); |
+ CHECK_EQ(TRACE_EVENT_PHASE_ENTER_CONTEXT, GET_TRACE_OBJECT(0)->phase); |
+ CHECK_EQ("Isolate", GET_TRACE_OBJECT(0)->name); |
+ CHECK_EQ(isolate_id, *(uint64_t*)(GET_TRACE_OBJECT(0)->id)); |
jochen (gone - plz use gerrit)
2016/02/17 10:50:03
does that compile on 32bit?
fmeawad
2016/02/17 19:19:13
It did compile, but I also simplified the test (wa
|
+ CHECK_EQ(TRACE_EVENT_PHASE_COMPLETE, GET_TRACE_OBJECT(1)->phase); |
+ CHECK_EQ("e", GET_TRACE_OBJECT(1)->name); |
+ CHECK_EQ(TRACE_EVENT_PHASE_LEAVE_CONTEXT, GET_TRACE_OBJECT(2)->phase); |
+ CHECK_EQ("Isolate", GET_TRACE_OBJECT(2)->name); |
+ CHECK_EQ(isolate_id, *(uint64_t*)(GET_TRACE_OBJECT(2)->id)); |
+ |
+ i::V8::SetPlatformForTesting(old_platform); |
+} |