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

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

Issue 17413017: InstantExtended: Don't create overlay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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
81 protected: 71 protected:
82 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 72 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
83 chrome::EnableInstantExtendedAPIForTesting(); 73 chrome::EnableInstantExtendedAPIForTesting();
84 } 74 }
85 75
86 content::WebContents* active_tab() { 76 content::WebContents* active_tab() {
87 return browser()->tab_strip_model()->GetActiveWebContents(); 77 return browser()->tab_strip_model()->GetActiveWebContents();
88 } 78 }
89 79
90 bool PressBackspace() { 80 bool PressBackspace() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 "google.ac.gs().api.i()", selected); 118 "google.ac.gs().api.i()", selected);
129 } 119 }
130 120
131 bool IsGooglePage(content::WebContents* contents) { 121 bool IsGooglePage(content::WebContents* contents) {
132 bool is_google = false; 122 bool is_google = false;
133 if (!GetBoolFromJS(contents, "!!window.google", &is_google)) 123 if (!GetBoolFromJS(contents, "!!window.google", &is_google))
134 return false; 124 return false;
135 return is_google; 125 return is_google;
136 } 126 }
137 127
138 bool IsGoogleOverlay() {
139 return IsGooglePage(instant()->overlay()->contents());
140 }
141
142 bool IsGoogleNTP() {
143 return IsGooglePage(instant()->ntp()->contents());
144 }
145
146 private: 128 private:
147 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_proc_; 129 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_proc_;
148 scoped_ptr<net::ScopedDefaultHostResolverProc> scoped_host_resolver_proc_; 130 scoped_ptr<net::ScopedDefaultHostResolverProc> scoped_host_resolver_proc_;
149 scoped_ptr<net::NetworkChangeNotifier::DisableForTest> 131 scoped_ptr<net::NetworkChangeNotifier::DisableForTest>
150 disable_network_change_notifier_; 132 disable_network_change_notifier_;
151 }; 133 };
152 134
153 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, 135 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_ShowsGoogleNTP) {
154 MANUAL_OmniboxFocusLoadsInstant) {
155 set_browser(browser()); 136 set_browser(browser());
137 instant()->SetInstantEnabled(false, true);
138 instant()->SetInstantEnabled(true, false);
139 FocusOmniboxAndWaitForInstantNTPSupport();
156 140
157 // Explicitly unfocus the omnibox. 141 ui_test_utils::NavigateToURLWithDisposition(
158 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 142 browser(),
159 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); 143 GURL(chrome::kChromeUINewTabURL),
160 144 NEW_FOREGROUND_TAB,
161 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); 145 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
162 EXPECT_FALSE(omnibox()->model()->has_focus()); 146 content::WebContents* active_tab =
163 147 browser()->tab_strip_model()->GetActiveWebContents();
164 // Delete any existing overlay. 148 EXPECT_TRUE(IsGooglePage(active_tab));
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());
180 } 149 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_extended_interactive_uitest.cc ('k') | chrome/browser/ui/search/instant_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698