Commit f679716b authored by sreeram@chromium.org's avatar sreeram@chromium.org

Add a new field trial for Instant.

In this mode, we issue queries as the user types, but don't show the preview.
The name HIDDEN seems more appropriate here, so I've usurped that name for this
trial, renaming the earlier one to SILENT (since it doesn't speak the queries
over the wire).

BUG=none
TEST=interactive_ui_tests InstantFieldTrial*

Review URL: http://codereview.chromium.org/8370020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107053 0039d316-1c4b-4281-b951-d872f2087c98
parent a50af29a
...@@ -208,6 +208,14 @@ class InstantTest : public InProcessBrowserTest { ...@@ -208,6 +208,14 @@ class InstantTest : public InProcessBrowserTest {
browser()->instant()->loader_.get()->url() : GURL(); browser()->instant()->loader_.get()->url() : GURL();
} }
bool LoaderIsReady() const {
return browser()->instant()->loader_->ready();
}
const string16& GetUserText() const {
return browser()->instant()->loader_->user_text();
}
void SendKey(ui::KeyboardCode key) { void SendKey(ui::KeyboardCode key) {
ASSERT_TRUE(ui_test_utils::SendKeyPressSync( ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
browser(), key, false, false, false, false)); browser(), key, false, false, false, false));
...@@ -991,6 +999,67 @@ IN_PROC_BROWSER_TEST_F(InstantFieldTrialHiddenTest, MAYBE_ExperimentEnabled) { ...@@ -991,6 +999,67 @@ IN_PROC_BROWSER_TEST_F(InstantFieldTrialHiddenTest, MAYBE_ExperimentEnabled) {
TabContentsWrapper* tab_contents = browser()->instant()->GetPreviewContents(); TabContentsWrapper* tab_contents = browser()->instant()->GetPreviewContents();
EXPECT_TRUE(tab_contents); EXPECT_TRUE(tab_contents);
// Wait for the underlying loader to finish processing.
WaitForMessageToBeProcessedByRenderer(tab_contents);
EXPECT_STR_EQ("def", location_bar_->location_entry()->GetText());
EXPECT_STR_EQ("defghi", GetUserText());
EXPECT_TRUE(LoaderIsReady());
// Press <Enter> in the omnibox, causing the preview to be committed.
SendKey(ui::VKEY_RETURN);
// The preview contents should now be the active tab contents.
EXPECT_FALSE(browser()->instant()->GetPreviewContents());
EXPECT_FALSE(HasPreview());
EXPECT_FALSE(browser()->instant()->is_displayable());
EXPECT_FALSE(browser()->instant()->IsCurrent());
EXPECT_EQ(tab_contents, browser()->GetSelectedTabContentsWrapper());
}
// Tests the SILENT experiment of the field trial.
class InstantFieldTrialSilentTest : public InstantTest {
public:
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
command_line->AppendSwitchASCII(switches::kInstantFieldTrial,
switches::kInstantFieldTrialSilent);
}
};
// Tests that instant is active, even without calling EnableInstant().
IN_PROC_BROWSER_TEST_F(InstantFieldTrialSilentTest, MAYBE_ExperimentEnabled) {
// Check that instant is enabled, despite not setting the preference.
Profile* profile = browser()->profile();
EXPECT_FALSE(profile->GetPrefs()->GetBoolean(prefs::kInstantEnabled));
EXPECT_TRUE(InstantController::IsEnabled(profile));
ASSERT_TRUE(test_server()->Start());
SetupInstantProvider("search.html");
ui_test_utils::WindowedNotificationObserver instant_support_observer(
chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED,
content::NotificationService::AllSources());
SetupLocationBar();
WaitForPreviewToNavigate();
instant_support_observer.Wait();
// Type into the omnibox, but don't press <Enter> yet.
location_bar_->location_entry()->SetUserText(UTF8ToUTF16("def"));
// Check that instant is active, but the preview is not showing.
EXPECT_TRUE(HasPreview());
EXPECT_FALSE(browser()->instant()->is_displayable());
EXPECT_FALSE(browser()->instant()->IsCurrent());
TabContentsWrapper* tab_contents = browser()->instant()->GetPreviewContents();
EXPECT_TRUE(tab_contents);
// Wait for the underlying loader to finish processing.
WaitForMessageToBeProcessedByRenderer(tab_contents);
EXPECT_STR_EQ("def", location_bar_->location_entry()->GetText());
EXPECT_STR_EQ("", GetUserText());
EXPECT_FALSE(LoaderIsReady());
// Press <Enter> in the omnibox, causing the preview to be committed. // Press <Enter> in the omnibox, causing the preview to be committed.
SendKey(ui::VKEY_RETURN); SendKey(ui::VKEY_RETURN);
...@@ -1002,8 +1071,8 @@ IN_PROC_BROWSER_TEST_F(InstantFieldTrialHiddenTest, MAYBE_ExperimentEnabled) { ...@@ -1002,8 +1071,8 @@ IN_PROC_BROWSER_TEST_F(InstantFieldTrialHiddenTest, MAYBE_ExperimentEnabled) {
EXPECT_EQ(tab_contents, browser()->GetSelectedTabContentsWrapper()); EXPECT_EQ(tab_contents, browser()->GetSelectedTabContentsWrapper());
} }
// Tests the SearchToNonSearch scenario under the HIDDEN field trial. // Tests the SearchToNonSearch scenario under the SILENT field trial.
IN_PROC_BROWSER_TEST_F(InstantFieldTrialHiddenTest, MAYBE_SearchToNonSearch) { IN_PROC_BROWSER_TEST_F(InstantFieldTrialSilentTest, MAYBE_SearchToNonSearch) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
ui_test_utils::WindowedNotificationObserver instant_support_observer( ui_test_utils::WindowedNotificationObserver instant_support_observer(
chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED, chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED,
......
...@@ -175,8 +175,8 @@ bool InstantController::Update(TabContentsWrapper* tab_contents, ...@@ -175,8 +175,8 @@ bool InstantController::Update(TabContentsWrapper* tab_contents,
// trial to normal mode, with no intervening call to DestroyPreviewContents(). // trial to normal mode, with no intervening call to DestroyPreviewContents().
// This would leave the loader in a weird state, which would manifest if the // This would leave the loader in a weird state, which would manifest if the
// user pressed <Enter> without calling Update(). TODO(sreeram): Handle it. // user pressed <Enter> without calling Update(). TODO(sreeram): Handle it.
if (InstantFieldTrial::IsHiddenExperiment(tab_contents->profile())) { if (InstantFieldTrial::IsSilentExperiment(tab_contents->profile())) {
// For the HIDDEN field trial we process |user_text| at commit time, which // For the SILENT field trial we process |user_text| at commit time, which
// means we're never really out of date. // means we're never really out of date.
is_out_of_date_ = false; is_out_of_date_ = false;
loader_->MaybeLoadInstantURL(tab_contents, template_url); loader_->MaybeLoadInstantURL(tab_contents, template_url);
...@@ -236,9 +236,12 @@ bool InstantController::PrepareForCommit() { ...@@ -236,9 +236,12 @@ bool InstantController::PrepareForCommit() {
if (is_out_of_date_ || !loader_.get()) if (is_out_of_date_ || !loader_.get())
return false; return false;
// If we are not in the HIDDEN field trial, return the status of the preview. // If we are not in the HIDDEN or SILENT field trials, return the status of
if (!InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile())) // the preview.
if (!InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile()) &&
!InstantFieldTrial::IsSilentExperiment(tab_contents_->profile())) {
return IsCurrent(); return IsCurrent();
}
TemplateURLService* model = TemplateURLServiceFactory::GetForProfile( TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(
tab_contents_->profile()); tab_contents_->profile());
...@@ -419,7 +422,10 @@ void InstantController::SetSuggestedTextFor( ...@@ -419,7 +422,10 @@ void InstantController::SetSuggestedTextFor(
InstantLoader* loader, InstantLoader* loader,
const string16& text, const string16& text,
InstantCompleteBehavior behavior) { InstantCompleteBehavior behavior) {
delegate_->SetSuggestedText(text, behavior); if (!is_out_of_date_ &&
!InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile())) {
delegate_->SetSuggestedText(text, behavior);
}
} }
gfx::Rect InstantController::GetInstantBounds() { gfx::Rect InstantController::GetInstantBounds() {
...@@ -460,6 +466,11 @@ void InstantController::SwappedTabContents(InstantLoader* loader) { ...@@ -460,6 +466,11 @@ void InstantController::SwappedTabContents(InstantLoader* loader) {
} }
void InstantController::UpdateIsDisplayable() { void InstantController::UpdateIsDisplayable() {
if (!is_out_of_date_ &&
InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile())) {
return;
}
bool displayable = bool displayable =
(!is_out_of_date_ && loader_.get() && loader_->ready() && (!is_out_of_date_ && loader_.get() && loader_->ready() &&
loader_->http_status_ok()); loader_->http_status_ok());
...@@ -489,6 +500,9 @@ void InstantController::UpdateLoader(const TemplateURL* template_url, ...@@ -489,6 +500,9 @@ void InstantController::UpdateLoader(const TemplateURL* template_url,
loader_->Update(tab_contents_, template_url, url, transition_type, user_text, loader_->Update(tab_contents_, template_url, url, transition_type, user_text,
verbatim, suggested_text); verbatim, suggested_text);
UpdateIsDisplayable(); UpdateIsDisplayable();
// For the HIDDEN field trial, don't send back suggestions to the omnibox.
if (InstantFieldTrial::IsHiddenExperiment(tab_contents_->profile()))
suggested_text->clear();
} }
bool InstantController::ShouldUseInstant(const AutocompleteMatch& match) { bool InstantController::ShouldUseInstant(const AutocompleteMatch& match) {
......
...@@ -108,7 +108,7 @@ class InstantController : public InstantLoaderDelegate { ...@@ -108,7 +108,7 @@ class InstantController : public InstantLoaderDelegate {
// is used by Browser, when the user presses <Enter>, to decide whether to // is used by Browser, when the user presses <Enter>, to decide whether to
// load the omnibox contents through Instant or otherwise. This is needed // load the omnibox contents through Instant or otherwise. This is needed
// because calls to |Update| don't necessarily result in a preview being // because calls to |Update| don't necessarily result in a preview being
// shown, such as in the HIDDEN field trial. // shown, such as in the HIDDEN and SILENT field trials.
bool PrepareForCommit(); bool PrepareForCommit();
// Invoked when the user does some gesture that should trigger making the // Invoked when the user does some gesture that should trigger making the
......
...@@ -17,15 +17,17 @@ namespace { ...@@ -17,15 +17,17 @@ namespace {
// Field trial IDs of the control and experiment groups. Though they are not // Field trial IDs of the control and experiment groups. Though they are not
// literally "const", they are set only once, in Activate() below. See the .h // literally "const", they are set only once, in Activate() below. See the .h
// file for what these groups represent. // file for what these groups represent.
int g_instant_control_a = 0;
int g_instant_control_b = 0;
int g_instant_experiment_a = 0; int g_instant_experiment_a = 0;
int g_instant_experiment_b = 0; int g_instant_experiment_b = 0;
int g_hidden_control_a = 0;
int g_hidden_control_b = 0;
int g_hidden_experiment_a = 0; int g_hidden_experiment_a = 0;
int g_hidden_experiment_b = 0; int g_hidden_experiment_b = 0;
int g_silent_experiment_a = 0;
int g_silent_experiment_b = 0;
int g_uma_control_a = 0;
int g_uma_control_b = 0;
int g_all_control_a = 0;
int g_all_control_b = 0;
} }
...@@ -38,16 +40,18 @@ void InstantFieldTrial::Activate() { ...@@ -38,16 +40,18 @@ void InstantFieldTrial::Activate() {
if (base::FieldTrialList::IsOneTimeRandomizationEnabled()) if (base::FieldTrialList::IsOneTimeRandomizationEnabled())
trial->UseOneTimeRandomization(); trial->UseOneTimeRandomization();
// Each group is of size 5%. // Each group is of total size 10% (5% each for the _a and _b variants).
g_instant_control_a = trial->AppendGroup("InstantControlA", 50);
g_instant_control_b = trial->AppendGroup("InstantControlB", 50);
g_instant_experiment_a = trial->AppendGroup("InstantExperimentA", 50); g_instant_experiment_a = trial->AppendGroup("InstantExperimentA", 50);
g_instant_experiment_b = trial->AppendGroup("InstantExperimentB", 50); g_instant_experiment_b = trial->AppendGroup("InstantExperimentB", 50);
g_hidden_control_a = trial->AppendGroup("HiddenControlA", 50);
g_hidden_control_b = trial->AppendGroup("HiddenControlB", 50);
g_hidden_experiment_a = trial->AppendGroup("HiddenExperimentA", 50); g_hidden_experiment_a = trial->AppendGroup("HiddenExperimentA", 50);
g_hidden_experiment_b = trial->AppendGroup("HiddenExperimentB", 50); g_hidden_experiment_b = trial->AppendGroup("HiddenExperimentB", 50);
g_silent_experiment_a = trial->AppendGroup("SilentExperimentA", 50);
g_silent_experiment_b = trial->AppendGroup("SilentExperimentB", 50);
g_uma_control_a = trial->AppendGroup("UmaControlA", 50);
g_uma_control_b = trial->AppendGroup("UmaControlB", 50);
g_all_control_a = trial->AppendGroup("AllControlA", 50);
g_all_control_b = trial->AppendGroup("AllControlB", 50);
} }
// static // static
...@@ -60,6 +64,8 @@ InstantFieldTrial::Group InstantFieldTrial::GetGroup(Profile* profile) { ...@@ -60,6 +64,8 @@ InstantFieldTrial::Group InstantFieldTrial::GetGroup(Profile* profile) {
return INSTANT_EXPERIMENT_A; return INSTANT_EXPERIMENT_A;
else if (switch_value == switches::kInstantFieldTrialHidden) else if (switch_value == switches::kInstantFieldTrialHidden)
return HIDDEN_EXPERIMENT_A; return HIDDEN_EXPERIMENT_A;
else if (switch_value == switches::kInstantFieldTrialSilent)
return SILENT_EXPERIMENT_A;
else else
return INACTIVE; return INACTIVE;
} }
...@@ -70,42 +76,42 @@ InstantFieldTrial::Group InstantFieldTrial::GetGroup(Profile* profile) { ...@@ -70,42 +76,42 @@ InstantFieldTrial::Group InstantFieldTrial::GetGroup(Profile* profile) {
return INACTIVE; return INACTIVE;
} }
if (!profile) const PrefService* prefs = profile ? profile->GetPrefs() : NULL;
return INACTIVE;
const PrefService* prefs = profile->GetPrefs();
if (!prefs || if (!prefs ||
prefs->GetBoolean(prefs::kInstantEnabledOnce) || prefs->GetBoolean(prefs::kInstantEnabledOnce) ||
prefs->IsManagedPreference(prefs::kInstantEnabled)) { prefs->IsManagedPreference(prefs::kInstantEnabled)) {
return INACTIVE; return INACTIVE;
} }
// HIDDEN groups. // First, deal with the groups that don't require UMA opt-in.
if (group == g_hidden_control_a) if (group == g_silent_experiment_a)
return HIDDEN_CONTROL_A; return SILENT_EXPERIMENT_A;
if (group == g_hidden_control_b) if (group == g_silent_experiment_b)
return HIDDEN_CONTROL_B; return SILENT_EXPERIMENT_B;
if (group == g_hidden_experiment_a) if (group == g_all_control_a)
return HIDDEN_EXPERIMENT_A; return ALL_CONTROL_A;
if (group == g_hidden_experiment_b) if (group == g_all_control_b)
return HIDDEN_EXPERIMENT_B; return ALL_CONTROL_B;
// INSTANT group users must meet some extra requirements. // All other groups require UMA and suggest, else bounce back to INACTIVE.
if (profile->IsOffTheRecord() || if (profile->IsOffTheRecord() ||
!MetricsServiceHelper::IsMetricsReportingEnabled() || !MetricsServiceHelper::IsMetricsReportingEnabled() ||
!prefs->GetBoolean(prefs::kSearchSuggestEnabled)) { !prefs->GetBoolean(prefs::kSearchSuggestEnabled)) {
return INACTIVE; return INACTIVE;
} }
// INSTANT groups.
if (group == g_instant_control_a)
return INSTANT_CONTROL_A;
if (group == g_instant_control_b)
return INSTANT_CONTROL_B;
if (group == g_instant_experiment_a) if (group == g_instant_experiment_a)
return INSTANT_EXPERIMENT_A; return INSTANT_EXPERIMENT_A;
if (group == g_instant_experiment_b) if (group == g_instant_experiment_b)
return INSTANT_EXPERIMENT_B; return INSTANT_EXPERIMENT_B;
if (group == g_hidden_experiment_a)
return HIDDEN_EXPERIMENT_A;
if (group == g_hidden_experiment_b)
return HIDDEN_EXPERIMENT_B;
if (group == g_uma_control_a)
return UMA_CONTROL_A;
if (group == g_uma_control_b)
return UMA_CONTROL_B;
NOTREACHED(); NOTREACHED();
return INACTIVE; return INACTIVE;
...@@ -115,19 +121,20 @@ InstantFieldTrial::Group InstantFieldTrial::GetGroup(Profile* profile) { ...@@ -115,19 +121,20 @@ InstantFieldTrial::Group InstantFieldTrial::GetGroup(Profile* profile) {
bool InstantFieldTrial::IsExperimentGroup(Profile* profile) { bool InstantFieldTrial::IsExperimentGroup(Profile* profile) {
Group group = GetGroup(profile); Group group = GetGroup(profile);
return group == INSTANT_EXPERIMENT_A || group == INSTANT_EXPERIMENT_B || return group == INSTANT_EXPERIMENT_A || group == INSTANT_EXPERIMENT_B ||
group == HIDDEN_EXPERIMENT_A || group == HIDDEN_EXPERIMENT_B; group == HIDDEN_EXPERIMENT_A || group == HIDDEN_EXPERIMENT_B ||
group == SILENT_EXPERIMENT_A || group == SILENT_EXPERIMENT_B;
} }
// static // static
bool InstantFieldTrial::IsInstantExperiment(Profile* profile) { bool InstantFieldTrial::IsHiddenExperiment(Profile* profile) {
Group group = GetGroup(profile); Group group = GetGroup(profile);
return group == INSTANT_EXPERIMENT_A || group == INSTANT_EXPERIMENT_B; return group == HIDDEN_EXPERIMENT_A || group == HIDDEN_EXPERIMENT_B;
} }
// static // static
bool InstantFieldTrial::IsHiddenExperiment(Profile* profile) { bool InstantFieldTrial::IsSilentExperiment(Profile* profile) {
Group group = GetGroup(profile); Group group = GetGroup(profile);
return group == HIDDEN_EXPERIMENT_A || group == HIDDEN_EXPERIMENT_B; return group == SILENT_EXPERIMENT_A || group == SILENT_EXPERIMENT_B;
} }
// static // static
...@@ -135,15 +142,17 @@ std::string InstantFieldTrial::GetGroupName(Profile* profile) { ...@@ -135,15 +142,17 @@ std::string InstantFieldTrial::GetGroupName(Profile* profile) {
switch (GetGroup(profile)) { switch (GetGroup(profile)) {
case INACTIVE: return std::string(); case INACTIVE: return std::string();
case INSTANT_CONTROL_A: return "_InstantControlA";
case INSTANT_CONTROL_B: return "_InstantControlB";
case INSTANT_EXPERIMENT_A: return "_InstantExperimentA"; case INSTANT_EXPERIMENT_A: return "_InstantExperimentA";
case INSTANT_EXPERIMENT_B: return "_InstantExperimentB"; case INSTANT_EXPERIMENT_B: return "_InstantExperimentB";
case HIDDEN_CONTROL_A: return "_HiddenControlA";
case HIDDEN_CONTROL_B: return "_HiddenControlB";
case HIDDEN_EXPERIMENT_A: return "_HiddenExperimentA"; case HIDDEN_EXPERIMENT_A: return "_HiddenExperimentA";
case HIDDEN_EXPERIMENT_B: return "_HiddenExperimentB"; case HIDDEN_EXPERIMENT_B: return "_HiddenExperimentB";
case SILENT_EXPERIMENT_A: return "_SilentExperimentA";
case SILENT_EXPERIMENT_B: return "_SilentExperimentB";
case UMA_CONTROL_A: return "_UmaControlA";
case UMA_CONTROL_B: return "_UmaControlB";
case ALL_CONTROL_A: return "_AllControlA";
case ALL_CONTROL_B: return "_AllControlB";
} }
NOTREACHED(); NOTREACHED();
...@@ -155,15 +164,17 @@ std::string InstantFieldTrial::GetGroupAsUrlParam(Profile* profile) { ...@@ -155,15 +164,17 @@ std::string InstantFieldTrial::GetGroupAsUrlParam(Profile* profile) {
switch (GetGroup(profile)) { switch (GetGroup(profile)) {
case INACTIVE: return std::string(); case INACTIVE: return std::string();
case INSTANT_CONTROL_A: return "ix=ica&";
case INSTANT_CONTROL_B: return "ix=icb&";
case INSTANT_EXPERIMENT_A: return "ix=iea&"; case INSTANT_EXPERIMENT_A: return "ix=iea&";
case INSTANT_EXPERIMENT_B: return "ix=ieb&"; case INSTANT_EXPERIMENT_B: return "ix=ieb&";
case HIDDEN_CONTROL_A: return "ix=hca&";
case HIDDEN_CONTROL_B: return "ix=hcb&";
case HIDDEN_EXPERIMENT_A: return "ix=hea&"; case HIDDEN_EXPERIMENT_A: return "ix=hea&";
case HIDDEN_EXPERIMENT_B: return "ix=heb&"; case HIDDEN_EXPERIMENT_B: return "ix=heb&";
case SILENT_EXPERIMENT_A: return "ix=sea&";
case SILENT_EXPERIMENT_B: return "ix=seb&";
case UMA_CONTROL_A: return "ix=uca&";
case UMA_CONTROL_B: return "ix=ucb&";
case ALL_CONTROL_A: return "ix=aca&";
case ALL_CONTROL_B: return "ix=acb&";
} }
NOTREACHED(); NOTREACHED();
......
...@@ -19,19 +19,25 @@ class Profile; ...@@ -19,19 +19,25 @@ class Profile;
// Instant preference is respected. Incognito profiles are also INACTIVE. // Instant preference is respected. Incognito profiles are also INACTIVE.
// //
// The following mutually exclusive groups each select a small random sample of // The following mutually exclusive groups each select a small random sample of
// the remaining users: // the remaining users. Instant is enabled with preloading for the EXPERIMENT
// groups. It remains disabled, as is default, for the CONTROL groups.
// //
// INSTANT_EXPERIMENT: Instant is enabled, but only for search. Instant is also // INSTANT_EXPERIMENT: Queries are issued as the user types, and previews are
// preloaded. If the user hasn't opted to send metrics (UMA) data, they are // shown. If the user hasn't opted to send metrics (UMA) data, they are
// bounced back to INACTIVE. // bounced back to INACTIVE.
// //
// INSTANT_CONTROL: Instant remains disabled, as is default. If the user hasn't // HIDDEN_EXPERIMENT: Queries are issued as the user types, but no preview is
// opted to send metrics (UMA) data, they are bounced back to INACTIVE. // shown until they press <Enter>. If the user hasn't opted to send metrics
// (UMA) data, they are bounced back to INACTIVE.
// //
// HIDDEN_EXPERIMENT: Instant is enabled in "search only" mode, but queries are // SILENT_EXPERIMENT: No queries are issued until the user presses <Enter>. No
// issued only when the user presses <Enter>. No previews are shown. // previews are shown. The user is not required to send metrics (UMA) data.
// //
// HIDDEN_CONTROL: Instant remains disabled, as is default. // UMA_CONTROL: Instant is disabled. If the user hasn't opted to send metrics
// (UMA) data, they are bounced back to INACTIVE.
//
// ALL_CONTROL: Instant is disabled. The user is not required to send metrics
// (UMA) data.
// //
// Users not chosen into any of the above groups are INACTIVE. // Users not chosen into any of the above groups are INACTIVE.
// //
...@@ -43,15 +49,17 @@ class InstantFieldTrial { ...@@ -43,15 +49,17 @@ class InstantFieldTrial {
enum Group { enum Group {
INACTIVE, INACTIVE,
INSTANT_CONTROL_A,
INSTANT_CONTROL_B,
INSTANT_EXPERIMENT_A, INSTANT_EXPERIMENT_A,
INSTANT_EXPERIMENT_B, INSTANT_EXPERIMENT_B,
HIDDEN_CONTROL_A,
HIDDEN_CONTROL_B,
HIDDEN_EXPERIMENT_A, HIDDEN_EXPERIMENT_A,
HIDDEN_EXPERIMENT_B, HIDDEN_EXPERIMENT_B,
SILENT_EXPERIMENT_A,
SILENT_EXPERIMENT_B,
UMA_CONTROL_A,
UMA_CONTROL_B,
ALL_CONTROL_A,
ALL_CONTROL_B,
}; };
// Activate the field trial. Before this call, all calls to GetGroup will // Activate the field trial. Before this call, all calls to GetGroup will
...@@ -64,12 +72,12 @@ class InstantFieldTrial { ...@@ -64,12 +72,12 @@ class InstantFieldTrial {
// Check if the user is in one of the EXPERIMENT groups. // Check if the user is in one of the EXPERIMENT groups.
static bool IsExperimentGroup(Profile* profile); static bool IsExperimentGroup(Profile* profile);
// Check if the user is in the INSTANT_EXPERIMENT group.
static bool IsInstantExperiment(Profile* profile);
// Check if the user is in the HIDDEN_EXPERIMENT group. // Check if the user is in the HIDDEN_EXPERIMENT group.
static bool IsHiddenExperiment(Profile* profile); static bool IsHiddenExperiment(Profile* profile);
// Check if the user is in the SILENT EXPERIMENT group.
static bool IsSilentExperiment(Profile* profile);
// Returns a string describing the user's group. Can be added to histogram // Returns a string describing the user's group. Can be added to histogram
// names, to split histograms by field trial groups. // names, to split histograms by field trial groups.
static std::string GetGroupName(Profile* profile); static std::string GetGroupName(Profile* profile);
......
...@@ -692,6 +692,8 @@ const char kInstantFieldTrial[] = "instant-field-trial"; ...@@ -692,6 +692,8 @@ const char kInstantFieldTrial[] = "instant-field-trial";
const char kInstantFieldTrialHidden[] = "hidden"; const char kInstantFieldTrialHidden[] = "hidden";
// The field trial is forced into the INSTANT_EXPERIMENT group. // The field trial is forced into the INSTANT_EXPERIMENT group.
const char kInstantFieldTrialInstant[] = "instant"; const char kInstantFieldTrialInstant[] = "instant";
// The field trial is forced into the SILENT_EXPERIMENT group.
const char kInstantFieldTrialSilent[] = "silent";
// URL to use for instant. If specified this overrides the url from the // URL to use for instant. If specified this overrides the url from the
// TemplateURL. // TemplateURL.
......
...@@ -193,6 +193,7 @@ extern const char kIncognito[]; ...@@ -193,6 +193,7 @@ extern const char kIncognito[];
extern const char kInstantFieldTrial[]; extern const char kInstantFieldTrial[];
extern const char kInstantFieldTrialHidden[]; extern const char kInstantFieldTrialHidden[];
extern const char kInstantFieldTrialInstant[]; extern const char kInstantFieldTrialInstant[];
extern const char kInstantFieldTrialSilent[];
extern const char kInstantURL[]; extern const char kInstantURL[];
extern const char kKeepAliveForTest[]; extern const char kKeepAliveForTest[];
extern const char kLoadExtension[]; extern const char kLoadExtension[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment