diff options
author | haraken@chromium.org <haraken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-16 16:12:56 +0000 |
---|---|---|
committer | haraken@chromium.org <haraken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-16 16:12:56 +0000 |
commit | 5186ccb8c67e321f34bb82cedfed1920832acfd2 (patch) | |
tree | e250f5acc1916c3d6aeb1793f29e5e45fde6ebb5 /content/browser/tracing/tracing_controller_browsertest.cc | |
parent | c49558d4ce96b63c3afe2ac4ae759dd338f0377e (diff) | |
download | chromium_src-5186ccb8c67e321f34bb82cedfed1920832acfd2.zip chromium_src-5186ccb8c67e321f34bb82cedfed1920832acfd2.tar.gz chromium_src-5186ccb8c67e321f34bb82cedfed1920832acfd2.tar.bz2 |
Implement TracingController::GetMonitoringStatus
trace-viewer side CL is here: https://codereview.appspot.com/52710047
Currently the monitoring mode doesn't work correctly when we reload about:tracing. This is because reloaded about:tracing fails in extracting the current monitoring status (See my comment in patch set 2).
This CL implements TracingController::GetMonitoringStatus so that trace-viewer/src/about_tracing/profiling_view.js can get the current monitoring status when loading the profiling view.
TEST=content_browsertests::EnableCaptureAndDisableMonitoring
R=nduca@chromium.org
Review URL: https://codereview.chromium.org/139313005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/tracing/tracing_controller_browsertest.cc')
-rw-r--r-- | content/browser/tracing/tracing_controller_browsertest.cc | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/content/browser/tracing/tracing_controller_browsertest.cc b/content/browser/tracing/tracing_controller_browsertest.cc index bccf90a..8449486 100644 --- a/content/browser/tracing/tracing_controller_browsertest.cc +++ b/content/browser/tracing/tracing_controller_browsertest.cc @@ -148,19 +148,47 @@ class TracingControllerTest : public ContentBrowserTest { TracingController* controller = TracingController::GetInstance(); { + bool is_monitoring; + std::string category_filter; + TracingController::Options options; + controller->GetMonitoringStatus(&is_monitoring, + &category_filter, + &options); + EXPECT_FALSE(is_monitoring); + EXPECT_EQ("-*Debug,-*Test", category_filter); + EXPECT_FALSE(options & TracingController::ENABLE_SYSTRACE); + EXPECT_FALSE(options & TracingController::RECORD_CONTINUOUSLY); + EXPECT_FALSE(options & TracingController::ENABLE_SAMPLING); + } + + { base::RunLoop run_loop; TracingController::EnableMonitoringDoneCallback callback = base::Bind(&TracingControllerTest::EnableMonitoringDoneCallbackTest, base::Unretained(this), run_loop.QuitClosure()); bool result = controller->EnableMonitoring( - "", TracingController::ENABLE_SAMPLING, callback); + "*", TracingController::ENABLE_SAMPLING, callback); ASSERT_TRUE(result); run_loop.Run(); EXPECT_EQ(enable_monitoring_done_callback_count(), 1); } { + bool is_monitoring; + std::string category_filter; + TracingController::Options options; + controller->GetMonitoringStatus(&is_monitoring, + &category_filter, + &options); + EXPECT_TRUE(is_monitoring); + EXPECT_EQ("*", category_filter); + EXPECT_FALSE(options & TracingController::ENABLE_SYSTRACE); + EXPECT_FALSE(options & TracingController::RECORD_CONTINUOUSLY); + EXPECT_TRUE(options & TracingController::ENABLE_SAMPLING); + } + + { base::RunLoop run_loop; TracingController::TracingFileResultCallback callback = base::Bind(&TracingControllerTest:: @@ -184,6 +212,20 @@ class TracingControllerTest : public ContentBrowserTest { run_loop.Run(); EXPECT_EQ(disable_monitoring_done_callback_count(), 1); } + + { + bool is_monitoring; + std::string category_filter; + TracingController::Options options; + controller->GetMonitoringStatus(&is_monitoring, + &category_filter, + &options); + EXPECT_FALSE(is_monitoring); + EXPECT_EQ("", category_filter); + EXPECT_FALSE(options & TracingController::ENABLE_SYSTRACE); + EXPECT_FALSE(options & TracingController::RECORD_CONTINUOUSLY); + EXPECT_FALSE(options & TracingController::ENABLE_SAMPLING); + } } private: @@ -257,7 +299,7 @@ IN_PROC_BROWSER_TEST_F( TracingController* controller = TracingController::GetInstance(); EXPECT_TRUE(controller->EnableMonitoring( - "", TracingController::ENABLE_SAMPLING, + "*", TracingController::ENABLE_SAMPLING, TracingController::EnableMonitoringDoneCallback())); controller->CaptureMonitoringSnapshot( base::FilePath(), TracingController::TracingFileResultCallback()); |