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

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

Issue 1427873003: Background tracing: Added trace_chance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Oops Created 5 years, 2 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 | « no previous file | content/browser/tracing/background_tracing_manager_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tracing/background_tracing_config_unittest.cc
diff --git a/content/browser/tracing/background_tracing_config_unittest.cc b/content/browser/tracing/background_tracing_config_unittest.cc
index a6a5ebfc25e3af441e5542ff95483b7e5a38f372..2b95069a401eefb460480ea9da30c750175be1ba 100644
--- a/content/browser/tracing/background_tracing_config_unittest.cc
+++ b/content/browser/tracing/background_tracing_config_unittest.cc
@@ -295,6 +295,20 @@ TEST_F(BackgroundTracingConfigTest, ReactiveConfigFromValidString) {
"{\"category\":\"BENCHMARK_DEEP\","
"\"rule\":\"TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL\","
"\"trigger_name\":\"foo\"}");
+
+ config = ReadFromJSONString(
+ "{\"mode\":\"REACTIVE_TRACING_MODE\",\"configs\": [{\"rule\": "
+ "\"TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL\", "
+ "\"category\": \"BENCHMARK_DEEP\", \"trigger_name\": \"foo\", "
+ "\"trigger_chance\": 0.5}]}");
+ EXPECT_TRUE(config);
+ EXPECT_EQ(config->tracing_mode(), BackgroundTracingConfig::REACTIVE);
+ EXPECT_EQ(config->rules().size(), 1u);
+ EXPECT_EQ(RuleToString(config->rules()[0]),
+ "{\"category\":\"BENCHMARK_DEEP\","
+ "\"rule\":\"TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL\","
+ "\"trigger_chance\":0.5,\"trigger_name\":\"foo\"}");
+
config = ReadFromJSONString(
"{\"mode\":\"REACTIVE_TRACING_MODE\",\"configs\": [{\"rule\": "
"\"TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL\", "
@@ -363,6 +377,24 @@ TEST_F(BackgroundTracingConfigTest, ValidPreemptiveConfigToString) {
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED");
+ dict->SetString("trigger_name", "foo");
+ dict->SetDouble("trigger_chance", 0.5);
+ config->AddPreemptiveRule(dict.get());
+
+ EXPECT_EQ(
+ ConfigToString(config.get()),
+ "{\"category\":\"BENCHMARK_DEEP\",\"configs\":[{\"rule\":"
+ "\"MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED\",\"trigger_chance\":0.5,"
+ "\"trigger_name\":\"foo\"}],\"mode\":\"PREEMPTIVE_TRACING_MODE\"}");
+ }
+
+ {
+ config.reset(
+ new BackgroundTracingConfigImpl(BackgroundTracingConfig::PREEMPTIVE));
+ config->set_category_preset(BackgroundTracingConfigImpl::BENCHMARK_DEEP);
+
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED");
dict->SetString("trigger_name", "foo1");
config->AddPreemptiveRule(dict.get());
« no previous file with comments | « no previous file | content/browser/tracing/background_tracing_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698