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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/stringprintf.h" 6 #include "base/stringprintf.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/autocomplete/autocomplete_edit.h" 8 #include "chrome/browser/autocomplete/autocomplete_edit.h"
9 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "chrome/browser/instant/instant_controller.h" 10 #include "chrome/browser/instant/instant_controller.h"
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 // Press <Enter> in the omnibox, causing the preview to be committed. 926 // Press <Enter> in the omnibox, causing the preview to be committed.
927 TabContents* preview_tab = preview()->tab_contents(); 927 TabContents* preview_tab = preview()->tab_contents();
928 ASSERT_TRUE(PressEnter()); 928 ASSERT_TRUE(PressEnter());
929 929
930 // The preview contents should now be the active tab contents. 930 // The preview contents should now be the active tab contents.
931 EXPECT_FALSE(preview()); 931 EXPECT_FALSE(preview());
932 EXPECT_FALSE(instant()->is_displayable()); 932 EXPECT_FALSE(instant()->is_displayable());
933 EXPECT_FALSE(instant()->IsCurrent()); 933 EXPECT_FALSE(instant()->IsCurrent());
934 EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents()); 934 EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents());
935 } 935 }
936
937 // Tests the SUGGEST experiment of the field trial.
938 class InstantFieldTrialSuggestTest : public InstantTest {
939 public:
940 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
941 command_line->AppendSwitchASCII(switches::kInstantFieldTrial,
942 switches::kInstantFieldTrialSuggest);
943 }
944 };
945
946 // Tests that instant is active, even without calling EnableInstant().
947 IN_PROC_BROWSER_TEST_F(InstantFieldTrialSuggestTest, MAYBE(ExperimentEnabled)) {
948 // Check that instant is enabled, despite not setting the preference.
949 Profile* profile = browser()->profile();
950 EXPECT_FALSE(profile->GetPrefs()->GetBoolean(prefs::kInstantEnabled));
951 EXPECT_TRUE(InstantController::IsEnabled(profile));
952
953 ASSERT_TRUE(test_server()->Start());
954 SetupInstantProvider("instant.html");
955 DetermineInstantSupport();
956
957 // Type into the omnibox, but don't press <Enter> yet.
958 omnibox()->SetUserText(ASCIIToUTF16("def"));
959 ASSERT_TRUE(WaitForMessageToBeProcessedByRenderer());
960
961 // Check that instant is active, but the preview is not showing.
962 EXPECT_TRUE(preview());
963 EXPECT_TRUE(loader()->ready());
964 EXPECT_FALSE(instant()->is_displayable());
965 EXPECT_FALSE(instant()->IsCurrent());
966
967 // Check that the suggested text has actually been set in the omnibox.
968 EXPECT_EQ("defghi", GetSuggestion());
969 EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText()));
970
971 // Press <Enter> in the omnibox, causing the preview to be committed.
972 TabContents* preview_tab = preview()->tab_contents();
973 ASSERT_TRUE(PressEnter());
974
975 // The preview contents should now be the active tab contents.
976 EXPECT_FALSE(preview());
977 EXPECT_FALSE(instant()->is_displayable());
978 EXPECT_FALSE(instant()->IsCurrent());
979 EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents());
980 }
OLDNEW
« 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