| 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/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "content/public/test/render_view_test.h" | 8 #include "content/public/test/render_view_test.h" |
| 9 #include "content/renderer/devtools/v8_sampling_profiler.h" | 9 #include "content/renderer/devtools/v8_sampling_profiler.h" |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 scoped_ptr<V8SamplingProfiler> sampling_profiler_; | 113 scoped_ptr<V8SamplingProfiler> sampling_profiler_; |
| 114 base::Lock lock_; | 114 base::Lock lock_; |
| 115 | 115 |
| 116 ListValue trace_parsed_; | 116 ListValue trace_parsed_; |
| 117 TraceResultBuffer trace_buffer_; | 117 TraceResultBuffer trace_buffer_; |
| 118 TraceResultBuffer::SimpleOutput json_output_; | 118 TraceResultBuffer::SimpleOutput json_output_; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 // TODO(alph): Implement on Windows, Android and ChromeOS. | 121 // TODO(alph): Implement on Windows, Android and non-x86. |
| 122 // The SamplingEventForTesting is fired when the framework collected at | 122 // The SamplingEventForTesting is fired when the framework collected at |
| 123 // least one JitCodeAdded event and one sample event. | 123 // least one JitCodeAdded event and one sample event. |
| 124 | 124 |
| 125 #if defined(OS_WIN) || defined(OS_ANDROID) || defined(OS_CHROMEOS) | 125 #if defined(OS_WIN) || defined(OS_ANDROID) || !defined(ARCH_CPU_X86_FAMILY) |
| 126 #define MAYBE(x) DISABLED_##x | 126 #define MAYBE(x) DISABLED_##x |
| 127 #else | 127 #else |
| 128 #define MAYBE(x) x | 128 #define MAYBE(x) x |
| 129 #endif | 129 #endif |
| 130 | 130 |
| 131 TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingEventFired)) { | 131 TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingEventFired)) { |
| 132 sampling_profiler_->EnableSamplingEventForTesting(); | 132 sampling_profiler_->EnableSamplingEventForTesting(); |
| 133 TraceLog::GetInstance()->SetEnabled( | 133 TraceLog::GetInstance()->SetEnabled( |
| 134 CategoryFilter(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile")), | 134 CategoryFilter(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile")), |
| 135 TraceLog::RECORDING_MODE, TraceOptions()); | 135 TraceLog::RECORDING_MODE, TraceOptions()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 146 } | 146 } |
| 147 | 147 |
| 148 TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingSamplesCollected)) { | 148 TEST_F(V8SamplingProfilerTest, MAYBE(V8SamplingSamplesCollected)) { |
| 149 CollectTrace(); | 149 CollectTrace(); |
| 150 int sample_events_count = CountEvents("V8Sample"); | 150 int sample_events_count = CountEvents("V8Sample"); |
| 151 CHECK_LT(0, sample_events_count); | 151 CHECK_LT(0, sample_events_count); |
| 152 base::RunLoop().RunUntilIdle(); | 152 base::RunLoop().RunUntilIdle(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace content | 155 } // namespace content |
| OLD | NEW |