OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "content/browser/tracing/tracing_controller_impl.h" | 7 #include "content/browser/tracing/tracing_controller_impl.h" |
8 #include "content/public/test/browser_test_utils.h" | 8 #include "content/public/test/browser_test_utils.h" |
9 #include "content/shell/browser/shell.h" | 9 #include "content/shell/browser/shell.h" |
10 #include "content/test/content_browser_test.h" | 10 #include "content/test/content_browser_test.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 EXPECT_EQ(get_categories_done_callback_count(), 1); | 212 EXPECT_EQ(get_categories_done_callback_count(), 1); |
213 } | 213 } |
214 | 214 |
215 IN_PROC_BROWSER_TEST_F(TracingControllerTest, EnableAndDisableRecording) { | 215 IN_PROC_BROWSER_TEST_F(TracingControllerTest, EnableAndDisableRecording) { |
216 TestEnableAndDisableRecording(base::FilePath()); | 216 TestEnableAndDisableRecording(base::FilePath()); |
217 } | 217 } |
218 | 218 |
219 IN_PROC_BROWSER_TEST_F(TracingControllerTest, | 219 IN_PROC_BROWSER_TEST_F(TracingControllerTest, |
220 EnableAndDisableRecordingWithFilePath) { | 220 EnableAndDisableRecordingWithFilePath) { |
221 base::FilePath file_path; | 221 base::FilePath file_path; |
222 file_util::CreateTemporaryFile(&file_path); | 222 base::CreateTemporaryFile(&file_path); |
223 TestEnableAndDisableRecording(file_path); | 223 TestEnableAndDisableRecording(file_path); |
224 EXPECT_EQ(file_path.value(), last_actual_recording_file_path().value()); | 224 EXPECT_EQ(file_path.value(), last_actual_recording_file_path().value()); |
225 } | 225 } |
226 | 226 |
227 IN_PROC_BROWSER_TEST_F(TracingControllerTest, | 227 IN_PROC_BROWSER_TEST_F(TracingControllerTest, |
228 EnableAndDisableRecordingWithEmptyFileAndNullCallback) { | 228 EnableAndDisableRecordingWithEmptyFileAndNullCallback) { |
229 Navigate(shell()); | 229 Navigate(shell()); |
230 | 230 |
231 TracingController* controller = TracingController::GetInstance(); | 231 TracingController* controller = TracingController::GetInstance(); |
232 EXPECT_TRUE(controller->EnableRecording( | 232 EXPECT_TRUE(controller->EnableRecording( |
233 "", TracingController::DEFAULT_OPTIONS, | 233 "", TracingController::DEFAULT_OPTIONS, |
234 TracingController::EnableRecordingDoneCallback())); | 234 TracingController::EnableRecordingDoneCallback())); |
235 EXPECT_TRUE(controller->DisableRecording( | 235 EXPECT_TRUE(controller->DisableRecording( |
236 base::FilePath(), TracingController::TracingFileResultCallback())); | 236 base::FilePath(), TracingController::TracingFileResultCallback())); |
237 base::RunLoop().RunUntilIdle(); | 237 base::RunLoop().RunUntilIdle(); |
238 } | 238 } |
239 | 239 |
240 IN_PROC_BROWSER_TEST_F(TracingControllerTest, | 240 IN_PROC_BROWSER_TEST_F(TracingControllerTest, |
241 EnableCaptureAndDisableMonitoring) { | 241 EnableCaptureAndDisableMonitoring) { |
242 TestEnableCaptureAndDisableMonitoring(base::FilePath()); | 242 TestEnableCaptureAndDisableMonitoring(base::FilePath()); |
243 } | 243 } |
244 | 244 |
245 IN_PROC_BROWSER_TEST_F(TracingControllerTest, | 245 IN_PROC_BROWSER_TEST_F(TracingControllerTest, |
246 EnableCaptureAndDisableMonitoringWithFilePath) { | 246 EnableCaptureAndDisableMonitoringWithFilePath) { |
247 base::FilePath file_path; | 247 base::FilePath file_path; |
248 file_util::CreateTemporaryFile(&file_path); | 248 base::CreateTemporaryFile(&file_path); |
249 TestEnableCaptureAndDisableMonitoring(file_path); | 249 TestEnableCaptureAndDisableMonitoring(file_path); |
250 EXPECT_EQ(file_path.value(), last_actual_monitoring_file_path().value()); | 250 EXPECT_EQ(file_path.value(), last_actual_monitoring_file_path().value()); |
251 } | 251 } |
252 | 252 |
253 IN_PROC_BROWSER_TEST_F( | 253 IN_PROC_BROWSER_TEST_F( |
254 TracingControllerTest, | 254 TracingControllerTest, |
255 EnableCaptureAndDisableMonitoringWithEmptyFileAndNullCallback) { | 255 EnableCaptureAndDisableMonitoringWithEmptyFileAndNullCallback) { |
256 Navigate(shell()); | 256 Navigate(shell()); |
257 | 257 |
258 TracingController* controller = TracingController::GetInstance(); | 258 TracingController* controller = TracingController::GetInstance(); |
259 EXPECT_TRUE(controller->EnableMonitoring( | 259 EXPECT_TRUE(controller->EnableMonitoring( |
260 "", TracingController::ENABLE_SAMPLING, | 260 "", TracingController::ENABLE_SAMPLING, |
261 TracingController::EnableMonitoringDoneCallback())); | 261 TracingController::EnableMonitoringDoneCallback())); |
262 controller->CaptureMonitoringSnapshot( | 262 controller->CaptureMonitoringSnapshot( |
263 base::FilePath(), TracingController::TracingFileResultCallback()); | 263 base::FilePath(), TracingController::TracingFileResultCallback()); |
264 base::RunLoop().RunUntilIdle(); | 264 base::RunLoop().RunUntilIdle(); |
265 EXPECT_TRUE(controller->DisableMonitoring( | 265 EXPECT_TRUE(controller->DisableMonitoring( |
266 TracingController::DisableMonitoringDoneCallback())); | 266 TracingController::DisableMonitoringDoneCallback())); |
267 base::RunLoop().RunUntilIdle(); | 267 base::RunLoop().RunUntilIdle(); |
268 } | 268 } |
269 | 269 |
270 } // namespace content | 270 } // namespace content |
OLD | NEW |