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

Side by Side Diff: content/browser/tracing/tracing_controller_browsertest.cc

Issue 67683003: Remove TraceController (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 TracingController* controller = TracingController::GetInstance(); 116 TracingController* controller = TracingController::GetInstance();
117 117
118 { 118 {
119 base::RunLoop run_loop; 119 base::RunLoop run_loop;
120 TracingController::EnableRecordingDoneCallback callback = 120 TracingController::EnableRecordingDoneCallback callback =
121 base::Bind(&TracingControllerTest::EnableRecordingDoneCallbackTest, 121 base::Bind(&TracingControllerTest::EnableRecordingDoneCallbackTest,
122 base::Unretained(this), 122 base::Unretained(this),
123 run_loop.QuitClosure()); 123 run_loop.QuitClosure());
124 bool result = controller->EnableRecording( 124 bool result = controller->EnableRecording(
125 base::debug::CategoryFilter(""), TracingController::Options(), 125 "", TracingController::DEFAULT_OPTIONS, callback);
126 callback);
127 EXPECT_TRUE(result); 126 EXPECT_TRUE(result);
128 run_loop.Run(); 127 run_loop.Run();
129 EXPECT_EQ(enable_recording_done_callback_count(), 1); 128 EXPECT_EQ(enable_recording_done_callback_count(), 1);
130 } 129 }
131 130
132 { 131 {
133 base::RunLoop run_loop; 132 base::RunLoop run_loop;
134 TracingController::TracingFileResultCallback callback = 133 TracingController::TracingFileResultCallback callback =
135 base::Bind(&TracingControllerTest::DisableRecordingDoneCallbackTest, 134 base::Bind(&TracingControllerTest::DisableRecordingDoneCallbackTest,
136 base::Unretained(this), 135 base::Unretained(this),
(...skipping 11 matching lines...) Expand all
148 147
149 TracingController* controller = TracingController::GetInstance(); 148 TracingController* controller = TracingController::GetInstance();
150 149
151 { 150 {
152 base::RunLoop run_loop; 151 base::RunLoop run_loop;
153 TracingController::EnableMonitoringDoneCallback callback = 152 TracingController::EnableMonitoringDoneCallback callback =
154 base::Bind(&TracingControllerTest::EnableMonitoringDoneCallbackTest, 153 base::Bind(&TracingControllerTest::EnableMonitoringDoneCallbackTest,
155 base::Unretained(this), 154 base::Unretained(this),
156 run_loop.QuitClosure()); 155 run_loop.QuitClosure());
157 bool result = controller->EnableMonitoring( 156 bool result = controller->EnableMonitoring(
158 base::debug::CategoryFilter(""), TracingController::ENABLE_SAMPLING, 157 "", TracingController::ENABLE_SAMPLING, callback);
159 callback);
160 EXPECT_TRUE(result); 158 EXPECT_TRUE(result);
161 run_loop.Run(); 159 run_loop.Run();
162 EXPECT_EQ(enable_monitoring_done_callback_count(), 1); 160 EXPECT_EQ(enable_monitoring_done_callback_count(), 1);
163 } 161 }
164 162
165 { 163 {
166 base::RunLoop run_loop; 164 base::RunLoop run_loop;
167 TracingController::TracingFileResultCallback callback = 165 TracingController::TracingFileResultCallback callback =
168 base::Bind(&TracingControllerTest:: 166 base::Bind(&TracingControllerTest::
169 CaptureMonitoringSnapshotDoneCallbackTest, 167 CaptureMonitoringSnapshotDoneCallbackTest,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 TestEnableAndDisableRecording(file_path); 222 TestEnableAndDisableRecording(file_path);
225 EXPECT_EQ(file_path.value(), last_actual_recording_file_path().value()); 223 EXPECT_EQ(file_path.value(), last_actual_recording_file_path().value());
226 } 224 }
227 225
228 IN_PROC_BROWSER_TEST_F(TracingControllerTest, 226 IN_PROC_BROWSER_TEST_F(TracingControllerTest,
229 EnableAndDisableRecordingWithEmptyFileAndNullCallback) { 227 EnableAndDisableRecordingWithEmptyFileAndNullCallback) {
230 Navigate(shell()); 228 Navigate(shell());
231 229
232 TracingController* controller = TracingController::GetInstance(); 230 TracingController* controller = TracingController::GetInstance();
233 EXPECT_TRUE(controller->EnableRecording( 231 EXPECT_TRUE(controller->EnableRecording(
234 base::debug::CategoryFilter(""), TracingController::Options(), 232 "", TracingController::DEFAULT_OPTIONS,
235 TracingController::EnableRecordingDoneCallback())); 233 TracingController::EnableRecordingDoneCallback()));
236 EXPECT_TRUE(controller->DisableRecording( 234 EXPECT_TRUE(controller->DisableRecording(
237 base::FilePath(), TracingController::TracingFileResultCallback())); 235 base::FilePath(), TracingController::TracingFileResultCallback()));
238 base::RunLoop().RunUntilIdle(); 236 base::RunLoop().RunUntilIdle();
239 } 237 }
240 238
241 IN_PROC_BROWSER_TEST_F(TracingControllerTest, 239 IN_PROC_BROWSER_TEST_F(TracingControllerTest,
242 EnableCaptureAndDisableMonitoring) { 240 EnableCaptureAndDisableMonitoring) {
243 TestEnableCaptureAndDisableMonitoring(base::FilePath()); 241 TestEnableCaptureAndDisableMonitoring(base::FilePath());
244 } 242 }
245 243
246 IN_PROC_BROWSER_TEST_F(TracingControllerTest, 244 IN_PROC_BROWSER_TEST_F(TracingControllerTest,
247 EnableCaptureAndDisableMonitoringWithFilePath) { 245 EnableCaptureAndDisableMonitoringWithFilePath) {
248 base::FilePath file_path; 246 base::FilePath file_path;
249 file_util::CreateTemporaryFile(&file_path); 247 file_util::CreateTemporaryFile(&file_path);
250 TestEnableCaptureAndDisableMonitoring(file_path); 248 TestEnableCaptureAndDisableMonitoring(file_path);
251 EXPECT_EQ(file_path.value(), last_actual_monitoring_file_path().value()); 249 EXPECT_EQ(file_path.value(), last_actual_monitoring_file_path().value());
252 } 250 }
253 251
254 IN_PROC_BROWSER_TEST_F( 252 IN_PROC_BROWSER_TEST_F(
255 TracingControllerTest, 253 TracingControllerTest,
256 EnableCaptureAndDisableMonitoringWithEmptyFileAndNullCallback) { 254 EnableCaptureAndDisableMonitoringWithEmptyFileAndNullCallback) {
257 Navigate(shell()); 255 Navigate(shell());
258 256
259 TracingController* controller = TracingController::GetInstance(); 257 TracingController* controller = TracingController::GetInstance();
260 EXPECT_TRUE(controller->EnableMonitoring( 258 EXPECT_TRUE(controller->EnableMonitoring(
261 base::debug::CategoryFilter(""), TracingController::ENABLE_SAMPLING, 259 "", TracingController::ENABLE_SAMPLING,
262 TracingController::EnableMonitoringDoneCallback())); 260 TracingController::EnableMonitoringDoneCallback()));
263 controller->CaptureMonitoringSnapshot( 261 controller->CaptureMonitoringSnapshot(
264 base::FilePath(), TracingController::TracingFileResultCallback()); 262 base::FilePath(), TracingController::TracingFileResultCallback());
265 base::RunLoop().RunUntilIdle(); 263 base::RunLoop().RunUntilIdle();
266 EXPECT_TRUE(controller->DisableMonitoring( 264 EXPECT_TRUE(controller->DisableMonitoring(
267 TracingController::DisableMonitoringDoneCallback())); 265 TracingController::DisableMonitoringDoneCallback()));
268 base::RunLoop().RunUntilIdle(); 266 base::RunLoop().RunUntilIdle();
269 } 267 }
270 268
271 } // namespace content 269 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698