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

Side by Side Diff: trunk/src/chrome/browser/ui/search/instant_extended_manual_interactive_uitest.cc

Issue 17444007: Revert 207790 "InstantExtended: Don't create overlay, again." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/strings/string_util.h" 5 #include "base/strings/string_util.h"
6 #include "chrome/browser/search/search.h" 6 #include "chrome/browser/search/search.h"
7 #include "chrome/browser/task_manager/task_manager.h" 7 #include "chrome/browser/task_manager/task_manager.h"
8 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" 8 #include "chrome/browser/task_manager/task_manager_browsertest_util.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 StartsWithASCII(test_info->name(), "DISABLED_", true)); 61 StartsWithASCII(test_info->name(), "DISABLED_", true));
62 // Make IsOffline() return false so we don't try to use the local overlay. 62 // Make IsOffline() return false so we don't try to use the local overlay.
63 disable_network_change_notifier_.reset( 63 disable_network_change_notifier_.reset(
64 new net::NetworkChangeNotifier::DisableForTest()); 64 new net::NetworkChangeNotifier::DisableForTest());
65 } 65 }
66 66
67 virtual void CleanUpOnMainThread() OVERRIDE { 67 virtual void CleanUpOnMainThread() OVERRIDE {
68 disable_network_change_notifier_.reset(); 68 disable_network_change_notifier_.reset();
69 } 69 }
70 70
71 void ResetInstant() {
72 set_browser(browser());
73 instant()->SetInstantEnabled(false, true);
74 instant()->SetInstantEnabled(true, false);
75
76 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
77 ASSERT_TRUE(IsGoogleOverlay());
78 ASSERT_TRUE(IsGoogleNTP());
79 }
80
71 protected: 81 protected:
72 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 82 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
73 chrome::EnableInstantExtendedAPIForTesting(); 83 chrome::EnableInstantExtendedAPIForTesting();
74 } 84 }
75 85
76 content::WebContents* active_tab() { 86 content::WebContents* active_tab() {
77 return browser()->tab_strip_model()->GetActiveWebContents(); 87 return browser()->tab_strip_model()->GetActiveWebContents();
78 } 88 }
79 89
80 bool PressBackspace() { 90 bool PressBackspace() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 "google.ac.gs().api.i()", selected); 128 "google.ac.gs().api.i()", selected);
119 } 129 }
120 130
121 bool IsGooglePage(content::WebContents* contents) { 131 bool IsGooglePage(content::WebContents* contents) {
122 bool is_google = false; 132 bool is_google = false;
123 if (!GetBoolFromJS(contents, "!!window.google", &is_google)) 133 if (!GetBoolFromJS(contents, "!!window.google", &is_google))
124 return false; 134 return false;
125 return is_google; 135 return is_google;
126 } 136 }
127 137
138 bool IsGoogleOverlay() {
139 return IsGooglePage(instant()->overlay()->contents());
140 }
141
142 bool IsGoogleNTP() {
143 return IsGooglePage(instant()->ntp()->contents());
144 }
145
128 private: 146 private:
129 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_proc_; 147 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_proc_;
130 scoped_ptr<net::ScopedDefaultHostResolverProc> scoped_host_resolver_proc_; 148 scoped_ptr<net::ScopedDefaultHostResolverProc> scoped_host_resolver_proc_;
131 scoped_ptr<net::NetworkChangeNotifier::DisableForTest> 149 scoped_ptr<net::NetworkChangeNotifier::DisableForTest>
132 disable_network_change_notifier_; 150 disable_network_change_notifier_;
133 }; 151 };
134 152
135 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_ShowsGoogleNTP) { 153 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest,
154 MANUAL_OmniboxFocusLoadsInstant) {
136 set_browser(browser()); 155 set_browser(browser());
137 instant()->SetInstantEnabled(false, true);
138 instant()->SetInstantEnabled(true, false);
139 FocusOmniboxAndWaitForInstantNTPSupport();
140 156
141 ui_test_utils::NavigateToURLWithDisposition( 157 // Explicitly unfocus the omnibox.
142 browser(), 158 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
143 GURL(chrome::kChromeUINewTabURL), 159 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER);
144 NEW_FOREGROUND_TAB, 160
145 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 161 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
146 content::WebContents* active_tab = 162 EXPECT_FALSE(omnibox()->model()->has_focus());
147 browser()->tab_strip_model()->GetActiveWebContents(); 163
148 EXPECT_TRUE(IsGooglePage(active_tab)); 164 // Delete any existing overlay.
165 instant()->overlay_.reset();
166 EXPECT_FALSE(instant()->GetOverlayContents());
167
168 // Refocus the omnibox. The InstantController should've preloaded Instant.
169 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
170 ASSERT_TRUE(IsGoogleOverlay());
171
172 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
173 EXPECT_TRUE(omnibox()->model()->has_focus());
174
175 // Check that the page supports Instant, but it isn't showing.
176 ASSERT_TRUE(instant()->overlay());
177 EXPECT_TRUE(instant()->overlay()->supports_instant());
178 EXPECT_FALSE(instant()->IsOverlayingSearchResults());
179 EXPECT_TRUE(instant()->model()->mode().is_default());
149 } 180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698