OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Test of FieldTrial class | 5 // Test of FieldTrial class |
6 | 6 |
7 #include "base/field_trial.h" | 7 #include "base/field_trial.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 class FieldTrialTest : public testing::Test { | 12 class FieldTrialTest : public testing::Test { |
13 public: | 13 public: |
14 FieldTrialTest() : trial_list_() { } | 14 FieldTrialTest() : trial_list_() { } |
15 ~FieldTrialTest() { FieldTrialList::ResetConstructorCountForTestingOnly(); } | |
16 | 15 |
17 private: | 16 private: |
18 FieldTrialList trial_list_; | 17 FieldTrialList trial_list_; |
19 }; | 18 }; |
20 | 19 |
21 // Test registration, and also check that destructors are called for trials | 20 // Test registration, and also check that destructors are called for trials |
22 // (and that Purify doesn't catch us leaking). | 21 // (and that Purify doesn't catch us leaking). |
23 TEST_F(FieldTrialTest, Registration) { | 22 TEST_F(FieldTrialTest, Registration) { |
24 const wchar_t* name1 = L"name 1 test"; | 23 const wchar_t* name1 = L"name 1 test"; |
25 const wchar_t* name2 = L"name 2 test"; | 24 const wchar_t* name2 = L"name 2 test"; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 false_event_seen = true; | 64 false_event_seen = true; |
66 } | 65 } |
67 if (false_event_seen && true_event_seen) | 66 if (false_event_seen && true_event_seen) |
68 return; // Successful test!!! | 67 return; // Successful test!!! |
69 } | 68 } |
70 // Very surprising to get here. Probability should be around 1 in 2 ** 250. | 69 // Very surprising to get here. Probability should be around 1 in 2 ** 250. |
71 // One of the following will fail. | 70 // One of the following will fail. |
72 EXPECT_TRUE(false_event_seen); | 71 EXPECT_TRUE(false_event_seen); |
73 EXPECT_TRUE(true_event_seen); | 72 EXPECT_TRUE(true_event_seen); |
74 } | 73 } |
OLD | NEW |