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

Side by Side Diff: chrome/common/extensions/feature_switch_unittest.cc

Issue 2060803002: Use separate time values for 32 and 64 bit systems in feature tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TODO added Created 4 years, 6 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
« no previous file with comments | « no previous file | 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) 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 "extensions/common/feature_switch.h" 5 #include "extensions/common/feature_switch.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 using extensions::FeatureSwitch; 11 using extensions::FeatureSwitch;
12 12
13 namespace { 13 namespace {
14 14
15 const char kSwitchName[] = "test-switch"; 15 const char kSwitchName[] = "test-switch";
16 const char kFieldTrialName[] = "field-trial"; 16 const char kFieldTrialName[] = "field-trial";
17 17
18 // Create and register a field trial that will always return the given 18 // Create and register a field trial that will always return the given
19 // |group_name|. 19 // |group_name|.
20 scoped_refptr<base::FieldTrial> CreateFieldTrial( 20 scoped_refptr<base::FieldTrial> CreateFieldTrial(
21 const std::string& group_name) { 21 const std::string& group_name) {
22 const int kTotalProbability = 10; 22 const int kTotalProbability = 10;
23 // Note: This code will probably fail in the year 5000. But all the cycles we 23 // Note: This code will probably fail in the year 5000. But all the cycles we
24 // save in the next 3000 years by not determining the current year will be 24 // save in the next 3000 years by not determining the current year will be
25 // worth it. 25 // worth it.
26 scoped_refptr<base::FieldTrial> trial = 26 scoped_refptr<base::FieldTrial> trial =
27 base::FieldTrialList::FactoryGetFieldTrial( 27 base::FieldTrialList::FactoryGetFieldTrial(
28 kFieldTrialName, kTotalProbability, "default", 5000, 1, 1, 28 kFieldTrialName, kTotalProbability, "default",
29 base::FieldTrial::SESSION_RANDOMIZED, nullptr); 29 // TODO(maksims): remove architecture check
30 // in the future. https://crbug.com/619828
31 #if defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)
32 5000,
33 #else
34 2038,
35 #endif
36 1, 1, base::FieldTrial::SESSION_RANDOMIZED, nullptr);
30 trial->AppendGroup(group_name, kTotalProbability); 37 trial->AppendGroup(group_name, kTotalProbability);
31 return trial; 38 return trial;
32 } 39 }
33 40
34 template<FeatureSwitch::DefaultValue T> 41 template<FeatureSwitch::DefaultValue T>
35 class FeatureSwitchTest : public testing::Test { 42 class FeatureSwitchTest : public testing::Test {
36 public: 43 public:
37 FeatureSwitchTest() 44 FeatureSwitchTest()
38 : command_line_(base::CommandLine::NO_PROGRAM), 45 : command_line_(base::CommandLine::NO_PROGRAM),
39 feature_(&command_line_, kSwitchName, T) {} 46 feature_(&command_line_, kSwitchName, T) {}
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 280 }
274 281
275 { 282 {
276 // A default-disabled switch should remain disabled. 283 // A default-disabled switch should remain disabled.
277 FeatureSwitch default_disabled_switch(&command_line_, kSwitchName, 284 FeatureSwitch default_disabled_switch(&command_line_, kSwitchName,
278 kFieldTrialName, 285 kFieldTrialName,
279 FeatureSwitch::DEFAULT_DISABLED); 286 FeatureSwitch::DEFAULT_DISABLED);
280 EXPECT_FALSE(default_disabled_switch.IsEnabled()); 287 EXPECT_FALSE(default_disabled_switch.IsEnabled());
281 } 288 }
282 } 289 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698