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

Side by Side Diff: chrome/browser/instant/instant_field_trial.cc

Issue 9705074: Supporting command line argument to force field trials (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 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
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 "chrome/browser/instant/instant_field_trial.h" 5 #include "chrome/browser/instant/instant_field_trial.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 "chrome/browser/metrics/metrics_service.h" 9 #include "chrome/browser/metrics/metrics_service.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 14
15 namespace { 15 namespace {
16 16
17 // Field trial IDs of the control and experiment groups. Though they are not 17 // Field trial IDs of the control and experiment groups. Though they are not
18 // literally "const", they are set only once, in Activate() below. See the .h 18 // literally "const", they are set only once, in Activate() below. See the .h
19 // file for what these groups represent. 19 // file for what these groups represent.
20 int g_instant = 0; 20 int g_instant = 0;
21 int g_suggest = 0; 21 int g_suggest = 0;
22 int g_hidden = 0; 22 int g_hidden = 0;
23 int g_silent = 0; 23 int g_silent = 0;
24 int g_control = 0; 24 int g_control = 0;
25 25
26 } 26 }
27 27
28 // static 28 // static
29 void InstantFieldTrial::Activate() { 29 void InstantFieldTrial::Activate() {
30 scoped_refptr<base::FieldTrial> trial( 30 scoped_refptr<base::FieldTrial> trial(base::FieldTrial::CreateInstance(
31 new base::FieldTrial("Instant", 1000, "Inactive", 2013, 7, 1)); 31 "Instant", 1000, "Inactive", 2013, 7, 1));
32 32
33 // Try to give the user a consistent experience, if possible. 33 // Try to give the user a consistent experience, if possible.
34 if (base::FieldTrialList::IsOneTimeRandomizationEnabled()) 34 if (base::FieldTrialList::IsOneTimeRandomizationEnabled())
35 trial->UseOneTimeRandomization(); 35 trial->UseOneTimeRandomization();
36 36
37 g_instant = trial->AppendGroup("Instant", 10); // 1% 37 g_instant = trial->AppendGroup("Instant", 10); // 1%
38 g_suggest = trial->AppendGroup("Suggest", 10); // 1% 38 g_suggest = trial->AppendGroup("Suggest", 10); // 1%
39 g_hidden = trial->AppendGroup("Hidden", 960); // 96% 39 g_hidden = trial->AppendGroup("Hidden", 960); // 96%
40 g_silent = trial->AppendGroup("Silent", 10); // 1% 40 g_silent = trial->AppendGroup("Silent", 10); // 1%
41 g_control = trial->AppendGroup("Control", 10); // 1% 41 g_control = trial->AppendGroup("Control", 10); // 1%
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 NOTREACHED(); 143 NOTREACHED();
144 return std::string(); 144 return std::string();
145 } 145 }
146 146
147 // static 147 // static
148 bool InstantFieldTrial::ShouldSetSuggestedText(Profile* profile) { 148 bool InstantFieldTrial::ShouldSetSuggestedText(Profile* profile) {
149 Group group = GetGroup(profile); 149 Group group = GetGroup(profile);
150 return group != HIDDEN && group != SILENT; 150 return group != HIDDEN && group != SILENT;
151 } 151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698