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

Side by Side Diff: base/field_trial_unittest.cc

Issue 18535: Decrements FieldTrialList::constructor_count_ in the destructor. I'm... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/field_trial.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « base/field_trial.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698