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

Unified Diff: content/browser/tracing/tracing_controller_browsertest.cc

Issue 1678503002: Tracing: Removed monitoring mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/tracing/trace_message_filter.cc ('k') | content/browser/tracing/tracing_controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tracing/tracing_controller_browsertest.cc
diff --git a/content/browser/tracing/tracing_controller_browsertest.cc b/content/browser/tracing/tracing_controller_browsertest.cc
index d4b8671d91505285fb0b2de3f545ddb83fc0e54d..edb11c09c34f79ff7a4ec9e13ce05aa4dd6e0b14 100644
--- a/content/browser/tracing/tracing_controller_browsertest.cc
+++ b/content/browser/tracing/tracing_controller_browsertest.cc
@@ -99,9 +99,6 @@ class TracingControllerTest : public ContentBrowserTest {
get_categories_done_callback_count_ = 0;
enable_recording_done_callback_count_ = 0;
disable_recording_done_callback_count_ = 0;
- enable_monitoring_done_callback_count_ = 0;
- disable_monitoring_done_callback_count_ = 0;
- capture_monitoring_snapshot_done_callback_count_ = 0;
ContentBrowserTest::SetUp();
}
@@ -145,28 +142,7 @@ class TracingControllerTest : public ContentBrowserTest {
last_actual_recording_file_path_ = file_path;
}
- void StartMonitoringDoneCallbackTest(base::Closure quit_callback) {
- enable_monitoring_done_callback_count_++;
- quit_callback.Run();
- }
-
- void StopMonitoringDoneCallbackTest(base::Closure quit_callback) {
- disable_monitoring_done_callback_count_++;
- quit_callback.Run();
- }
-
- void CaptureMonitoringSnapshotDoneCallbackTest(
- base::Closure quit_callback, const base::FilePath& file_path) {
- capture_monitoring_snapshot_done_callback_count_++;
- EXPECT_TRUE(PathExists(file_path));
- int64_t file_size;
- base::GetFileSize(file_path, &file_size);
- EXPECT_TRUE(file_size > 0);
- quit_callback.Run();
- last_actual_monitoring_file_path_ = file_path;
- }
-
- int get_categories_done_callback_count() const {
+ int get_categories_done_callback_count() const {
return get_categories_done_callback_count_;
}
@@ -178,26 +154,10 @@ class TracingControllerTest : public ContentBrowserTest {
return disable_recording_done_callback_count_;
}
- int enable_monitoring_done_callback_count() const {
- return enable_monitoring_done_callback_count_;
- }
-
- int disable_monitoring_done_callback_count() const {
- return disable_monitoring_done_callback_count_;
- }
-
- int capture_monitoring_snapshot_done_callback_count() const {
- return capture_monitoring_snapshot_done_callback_count_;
- }
-
base::FilePath last_actual_recording_file_path() const {
return last_actual_recording_file_path_;
}
- base::FilePath last_actual_monitoring_file_path() const {
- return last_actual_monitoring_file_path_;
- }
-
const base::DictionaryValue* last_metadata() const {
return last_metadata_.get();
}
@@ -382,96 +342,11 @@ class TracingControllerTest : public ContentBrowserTest {
}
}
- void TestEnableCaptureAndStopMonitoring(
- const base::FilePath& result_file_path) {
- Navigate(shell());
-
- TracingController* controller = TracingController::GetInstance();
-
- {
- bool is_monitoring;
- TraceConfig trace_config("", "");
- controller->GetMonitoringStatus(
- &is_monitoring, &trace_config);
- EXPECT_FALSE(is_monitoring);
- EXPECT_EQ("-*Debug,-*Test", trace_config.ToCategoryFilterString());
- EXPECT_FALSE(trace_config.GetTraceRecordMode() == RECORD_CONTINUOUSLY);
- EXPECT_FALSE(trace_config.IsSamplingEnabled());
- EXPECT_FALSE(trace_config.IsSystraceEnabled());
- }
-
- {
- base::RunLoop run_loop;
- TracingController::StartMonitoringDoneCallback callback =
- base::Bind(&TracingControllerTest::StartMonitoringDoneCallbackTest,
- base::Unretained(this),
- run_loop.QuitClosure());
-
- TraceConfig trace_config("*", "");
- trace_config.EnableSampling();
- bool result = controller->StartMonitoring(trace_config, callback);
- ASSERT_TRUE(result);
- run_loop.Run();
- EXPECT_EQ(enable_monitoring_done_callback_count(), 1);
- }
-
- {
- bool is_monitoring;
- TraceConfig trace_config("", "");
- controller->GetMonitoringStatus(&is_monitoring, &trace_config);
- EXPECT_TRUE(is_monitoring);
- EXPECT_EQ("*", trace_config.ToCategoryFilterString());
- EXPECT_FALSE(trace_config.GetTraceRecordMode() == RECORD_CONTINUOUSLY);
- EXPECT_TRUE(trace_config.IsSamplingEnabled());
- EXPECT_FALSE(trace_config.IsSystraceEnabled());
- }
-
- {
- base::RunLoop run_loop;
- base::Closure callback = base::Bind(
- &TracingControllerTest::CaptureMonitoringSnapshotDoneCallbackTest,
- base::Unretained(this),
- run_loop.QuitClosure(),
- result_file_path);
- ASSERT_TRUE(controller->CaptureMonitoringSnapshot(
- TracingController::CreateFileSink(result_file_path, callback)));
- run_loop.Run();
- EXPECT_EQ(capture_monitoring_snapshot_done_callback_count(), 1);
- }
-
- {
- base::RunLoop run_loop;
- TracingController::StopMonitoringDoneCallback callback =
- base::Bind(&TracingControllerTest::StopMonitoringDoneCallbackTest,
- base::Unretained(this),
- run_loop.QuitClosure());
- bool result = controller->StopMonitoring(callback);
- ASSERT_TRUE(result);
- run_loop.Run();
- EXPECT_EQ(disable_monitoring_done_callback_count(), 1);
- }
-
- {
- bool is_monitoring;
- TraceConfig trace_config("", "");
- controller->GetMonitoringStatus(&is_monitoring, &trace_config);
- EXPECT_FALSE(is_monitoring);
- EXPECT_EQ("", trace_config.ToCategoryFilterString());
- EXPECT_FALSE(trace_config.GetTraceRecordMode() == RECORD_CONTINUOUSLY);
- EXPECT_FALSE(trace_config.IsSamplingEnabled());
- EXPECT_FALSE(trace_config.IsSystraceEnabled());
- }
- }
-
private:
int get_categories_done_callback_count_;
int enable_recording_done_callback_count_;
int disable_recording_done_callback_count_;
- int enable_monitoring_done_callback_count_;
- int disable_monitoring_done_callback_count_;
- int capture_monitoring_snapshot_done_callback_count_;
base::FilePath last_actual_recording_file_path_;
- base::FilePath last_actual_monitoring_file_path_;
scoped_ptr<const base::DictionaryValue> last_metadata_;
std::string last_data_;
};
@@ -585,45 +460,4 @@ IN_PROC_BROWSER_TEST_F(TracingControllerTest,
base::RunLoop().RunUntilIdle();
}
-IN_PROC_BROWSER_TEST_F(TracingControllerTest,
- EnableCaptureAndStopMonitoring) {
- base::FilePath file_path;
- base::CreateTemporaryFile(&file_path);
- TestEnableCaptureAndStopMonitoring(file_path);
-}
-
-IN_PROC_BROWSER_TEST_F(TracingControllerTest,
- EnableCaptureAndStopMonitoringWithFilePath) {
- base::FilePath file_path;
- base::CreateTemporaryFile(&file_path);
- TestEnableCaptureAndStopMonitoring(file_path);
- EXPECT_EQ(file_path.value(), last_actual_monitoring_file_path().value());
-}
-
-// See http://crbug.com/392446
-#if defined(OS_ANDROID)
-#define MAYBE_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback \
- DISABLED_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback
-#else
-#define MAYBE_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback \
- EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback
-#endif
-IN_PROC_BROWSER_TEST_F(
- TracingControllerTest,
- MAYBE_EnableCaptureAndStopMonitoringWithEmptyFileAndNullCallback) {
- Navigate(shell());
-
- TracingController* controller = TracingController::GetInstance();
- TraceConfig trace_config("*", "");
- trace_config.EnableSampling();
- EXPECT_TRUE(controller->StartMonitoring(
- trace_config,
- TracingController::StartMonitoringDoneCallback()));
- controller->CaptureMonitoringSnapshot(NULL);
- base::RunLoop().RunUntilIdle();
- EXPECT_TRUE(controller->StopMonitoring(
- TracingController::StopMonitoringDoneCallback()));
- base::RunLoop().RunUntilIdle();
-}
-
} // namespace content
« no previous file with comments | « content/browser/tracing/trace_message_filter.cc ('k') | content/browser/tracing/tracing_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698