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

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

Issue 7461075: Revert 94073 (broke a ton of tests) - Introduce a field trial for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 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
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/instant/instant_field_trial.h"
6
7 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/pref_names.h"
10
11 // static
12 InstantFieldTrial::Group InstantFieldTrial::GetGroup(Profile* profile) {
13 if (profile->IsOffTheRecord())
14 return INACTIVE;
15
16 const PrefService* prefs = profile->GetPrefs();
17 if (!prefs ||
18 prefs->GetBoolean(prefs::kInstantEnabledOnce) ||
19 prefs->IsManagedPreference(prefs::kInstantEnabled)) {
20 return INACTIVE;
21 }
22
23 const int random = prefs->GetInteger(prefs::kInstantFieldTrialRandomDraw);
24 return random < 4500 ? CONTROL1 : // 45%
25 random < 9000 ? CONTROL2 : // 45%
26 random < 9500 ? EXPERIMENT1 // 5%
27 : EXPERIMENT2; // 5%
28 }
29
30 // static
31 bool InstantFieldTrial::IsExperimentGroup(Profile* profile) {
32 Group group = GetGroup(profile);
33 return group == EXPERIMENT1 || group == EXPERIMENT2;
34 }
35
36 // static
37 std::string InstantFieldTrial::GetGroupName(Profile* profile) {
38 switch (GetGroup(profile)) {
39 case INACTIVE: return "InstantInactive";
40 case CONTROL1: return "InstantControl1";
41 case CONTROL2: return "InstantControl2";
42 case EXPERIMENT1: return "InstantExperiment1";
43 case EXPERIMENT2: return "InstantExperiment2";
44 }
45 NOTREACHED();
46 return "InstantUnknown";
47 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_field_trial.h ('k') | chrome/browser/resources/options/browser_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698