OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/trace_event/trace_event.h" | 5 #include "base/trace_event/trace_event.h" |
6 #include "content/renderer/devtools/v8_sampling_profiler.h" | 6 #include "content/renderer/devtools/v8_sampling_profiler.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 using base::debug::CategoryFilter; | 9 using base::trace_event::CategoryFilter; |
10 using base::debug::TraceLog; | 10 using base::trace_event::TraceLog; |
11 using base::debug::TraceOptions; | 11 using base::trace_event::TraceOptions; |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 class V8SamplingProfilerTest : public testing::Test {}; | 15 class V8SamplingProfilerTest : public testing::Test {}; |
16 | 16 |
17 TEST_F(V8SamplingProfilerTest, V8SamplingEventFired) { | 17 TEST_F(V8SamplingProfilerTest, V8SamplingEventFired) { |
18 scoped_ptr<V8SamplingProfiler> sampling_profiler(new V8SamplingProfiler()); | 18 scoped_ptr<V8SamplingProfiler> sampling_profiler(new V8SamplingProfiler()); |
19 sampling_profiler->EnableSamplingEventForTesting(); | 19 sampling_profiler->EnableSamplingEventForTesting(); |
20 TraceLog::GetInstance()->SetEnabled( | 20 TraceLog::GetInstance()->SetEnabled( |
21 CategoryFilter(TRACE_DISABLED_BY_DEFAULT("v8_cpu_profile")), | 21 CategoryFilter(TRACE_DISABLED_BY_DEFAULT("v8_cpu_profile")), |
22 TraceLog::RECORDING_MODE, TraceOptions()); | 22 TraceLog::RECORDING_MODE, TraceOptions()); |
23 sampling_profiler->WaitSamplingEventForTesting(); | 23 sampling_profiler->WaitSamplingEventForTesting(); |
24 TraceLog::GetInstance()->SetDisabled(); | 24 TraceLog::GetInstance()->SetDisabled(); |
25 } | 25 } |
26 | 26 |
27 } // namespace content | 27 } // namespace content |
OLD | NEW |