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

Unified Diff: chrome/browser/instant/instant_browsertest.cc

Issue 8588003: Add a new field trial for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_browsertest.cc
diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc
index 778069983c8188362171b59142788c8b9a9ca451..a8859dd44fb3e8c58309759cd762f2bc9c299726 100644
--- a/chrome/browser/instant/instant_browsertest.cc
+++ b/chrome/browser/instant/instant_browsertest.cc
@@ -933,3 +933,48 @@ IN_PROC_BROWSER_TEST_F(InstantFieldTrialSilentTest, MAYBE(ExperimentEnabled)) {
EXPECT_FALSE(instant()->IsCurrent());
EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents());
}
+
+// Tests the SUGGEST experiment of the field trial.
+class InstantFieldTrialSuggestTest : public InstantTest {
+ public:
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+ command_line->AppendSwitchASCII(switches::kInstantFieldTrial,
+ switches::kInstantFieldTrialSuggest);
+ }
+};
+
+// Tests that instant is active, even without calling EnableInstant().
+IN_PROC_BROWSER_TEST_F(InstantFieldTrialSuggestTest, 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("instant.html");
+ DetermineInstantSupport();
+
+ // Type into the omnibox, but don't press <Enter> yet.
+ omnibox()->SetUserText(ASCIIToUTF16("def"));
+ ASSERT_TRUE(WaitForMessageToBeProcessedByRenderer());
+
+ // Check that instant is active, but the preview is not showing.
+ EXPECT_TRUE(preview());
+ EXPECT_TRUE(loader()->ready());
+ EXPECT_FALSE(instant()->is_displayable());
+ EXPECT_FALSE(instant()->IsCurrent());
+
+ // Check that the suggested text has actually been set in the omnibox.
+ EXPECT_EQ("defghi", GetSuggestion());
+ EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText()));
+
+ // Press <Enter> in the omnibox, causing the preview to be committed.
+ TabContents* preview_tab = preview()->tab_contents();
+ ASSERT_TRUE(PressEnter());
+
+ // The preview contents should now be the active tab contents.
+ EXPECT_FALSE(preview());
+ EXPECT_FALSE(instant()->is_displayable());
+ EXPECT_FALSE(instant()->IsCurrent());
+ EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents());
+}
« no previous file with comments | « no previous file | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698