Index: base/trace_event/trace_config_unittest.cc |
diff --git a/base/trace_event/trace_config_unittest.cc b/base/trace_event/trace_config_unittest.cc |
index fa4fa7c3e05e5845c893018320a29caba2ec4605..c04029909cc527286f6b73fbb6a23edd890fc44c 100644 |
--- a/base/trace_event/trace_config_unittest.cc |
+++ b/base/trace_event/trace_config_unittest.cc |
@@ -20,7 +20,6 @@ namespace { |
const char kDefaultTraceConfigString[] = |
"{" |
"\"enable_argument_filter\":false," |
- "\"enable_sampling\":false," |
"\"enable_systrace\":false," |
"\"record_mode\":\"record-until-full\"" |
"}"; |
@@ -28,7 +27,6 @@ const char kDefaultTraceConfigString[] = |
const char kCustomTraceConfigString[] = |
"{" |
"\"enable_argument_filter\":true," |
- "\"enable_sampling\":true," |
"\"enable_systrace\":true," |
"\"event_filters\":[" |
"{" |
@@ -59,7 +57,6 @@ const char kCustomTraceConfigString[] = |
void CheckDefaultTraceConfigBehavior(const TraceConfig& tc) { |
EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); |
- EXPECT_FALSE(tc.IsSamplingEnabled()); |
EXPECT_FALSE(tc.IsSystraceEnabled()); |
EXPECT_FALSE(tc.IsArgumentFilterEnabled()); |
@@ -81,44 +78,31 @@ TEST(TraceConfigTest, TraceConfigFromValidLegacyFormat) { |
// From trace options strings |
TraceConfig config("", "record-until-full"); |
EXPECT_EQ(RECORD_UNTIL_FULL, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("record-until-full", config.ToTraceOptionsString().c_str()); |
config = TraceConfig("", "record-continuously"); |
EXPECT_EQ(RECORD_CONTINUOUSLY, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("record-continuously", config.ToTraceOptionsString().c_str()); |
config = TraceConfig("", "trace-to-console"); |
EXPECT_EQ(ECHO_TO_CONSOLE, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("trace-to-console", config.ToTraceOptionsString().c_str()); |
config = TraceConfig("", "record-as-much-as-possible"); |
EXPECT_EQ(RECORD_AS_MUCH_AS_POSSIBLE, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("record-as-much-as-possible", |
config.ToTraceOptionsString().c_str()); |
- config = TraceConfig("", "record-until-full, enable-sampling"); |
- EXPECT_EQ(RECORD_UNTIL_FULL, config.GetTraceRecordMode()); |
- EXPECT_TRUE(config.IsSamplingEnabled()); |
- EXPECT_FALSE(config.IsSystraceEnabled()); |
- EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
- EXPECT_STREQ("record-until-full,enable-sampling", |
- config.ToTraceOptionsString().c_str()); |
- |
config = TraceConfig("", "enable-systrace, record-continuously"); |
EXPECT_EQ(RECORD_CONTINUOUSLY, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_TRUE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("record-continuously,enable-systrace", |
@@ -126,7 +110,6 @@ TEST(TraceConfigTest, TraceConfigFromValidLegacyFormat) { |
config = TraceConfig("", "enable-argument-filter,record-as-much-as-possible"); |
EXPECT_EQ(RECORD_AS_MUCH_AS_POSSIBLE, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_TRUE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("record-as-much-as-possible,enable-argument-filter", |
@@ -134,19 +117,17 @@ TEST(TraceConfigTest, TraceConfigFromValidLegacyFormat) { |
config = TraceConfig( |
"", |
- "enable-systrace,trace-to-console,enable-sampling,enable-argument-filter"); |
+ "enable-systrace,trace-to-console,enable-argument-filter"); |
EXPECT_EQ(ECHO_TO_CONSOLE, config.GetTraceRecordMode()); |
- EXPECT_TRUE(config.IsSamplingEnabled()); |
EXPECT_TRUE(config.IsSystraceEnabled()); |
EXPECT_TRUE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ( |
- "trace-to-console,enable-sampling,enable-systrace,enable-argument-filter", |
+ "trace-to-console,enable-systrace,enable-argument-filter", |
config.ToTraceOptionsString().c_str()); |
config = TraceConfig( |
"", "record-continuously, record-until-full, trace-to-console"); |
EXPECT_EQ(ECHO_TO_CONSOLE, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("trace-to-console", config.ToTraceOptionsString().c_str()); |
@@ -154,28 +135,24 @@ TEST(TraceConfigTest, TraceConfigFromValidLegacyFormat) { |
// From TraceRecordMode |
config = TraceConfig("", RECORD_UNTIL_FULL); |
EXPECT_EQ(RECORD_UNTIL_FULL, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("record-until-full", config.ToTraceOptionsString().c_str()); |
config = TraceConfig("", RECORD_CONTINUOUSLY); |
EXPECT_EQ(RECORD_CONTINUOUSLY, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("record-continuously", config.ToTraceOptionsString().c_str()); |
config = TraceConfig("", ECHO_TO_CONSOLE); |
EXPECT_EQ(ECHO_TO_CONSOLE, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("trace-to-console", config.ToTraceOptionsString().c_str()); |
config = TraceConfig("", RECORD_AS_MUCH_AS_POSSIBLE); |
EXPECT_EQ(RECORD_AS_MUCH_AS_POSSIBLE, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("record-as-much-as-possible", |
@@ -207,33 +184,30 @@ TEST(TraceConfigTest, TraceConfigFromValidLegacyFormat) { |
// From both trace options and category filter strings |
config = TraceConfig("", ""); |
EXPECT_EQ(RECORD_UNTIL_FULL, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("", config.ToCategoryFilterString().c_str()); |
EXPECT_STREQ("record-until-full", config.ToTraceOptionsString().c_str()); |
config = TraceConfig("included,-excluded,inc_pattern*,-exc_pattern*", |
- "enable-systrace, trace-to-console, enable-sampling"); |
+ "enable-systrace, trace-to-console"); |
EXPECT_EQ(ECHO_TO_CONSOLE, config.GetTraceRecordMode()); |
- EXPECT_TRUE(config.IsSamplingEnabled()); |
EXPECT_TRUE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("included,inc_pattern*,-excluded,-exc_pattern*", |
config.ToCategoryFilterString().c_str()); |
- EXPECT_STREQ("trace-to-console,enable-sampling,enable-systrace", |
+ EXPECT_STREQ("trace-to-console,enable-systrace", |
config.ToTraceOptionsString().c_str()); |
// From both trace options and category filter strings with spaces. |
config = TraceConfig(" included , -excluded, inc_pattern*, ,-exc_pattern* ", |
- "enable-systrace, ,trace-to-console, enable-sampling "); |
+ "enable-systrace, ,trace-to-console "); |
EXPECT_EQ(ECHO_TO_CONSOLE, config.GetTraceRecordMode()); |
- EXPECT_TRUE(config.IsSamplingEnabled()); |
EXPECT_TRUE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("included,inc_pattern*,-excluded,-exc_pattern*", |
config.ToCategoryFilterString().c_str()); |
- EXPECT_STREQ("trace-to-console,enable-sampling,enable-systrace", |
+ EXPECT_STREQ("trace-to-console,enable-systrace", |
config.ToTraceOptionsString().c_str()); |
// From category filter string and TraceRecordMode |
@@ -241,7 +215,6 @@ TEST(TraceConfigTest, TraceConfigFromValidLegacyFormat) { |
RECORD_CONTINUOUSLY); |
EXPECT_EQ(RECORD_CONTINUOUSLY, config.GetTraceRecordMode()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("included,inc_pattern*,-excluded,-exc_pattern*", |
config.ToCategoryFilterString().c_str()); |
@@ -251,7 +224,6 @@ TEST(TraceConfigTest, TraceConfigFromValidLegacyFormat) { |
TEST(TraceConfigTest, TraceConfigFromInvalidLegacyStrings) { |
TraceConfig config("", "foo-bar-baz"); |
EXPECT_EQ(RECORD_UNTIL_FULL, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_FALSE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("", config.ToCategoryFilterString().c_str()); |
@@ -259,7 +231,6 @@ TEST(TraceConfigTest, TraceConfigFromInvalidLegacyStrings) { |
config = TraceConfig("arbitrary-category", "foo-bar-baz, enable-systrace"); |
EXPECT_EQ(RECORD_UNTIL_FULL, config.GetTraceRecordMode()); |
- EXPECT_FALSE(config.IsSamplingEnabled()); |
EXPECT_TRUE(config.IsSystraceEnabled()); |
EXPECT_FALSE(config.IsArgumentFilterEnabled()); |
EXPECT_STREQ("arbitrary-category", config.ToCategoryFilterString().c_str()); |
@@ -356,7 +327,6 @@ TEST(TraceConfigTest, TraceConfigFromDict) { |
TraceConfig tc(dict); |
EXPECT_STREQ(kDefaultTraceConfigString, tc.ToString().c_str()); |
EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); |
- EXPECT_FALSE(tc.IsSamplingEnabled()); |
EXPECT_FALSE(tc.IsSystraceEnabled()); |
EXPECT_FALSE(tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("", tc.ToCategoryFilterString().c_str()); |
@@ -370,7 +340,6 @@ TEST(TraceConfigTest, TraceConfigFromDict) { |
TraceConfig default_tc(*default_dict); |
EXPECT_STREQ(kDefaultTraceConfigString, default_tc.ToString().c_str()); |
EXPECT_EQ(RECORD_UNTIL_FULL, default_tc.GetTraceRecordMode()); |
- EXPECT_FALSE(default_tc.IsSamplingEnabled()); |
EXPECT_FALSE(default_tc.IsSystraceEnabled()); |
EXPECT_FALSE(default_tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("", default_tc.ToCategoryFilterString().c_str()); |
@@ -384,7 +353,6 @@ TEST(TraceConfigTest, TraceConfigFromDict) { |
TraceConfig custom_tc(*custom_dict); |
EXPECT_STREQ(kCustomTraceConfigString, custom_tc.ToString().c_str()); |
EXPECT_EQ(RECORD_CONTINUOUSLY, custom_tc.GetTraceRecordMode()); |
- EXPECT_TRUE(custom_tc.IsSamplingEnabled()); |
EXPECT_TRUE(custom_tc.IsSystraceEnabled()); |
EXPECT_TRUE(custom_tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("included,inc_pattern*," |
@@ -399,7 +367,6 @@ TEST(TraceConfigTest, TraceConfigFromValidString) { |
const char config_string[] = |
"{" |
"\"enable_argument_filter\":true," |
- "\"enable_sampling\":true," |
"\"enable_systrace\":true," |
"\"event_filters\":[" |
"{" |
@@ -420,7 +387,6 @@ TEST(TraceConfigTest, TraceConfigFromValidString) { |
EXPECT_STREQ(config_string, tc.ToString().c_str()); |
EXPECT_EQ(RECORD_CONTINUOUSLY, tc.GetTraceRecordMode()); |
- EXPECT_TRUE(tc.IsSamplingEnabled()); |
EXPECT_TRUE(tc.IsSystraceEnabled()); |
EXPECT_TRUE(tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("included,inc_pattern*,disabled-by-default-cc,-excluded," |
@@ -479,7 +445,6 @@ TEST(TraceConfigTest, TraceConfigFromValidString) { |
EXPECT_STREQ(tc.ToString().c_str(), |
"{" |
"\"enable_argument_filter\":false," |
- "\"enable_sampling\":false," |
"\"enable_systrace\":false," |
"\"record_mode\":\"record-until-full\"" |
"}"); |
@@ -491,7 +456,6 @@ TEST(TraceConfigTest, TraceConfigFromInvalidString) { |
TraceConfig tc(""); |
EXPECT_STREQ(kDefaultTraceConfigString, tc.ToString().c_str()); |
EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); |
- EXPECT_FALSE(tc.IsSamplingEnabled()); |
EXPECT_FALSE(tc.IsSystraceEnabled()); |
EXPECT_FALSE(tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("", tc.ToCategoryFilterString().c_str()); |
@@ -500,7 +464,6 @@ TEST(TraceConfigTest, TraceConfigFromInvalidString) { |
tc = TraceConfig("This is an invalid config string."); |
EXPECT_STREQ(kDefaultTraceConfigString, tc.ToString().c_str()); |
EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); |
- EXPECT_FALSE(tc.IsSamplingEnabled()); |
EXPECT_FALSE(tc.IsSystraceEnabled()); |
EXPECT_FALSE(tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("", tc.ToCategoryFilterString().c_str()); |
@@ -509,7 +472,6 @@ TEST(TraceConfigTest, TraceConfigFromInvalidString) { |
tc = TraceConfig("[\"This\", \"is\", \"not\", \"a\", \"dictionary\"]"); |
EXPECT_STREQ(kDefaultTraceConfigString, tc.ToString().c_str()); |
EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); |
- EXPECT_FALSE(tc.IsSamplingEnabled()); |
EXPECT_FALSE(tc.IsSystraceEnabled()); |
EXPECT_FALSE(tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("", tc.ToCategoryFilterString().c_str()); |
@@ -518,7 +480,6 @@ TEST(TraceConfigTest, TraceConfigFromInvalidString) { |
tc = TraceConfig("{\"record_mode\": invalid-value-needs-double-quote}"); |
EXPECT_STREQ(kDefaultTraceConfigString, tc.ToString().c_str()); |
EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); |
- EXPECT_FALSE(tc.IsSamplingEnabled()); |
EXPECT_FALSE(tc.IsSystraceEnabled()); |
EXPECT_FALSE(tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("", tc.ToCategoryFilterString().c_str()); |
@@ -528,7 +489,6 @@ TEST(TraceConfigTest, TraceConfigFromInvalidString) { |
// initialize TraceConfig with best effort. |
tc = TraceConfig("{}"); |
EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); |
- EXPECT_FALSE(tc.IsSamplingEnabled()); |
EXPECT_FALSE(tc.IsSystraceEnabled()); |
EXPECT_FALSE(tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("", tc.ToCategoryFilterString().c_str()); |
@@ -536,7 +496,6 @@ TEST(TraceConfigTest, TraceConfigFromInvalidString) { |
tc = TraceConfig("{\"arbitrary-key\":\"arbitrary-value\"}"); |
EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); |
- EXPECT_FALSE(tc.IsSamplingEnabled()); |
EXPECT_FALSE(tc.IsSystraceEnabled()); |
EXPECT_FALSE(tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("", tc.ToCategoryFilterString().c_str()); |
@@ -544,7 +503,6 @@ TEST(TraceConfigTest, TraceConfigFromInvalidString) { |
const char invalid_config_string[] = |
"{" |
- "\"enable_sampling\":\"true\"," |
"\"enable_systrace\":1," |
"\"excluded_categories\":[\"excluded\"]," |
"\"included_categories\":\"not a list\"," |
@@ -555,7 +513,6 @@ TEST(TraceConfigTest, TraceConfigFromInvalidString) { |
"}"; |
tc = TraceConfig(invalid_config_string); |
EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); |
- EXPECT_FALSE(tc.IsSamplingEnabled()); |
EXPECT_FALSE(tc.IsSystraceEnabled()); |
EXPECT_FALSE(tc.IsArgumentFilterEnabled()); |
EXPECT_STREQ("-excluded,DELAY(test.Delay1;16),DELAY(test.Delay2;32)", |
@@ -580,7 +537,6 @@ TEST(TraceConfigTest, MergingTraceConfigs) { |
tc.Merge(tc2); |
EXPECT_STREQ("{" |
"\"enable_argument_filter\":false," |
- "\"enable_sampling\":false," |
"\"enable_systrace\":false," |
"\"excluded_categories\":[\"excluded\",\"exc_pattern*\"]," |
"\"record_mode\":\"record-until-full\"" |
@@ -647,15 +603,11 @@ TEST(TraceConfigTest, IsEmptyOrContainsLeadingOrTrailingWhitespace) { |
TEST(TraceConfigTest, SetTraceOptionValues) { |
TraceConfig tc; |
EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); |
- EXPECT_FALSE(tc.IsSamplingEnabled()); |
EXPECT_FALSE(tc.IsSystraceEnabled()); |
tc.SetTraceRecordMode(RECORD_AS_MUCH_AS_POSSIBLE); |
EXPECT_EQ(RECORD_AS_MUCH_AS_POSSIBLE, tc.GetTraceRecordMode()); |
- tc.EnableSampling(); |
- EXPECT_TRUE(tc.IsSamplingEnabled()); |
- |
tc.EnableSystrace(); |
EXPECT_TRUE(tc.IsSystraceEnabled()); |
} |