OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/debug/trace_event_unittest.h" | 5 #include "base/debug/trace_event_unittest.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2988 filter1.Merge(filter2); | 2988 filter1.Merge(filter2); |
2989 EXPECT_EQ(2u, filter1.GetSyntheticDelayValues().size()); | 2989 EXPECT_EQ(2u, filter1.GetSyntheticDelayValues().size()); |
2990 } | 2990 } |
2991 | 2991 |
2992 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { | 2992 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { |
2993 const char config[] = "DELAY(test.Delay;16;oneshot)"; | 2993 const char config[] = "DELAY(test.Delay;16;oneshot)"; |
2994 CategoryFilter filter(config); | 2994 CategoryFilter filter(config); |
2995 EXPECT_EQ(config, filter.ToString()); | 2995 EXPECT_EQ(config, filter.ToString()); |
2996 } | 2996 } |
2997 | 2997 |
2998 TEST(TraceOptionsTest, TraceOptionsFromString) { | 2998 TEST(TraceOptionsTest, DISABLED_TraceOptionsFromString) { |
2999 TraceOptions options = TraceOptions("record-until-full"); | 2999 TraceOptions options = TraceOptions("record-until-full"); |
3000 EXPECT_EQ(RECORD_UNTIL_FULL, options.record_mode); | 3000 EXPECT_EQ(RECORD_UNTIL_FULL, options.record_mode); |
3001 EXPECT_FALSE(options.enable_sampling); | 3001 EXPECT_FALSE(options.enable_sampling); |
3002 EXPECT_FALSE(options.enable_systrace); | 3002 EXPECT_FALSE(options.enable_systrace); |
3003 | 3003 |
3004 options = TraceOptions(RECORD_CONTINUOUSLY); | 3004 options = TraceOptions(RECORD_CONTINUOUSLY); |
3005 EXPECT_EQ(RECORD_CONTINUOUSLY, options.record_mode); | 3005 EXPECT_EQ(RECORD_CONTINUOUSLY, options.record_mode); |
3006 EXPECT_FALSE(options.enable_sampling); | 3006 EXPECT_FALSE(options.enable_sampling); |
3007 EXPECT_FALSE(options.enable_systrace); | 3007 EXPECT_FALSE(options.enable_systrace); |
3008 | 3008 |
(...skipping 26 matching lines...) Expand all Loading... |
3035 options = TraceOptions(""); | 3035 options = TraceOptions(""); |
3036 EXPECT_EQ(RECORD_UNTIL_FULL, options.record_mode); | 3036 EXPECT_EQ(RECORD_UNTIL_FULL, options.record_mode); |
3037 EXPECT_FALSE(options.enable_systrace); | 3037 EXPECT_FALSE(options.enable_systrace); |
3038 EXPECT_FALSE(options.enable_sampling); | 3038 EXPECT_FALSE(options.enable_sampling); |
3039 | 3039 |
3040 #if GTEST_HAS_EXCEPTIONS | 3040 #if GTEST_HAS_EXCEPTIONS |
3041 EXPECT_THROW(TraceOptions("foo-bar-baz"), int); | 3041 EXPECT_THROW(TraceOptions("foo-bar-baz"), int); |
3042 #endif | 3042 #endif |
3043 } | 3043 } |
3044 | 3044 |
3045 TEST(TraceOptionsTest, DISABLED_TraceOptionsToString) { | 3045 TEST(TraceOptionsTest, TraceOptionsToString) { |
3046 // Test that we can intialize TraceOptions from a string got from | 3046 // Test that we can intialize TraceOptions from a string got from |
3047 // TraceOptions.ToString() method to get a same TraceOptions. | 3047 // TraceOptions.ToString() method to get a same TraceOptions. |
3048 TraceRecordMode modes[] = { | 3048 TraceRecordMode modes[] = { |
3049 RECORD_UNTIL_FULL, RECORD_CONTINUOUSLY, ECHO_TO_CONSOLE}; | 3049 RECORD_UNTIL_FULL, RECORD_CONTINUOUSLY, ECHO_TO_CONSOLE}; |
3050 bool enable_sampling_options[] = {true, false}; | 3050 bool enable_sampling_options[] = {true, false}; |
3051 bool enable_systrace_options[] = {true, false}; | 3051 bool enable_systrace_options[] = {true, false}; |
3052 | 3052 |
3053 for (int i = 0; i < 3; ++i) { | 3053 for (int i = 0; i < 3; ++i) { |
3054 for (int j = 0; j < 2; ++j) { | 3054 for (int j = 0; j < 2; ++j) { |
3055 for (int k = 0; k < 2; ++k) { | 3055 for (int k = 0; k < 2; ++k) { |
3056 TraceOptions original_option = TraceOptions(modes[i]); | 3056 TraceOptions original_option = TraceOptions(modes[i]); |
3057 original_option.enable_sampling = enable_sampling_options[j]; | 3057 original_option.enable_sampling = enable_sampling_options[j]; |
3058 original_option.enable_systrace = enable_systrace_options[k]; | 3058 original_option.enable_systrace = enable_systrace_options[k]; |
3059 TraceOptions new_options = TraceOptions(original_option.ToString()); | 3059 TraceOptions new_options = TraceOptions(original_option.ToString()); |
3060 EXPECT_EQ(original_option.record_mode, new_options.record_mode); | 3060 EXPECT_EQ(original_option.record_mode, new_options.record_mode); |
3061 EXPECT_EQ(original_option.enable_sampling, new_options.enable_sampling); | 3061 EXPECT_EQ(original_option.enable_sampling, new_options.enable_sampling); |
3062 EXPECT_EQ(original_option.enable_systrace, new_options.enable_systrace); | 3062 EXPECT_EQ(original_option.enable_systrace, new_options.enable_systrace); |
3063 } | 3063 } |
3064 } | 3064 } |
3065 } | 3065 } |
3066 } | 3066 } |
3067 | 3067 |
3068 | 3068 |
3069 } // namespace debug | 3069 } // namespace debug |
3070 } // namespace base | 3070 } // namespace base |
OLD | NEW |