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

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

Issue 7337007: Introduce a field trial for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Diff against 7396025 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 std::string InstantFieldTrial::GetGroupName(Profile* profile) {
32 switch (GetGroup(profile)) {
33 case INACTIVE: return "InstantInactive";
34 case CONTROL1: return "InstantControl1";
35 case CONTROL2: return "InstantControl2";
36 case EXPERIMENT1: return "InstantExperiment1";
37 case EXPERIMENT2: return "InstantExperiment2";
38 }
39 NOTREACHED();
40 return "InstantUnknown";
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698