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

Unified Diff: net/log/trace_net_log_observer_unittest.cc

Issue 2554483002: netlog: Don't enable recording if the "netlog" tracing category is disabled. (Closed)
Patch Set: Address comment. Created 4 years 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 | « net/log/trace_net_log_observer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/log/trace_net_log_observer_unittest.cc
diff --git a/net/log/trace_net_log_observer_unittest.cc b/net/log/trace_net_log_observer_unittest.cc
index 2cd4f01a867d41f072a501b9604576fdc5013c28..6a3c5b05ebcdd8e96a72e47ab96b2ab643edd37a 100644
--- a/net/log/trace_net_log_observer_unittest.cc
+++ b/net/log/trace_net_log_observer_unittest.cc
@@ -398,6 +398,44 @@ TEST_F(TraceNetLogObserverTest, EventsWithAndWithoutParameters) {
EXPECT_TRUE(item2_params.empty());
}
+TEST(TraceNetLogObserverCategoryTest, DisabledCategory) {
+ TraceNetLogObserver observer;
+ NetLog net_log;
+ observer.WatchForTraceStart(&net_log);
+
+ EXPECT_FALSE(net_log.IsCapturing());
+
+ std::string disabled_netlog_category =
+ std::string("-") + kNetLogTracingCategory;
+ TraceLog::GetInstance()->SetEnabled(
+ base::trace_event::TraceConfig(disabled_netlog_category, ""),
+ TraceLog::RECORDING_MODE);
+
+ EXPECT_FALSE(net_log.IsCapturing());
+ observer.StopWatchForTraceStart();
+ EXPECT_FALSE(net_log.IsCapturing());
+
+ TraceLog::GetInstance()->SetDisabled();
+}
+
+TEST(TraceNetLogObserverCategoryTest, EnabledCategory) {
+ TraceNetLogObserver observer;
+ NetLog net_log;
+ observer.WatchForTraceStart(&net_log);
+
+ EXPECT_FALSE(net_log.IsCapturing());
+
+ TraceLog::GetInstance()->SetEnabled(
+ base::trace_event::TraceConfig(kNetLogTracingCategory, ""),
+ TraceLog::RECORDING_MODE);
+
+ EXPECT_TRUE(net_log.IsCapturing());
+ observer.StopWatchForTraceStart();
+ EXPECT_FALSE(net_log.IsCapturing());
+
+ TraceLog::GetInstance()->SetDisabled();
+}
+
} // namespace
} // namespace net
« no previous file with comments | « net/log/trace_net_log_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698