diff options
author | nednguyen@google.com <nednguyen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-08 01:23:59 +0000 |
---|---|---|
committer | nednguyen@google.com <nednguyen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-08 01:23:59 +0000 |
commit | 63e18ddaee9078a1925dff1a52693bb4c0808456 (patch) | |
tree | e997963e42909e41f7e9b03817223d2f29a7ff21 /base/debug/trace_event_unittest.cc | |
parent | 24c4f183d76908700d7870edcfb7c3300b508dc3 (diff) | |
download | chromium_src-63e18ddaee9078a1925dff1a52693bb4c0808456.zip chromium_src-63e18ddaee9078a1925dff1a52693bb4c0808456.tar.gz chromium_src-63e18ddaee9078a1925dff1a52693bb4c0808456.tar.bz2 |
Remove TraceOptions string based constructor. Add setter method
SetFromString that allows setting TraceOptions from a string instead.
SetFromString returns true upon success.
BUG=400382
Review URL: https://codereview.chromium.org/443523003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288193 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug/trace_event_unittest.cc')
-rw-r--r-- | base/debug/trace_event_unittest.cc | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/base/debug/trace_event_unittest.cc b/base/debug/trace_event_unittest.cc index 2615e66..581906b 100644 --- a/base/debug/trace_event_unittest.cc +++ b/base/debug/trace_event_unittest.cc @@ -2998,56 +2998,56 @@ TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { EXPECT_EQ(config, filter.ToString()); } -TEST(TraceOptionsTest, DISABLED_TraceOptionsFromString) { - TraceOptions options = TraceOptions("record-until-full"); +TEST(TraceOptionsTest, TraceOptionsFromString) { + TraceOptions options; + EXPECT_TRUE(options.SetFromString("record-until-full")); EXPECT_EQ(RECORD_UNTIL_FULL, options.record_mode); EXPECT_FALSE(options.enable_sampling); EXPECT_FALSE(options.enable_systrace); - options = TraceOptions(RECORD_CONTINUOUSLY); + EXPECT_TRUE(options.SetFromString("record-continuously")); EXPECT_EQ(RECORD_CONTINUOUSLY, options.record_mode); EXPECT_FALSE(options.enable_sampling); EXPECT_FALSE(options.enable_systrace); - options = TraceOptions("trace-to-console"); + EXPECT_TRUE(options.SetFromString("trace-to-console")); EXPECT_EQ(ECHO_TO_CONSOLE, options.record_mode); EXPECT_FALSE(options.enable_sampling); EXPECT_FALSE(options.enable_systrace); - options = TraceOptions("record-as-much-as-possible"); + EXPECT_TRUE(options.SetFromString("record-as-much-as-possible")); EXPECT_EQ(RECORD_AS_MUCH_AS_POSSIBLE, options.record_mode); EXPECT_FALSE(options.enable_sampling); EXPECT_FALSE(options.enable_systrace); - options = TraceOptions("record-until-full, enable-sampling"); + EXPECT_TRUE(options.SetFromString("record-until-full, enable-sampling")); EXPECT_EQ(RECORD_UNTIL_FULL, options.record_mode); EXPECT_TRUE(options.enable_sampling); EXPECT_FALSE(options.enable_systrace); - options = TraceOptions("enable-systrace,record-continuously"); + EXPECT_TRUE(options.SetFromString("enable-systrace,record-continuously")); EXPECT_EQ(RECORD_CONTINUOUSLY, options.record_mode); EXPECT_FALSE(options.enable_sampling); EXPECT_TRUE(options.enable_systrace); - options = TraceOptions("enable-systrace, trace-to-console,enable-sampling"); + EXPECT_TRUE(options.SetFromString( + "enable-systrace, trace-to-console,enable-sampling")); EXPECT_EQ(ECHO_TO_CONSOLE, options.record_mode); EXPECT_TRUE(options.enable_sampling); EXPECT_TRUE(options.enable_systrace); - options = - TraceOptions("record-continuously,record-until-full,trace-to-console"); + EXPECT_TRUE(options.SetFromString( + "record-continuously,record-until-full,trace-to-console")); EXPECT_EQ(ECHO_TO_CONSOLE, options.record_mode); EXPECT_FALSE(options.enable_systrace); EXPECT_FALSE(options.enable_sampling); - options = TraceOptions(""); + EXPECT_TRUE(options.SetFromString("")); EXPECT_EQ(RECORD_UNTIL_FULL, options.record_mode); EXPECT_FALSE(options.enable_systrace); EXPECT_FALSE(options.enable_sampling); -#if GTEST_HAS_EXCEPTIONS - EXPECT_THROW(TraceOptions("foo-bar-baz"), int); -#endif + EXPECT_FALSE(options.SetFromString("foo-bar-baz")); } TEST(TraceOptionsTest, TraceOptionsToString) { @@ -3066,7 +3066,8 @@ TEST(TraceOptionsTest, TraceOptionsToString) { TraceOptions original_option = TraceOptions(modes[i]); original_option.enable_sampling = enable_sampling_options[j]; original_option.enable_systrace = enable_systrace_options[k]; - TraceOptions new_options = TraceOptions(original_option.ToString()); + TraceOptions new_options; + EXPECT_TRUE(new_options.SetFromString(original_option.ToString())); EXPECT_EQ(original_option.record_mode, new_options.record_mode); EXPECT_EQ(original_option.enable_sampling, new_options.enable_sampling); EXPECT_EQ(original_option.enable_systrace, new_options.enable_systrace); |