OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "chrome/browser/content_settings/host_content_settings_map.h" | 5 #include "chrome/browser/content_settings/host_content_settings_map.h" |
6 #include "chrome/browser/history/history_service_factory.h" | 6 #include "chrome/browser/history/history_service_factory.h" |
7 #include "chrome/browser/instant/instant_overlay.h" | 7 #include "chrome/browser/instant/instant_overlay.h" |
8 #include "chrome/browser/instant/instant_service.h" | 8 #include "chrome/browser/instant/instant_service.h" |
9 #include "chrome/browser/instant/instant_service_factory.h" | 9 #include "chrome/browser/instant/instant_service_factory.h" |
10 #include "chrome/browser/instant/instant_test_utils.h" | 10 #include "chrome/browser/instant/instant_test_utils.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 IN_PROC_BROWSER_TEST_F(InstantTest, OmniboxFocusLoadsInstant) { | 68 IN_PROC_BROWSER_TEST_F(InstantTest, OmniboxFocusLoadsInstant) { |
69 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 69 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
70 | 70 |
71 // Explicitly unfocus the omnibox. | 71 // Explicitly unfocus the omnibox. |
72 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 72 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
73 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); | 73 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); |
74 | 74 |
75 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); | 75 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); |
76 EXPECT_FALSE(omnibox()->model()->has_focus()); | 76 EXPECT_FALSE(omnibox()->model()->has_focus()); |
77 | 77 |
78 // Delete any existing preview. | 78 // Delete any existing overlay. |
79 instant()->overlay_.reset(); | 79 instant()->overlay_.reset(); |
80 EXPECT_FALSE(instant()->GetPreviewContents()); | 80 EXPECT_FALSE(instant()->GetOverlayContents()); |
81 | 81 |
82 // Refocus the omnibox. The InstantController should've preloaded Instant. | 82 // Refocus the omnibox. The InstantController should've preloaded Instant. |
83 FocusOmniboxAndWaitForInstantSupport(); | 83 FocusOmniboxAndWaitForInstantSupport(); |
84 | 84 |
85 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); | 85 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); |
86 EXPECT_TRUE(omnibox()->model()->has_focus()); | 86 EXPECT_TRUE(omnibox()->model()->has_focus()); |
87 | 87 |
88 content::WebContents* preview_tab = instant()->GetPreviewContents(); | 88 content::WebContents* overlay = instant()->GetOverlayContents(); |
89 EXPECT_TRUE(preview_tab); | 89 EXPECT_TRUE(overlay); |
90 | 90 |
91 // Check that the page supports Instant, but it isn't showing. | 91 // Check that the page supports Instant, but it isn't showing. |
92 EXPECT_TRUE(instant()->overlay_->supports_instant()); | 92 EXPECT_TRUE(instant()->overlay_->supports_instant()); |
93 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 93 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
94 EXPECT_TRUE(instant()->model()->mode().is_default()); | 94 EXPECT_TRUE(instant()->model()->mode().is_default()); |
95 | 95 |
96 // Adding a new tab shouldn't delete or recreate the preview; otherwise, | 96 // Adding a new tab shouldn't delete or recreate the overlay; otherwise, |
97 // what's the point of preloading? | 97 // what's the point of preloading? |
98 AddBlankTabAndShow(browser()); | 98 AddBlankTabAndShow(browser()); |
99 EXPECT_EQ(preview_tab, instant()->GetPreviewContents()); | 99 EXPECT_EQ(overlay, instant()->GetOverlayContents()); |
100 | 100 |
101 // Unfocusing and refocusing the omnibox should also preserve the preview. | 101 // Unfocusing and refocusing the omnibox should also preserve the overlay. |
102 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); | 102 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); |
103 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); | 103 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); |
104 | 104 |
105 FocusOmnibox(); | 105 FocusOmnibox(); |
106 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); | 106 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); |
107 | 107 |
108 EXPECT_EQ(preview_tab, instant()->GetPreviewContents()); | 108 EXPECT_EQ(overlay, instant()->GetOverlayContents()); |
109 | 109 |
110 // Doing a search should also use the same preloaded page. | 110 // Doing a search should also use the same preloaded page. |
111 SetOmniboxTextAndWaitForInstantToShow("query"); | 111 SetOmniboxTextAndWaitForOverlayToShow("query"); |
112 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); | 112 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); |
113 EXPECT_EQ(preview_tab, instant()->GetPreviewContents()); | 113 EXPECT_EQ(overlay, instant()->GetOverlayContents()); |
114 } | 114 } |
115 | 115 |
116 // Flakes on Windows and Mac: http://crbug.com/170677 | 116 // Flakes on Windows and Mac: http://crbug.com/170677 |
117 #if defined(OS_WIN) || defined(OS_MACOSX) | 117 #if defined(OS_WIN) || defined(OS_MACOSX) |
118 #define MAYBE_OnChangeEvent DISABLED_OnChangeEvent | 118 #define MAYBE_OnChangeEvent DISABLED_OnChangeEvent |
119 #else | 119 #else |
120 #define MAYBE_OnChangeEvent OnChangeEvent | 120 #define MAYBE_OnChangeEvent OnChangeEvent |
121 #endif | 121 #endif |
122 // Test that the onchange event is dispatched upon typing in the omnibox. | 122 // Test that the onchange event is dispatched upon typing in the omnibox. |
123 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_OnChangeEvent) { | 123 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_OnChangeEvent) { |
124 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 124 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
125 FocusOmniboxAndWaitForInstantSupport(); | 125 FocusOmniboxAndWaitForInstantSupport(); |
126 | 126 |
127 // Use the Instant page as the active tab, so we can exploit its visibility | 127 // Use the Instant page as the active tab, so we can exploit its visibility |
128 // handler to check visibility transitions. | 128 // handler to check visibility transitions. |
129 ui_test_utils::NavigateToURL(browser(), instant_url_); | 129 ui_test_utils::NavigateToURL(browser(), instant_url_); |
130 content::WebContents* active_tab = | 130 content::WebContents* active_tab = |
131 browser()->tab_strip_model()->GetActiveWebContents(); | 131 browser()->tab_strip_model()->GetActiveWebContents(); |
132 | 132 |
133 int active_tab_onvisibilitycalls = -1; | 133 int active_tab_onvisibilitycalls = -1; |
134 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", | 134 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", |
135 &active_tab_onvisibilitycalls)); | 135 &active_tab_onvisibilitycalls)); |
136 EXPECT_EQ(0, active_tab_onvisibilitycalls); | 136 EXPECT_EQ(0, active_tab_onvisibilitycalls); |
137 | 137 |
138 // Typing "query" into the omnibox causes one or more onchange events. The | 138 // Typing "query" into the omnibox causes one or more onchange events. The |
139 // page suggested "query suggestion" is inline autocompleted into the omnibox, | 139 // page suggested "query suggestion" is inline autocompleted into the omnibox, |
140 // causing another onchange event. | 140 // causing another onchange event. |
141 SetOmniboxTextAndWaitForInstantToShow("query"); | 141 SetOmniboxTextAndWaitForOverlayToShow("query"); |
142 EXPECT_EQ(ASCIIToUTF16("query suggestion"), omnibox()->GetText()); | 142 EXPECT_EQ(ASCIIToUTF16("query suggestion"), omnibox()->GetText()); |
143 int min_onchangecalls = 2; | 143 int min_onchangecalls = 2; |
144 | 144 |
145 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); | 145 EXPECT_TRUE(UpdateSearchState(instant()->GetOverlayContents())); |
146 EXPECT_LE(min_onchangecalls, onchangecalls_); | 146 EXPECT_LE(min_onchangecalls, onchangecalls_); |
147 min_onchangecalls = onchangecalls_; | 147 min_onchangecalls = onchangecalls_; |
148 | 148 |
149 // Change the query and confirm more onchange events are sent. | 149 // Change the query and confirm more onchange events are sent. |
150 SetOmniboxText("search"); | 150 SetOmniboxText("search"); |
151 ++min_onchangecalls; | 151 ++min_onchangecalls; |
152 | 152 |
153 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); | 153 EXPECT_TRUE(UpdateSearchState(instant()->GetOverlayContents())); |
154 EXPECT_LE(min_onchangecalls, onchangecalls_); | 154 EXPECT_LE(min_onchangecalls, onchangecalls_); |
155 | 155 |
156 // The preview was shown once, and the active tab was never hidden. | 156 // The overlay was shown once, and the active tab was never hidden. |
157 EXPECT_EQ(1, onvisibilitycalls_); | 157 EXPECT_EQ(1, onvisibilitycalls_); |
158 active_tab_onvisibilitycalls = -1; | 158 active_tab_onvisibilitycalls = -1; |
159 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", | 159 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", |
160 &active_tab_onvisibilitycalls)); | 160 &active_tab_onvisibilitycalls)); |
161 EXPECT_EQ(0, active_tab_onvisibilitycalls); | 161 EXPECT_EQ(0, active_tab_onvisibilitycalls); |
162 } | 162 } |
163 | 163 |
164 // Test that the onsubmit event is dispatched upon pressing Enter. | 164 // Test that the onsubmit event is dispatched upon pressing Enter. |
165 IN_PROC_BROWSER_TEST_F(InstantTest, OnSubmitEvent) { | 165 IN_PROC_BROWSER_TEST_F(InstantTest, OnSubmitEvent) { |
166 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 166 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
167 FocusOmniboxAndWaitForInstantSupport(); | 167 FocusOmniboxAndWaitForInstantSupport(); |
168 SetOmniboxTextAndWaitForInstantToShow("search"); | 168 SetOmniboxTextAndWaitForOverlayToShow("search"); |
169 | 169 |
170 // Stash a reference to the preview, so we can refer to it after commit. | 170 // Stash a reference to the overlay, so we can refer to it after commit. |
171 content::WebContents* preview_tab = instant()->GetPreviewContents(); | 171 content::WebContents* overlay = instant()->GetOverlayContents(); |
172 EXPECT_TRUE(preview_tab); | 172 EXPECT_TRUE(overlay); |
173 | 173 |
174 // The state of the searchbox before the commit. | 174 // The state of the searchbox before the commit. |
175 EXPECT_TRUE(UpdateSearchState(preview_tab)); | 175 EXPECT_TRUE(UpdateSearchState(overlay)); |
176 EXPECT_EQ("search", value_); | 176 EXPECT_EQ("search", value_); |
177 EXPECT_FALSE(verbatim_); | 177 EXPECT_FALSE(verbatim_); |
178 EXPECT_EQ(0, onsubmitcalls_); | 178 EXPECT_EQ(0, onsubmitcalls_); |
179 EXPECT_EQ(1, onvisibilitycalls_); | 179 EXPECT_EQ(1, onvisibilitycalls_); |
180 | 180 |
181 // Before the commit, the active tab is the NTP (i.e., not Instant). | 181 // Before the commit, the active tab is the NTP (i.e., not Instant). |
182 content::WebContents* active_tab = | 182 content::WebContents* active_tab = |
183 browser()->tab_strip_model()->GetActiveWebContents(); | 183 browser()->tab_strip_model()->GetActiveWebContents(); |
184 EXPECT_NE(preview_tab, active_tab); | 184 EXPECT_NE(overlay, active_tab); |
185 EXPECT_EQ(1, active_tab->GetController().GetEntryCount()); | 185 EXPECT_EQ(1, active_tab->GetController().GetEntryCount()); |
186 EXPECT_EQ(std::string(chrome::kAboutBlankURL), | 186 EXPECT_EQ(std::string(chrome::kAboutBlankURL), |
187 omnibox()->model()->PermanentURL().spec()); | 187 omnibox()->model()->PermanentURL().spec()); |
188 | 188 |
189 // Commit the search by pressing Enter. | 189 // Commit the search by pressing Enter. |
190 browser()->window()->GetLocationBar()->AcceptInput(); | 190 browser()->window()->GetLocationBar()->AcceptInput(); |
191 | 191 |
192 // After the commit, Instant should not be showing. | 192 // After the commit, Instant should not be showing. |
193 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 193 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
194 EXPECT_TRUE(instant()->model()->mode().is_default()); | 194 EXPECT_TRUE(instant()->model()->mode().is_default()); |
195 | 195 |
196 // The old overlay is deleted and a new one is created. | 196 // The old overlay is deleted and a new one is created. |
197 EXPECT_TRUE(instant()->GetPreviewContents()); | 197 EXPECT_TRUE(instant()->GetOverlayContents()); |
198 EXPECT_NE(instant()->GetPreviewContents(), preview_tab); | 198 EXPECT_NE(instant()->GetOverlayContents(), overlay); |
199 | 199 |
200 // Check that the current active tab is indeed what was once the preview. | 200 // Check that the current active tab is indeed what was once the overlay. |
201 EXPECT_EQ(preview_tab, browser()->tab_strip_model()->GetActiveWebContents()); | 201 EXPECT_EQ(overlay, browser()->tab_strip_model()->GetActiveWebContents()); |
202 | 202 |
203 // We should have two navigation entries, one for the NTP, and one for the | 203 // We should have two navigation entries, one for the NTP, and one for the |
204 // Instant search that was committed. | 204 // Instant search that was committed. |
205 EXPECT_EQ(2, preview_tab->GetController().GetEntryCount()); | 205 EXPECT_EQ(2, overlay->GetController().GetEntryCount()); |
206 | 206 |
207 // Check that the omnibox contains the Instant URL we loaded. | 207 // Check that the omnibox contains the Instant URL we loaded. |
208 EXPECT_EQ(instant_url_, omnibox()->model()->PermanentURL()); | 208 EXPECT_EQ(instant_url_, omnibox()->model()->PermanentURL()); |
209 | 209 |
210 // Check that the searchbox API values have been reset. | 210 // Check that the searchbox API values have been reset. |
211 std::string value; | 211 std::string value; |
212 EXPECT_TRUE(GetStringFromJS(preview_tab, | 212 EXPECT_TRUE(GetStringFromJS(overlay, |
213 "chrome.embeddedSearch.searchBox.value", &value)); | 213 "chrome.embeddedSearch.searchBox.value", &value)); |
214 EXPECT_EQ("", value); | 214 EXPECT_EQ("", value); |
215 | 215 |
216 // However, the page should've correctly received the committed query. | 216 // However, the page should've correctly received the committed query. |
217 EXPECT_TRUE(UpdateSearchState(preview_tab)); | 217 EXPECT_TRUE(UpdateSearchState(overlay)); |
218 EXPECT_EQ("search", value_); | 218 EXPECT_EQ("search", value_); |
219 EXPECT_TRUE(verbatim_); | 219 EXPECT_TRUE(verbatim_); |
220 EXPECT_EQ(1, onsubmitcalls_); | 220 EXPECT_EQ(1, onsubmitcalls_); |
221 EXPECT_EQ(1, onvisibilitycalls_); | 221 EXPECT_EQ(1, onvisibilitycalls_); |
222 } | 222 } |
223 | 223 |
224 // Test that the oncancel event is dispatched upon clicking on the preview. | 224 // Test that the oncancel event is dispatched upon clicking on the overlay. |
225 IN_PROC_BROWSER_TEST_F(InstantTest, OnCancelEvent) { | 225 IN_PROC_BROWSER_TEST_F(InstantTest, OnCancelEvent) { |
226 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 226 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
227 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 227 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
228 FocusOmniboxAndWaitForInstantSupport(); | 228 FocusOmniboxAndWaitForInstantSupport(); |
229 SetOmniboxTextAndWaitForInstantToShow("search"); | 229 SetOmniboxTextAndWaitForOverlayToShow("search"); |
230 | 230 |
231 // Stash a reference to the preview, so we can refer to it after commit. | 231 // Stash a reference to the overlay, so we can refer to it after commit. |
232 content::WebContents* preview_tab = instant()->GetPreviewContents(); | 232 content::WebContents* overlay = instant()->GetOverlayContents(); |
233 EXPECT_TRUE(preview_tab); | 233 EXPECT_TRUE(overlay); |
234 | 234 |
235 // The state of the searchbox before the commit. | 235 // The state of the searchbox before the commit. |
236 EXPECT_TRUE(UpdateSearchState(preview_tab)); | 236 EXPECT_TRUE(UpdateSearchState(overlay)); |
237 EXPECT_EQ("search", value_); | 237 EXPECT_EQ("search", value_); |
238 EXPECT_FALSE(verbatim_); | 238 EXPECT_FALSE(verbatim_); |
239 EXPECT_EQ(0, oncancelcalls_); | 239 EXPECT_EQ(0, oncancelcalls_); |
240 EXPECT_EQ(1, onvisibilitycalls_); | 240 EXPECT_EQ(1, onvisibilitycalls_); |
241 | 241 |
242 // Before the commit, the active tab is the NTP (i.e., not Instant). | 242 // Before the commit, the active tab is the NTP (i.e., not Instant). |
243 content::WebContents* active_tab = | 243 content::WebContents* active_tab = |
244 browser()->tab_strip_model()->GetActiveWebContents(); | 244 browser()->tab_strip_model()->GetActiveWebContents(); |
245 EXPECT_NE(preview_tab, active_tab); | 245 EXPECT_NE(overlay, active_tab); |
246 EXPECT_EQ(1, active_tab->GetController().GetEntryCount()); | 246 EXPECT_EQ(1, active_tab->GetController().GetEntryCount()); |
247 EXPECT_EQ(std::string(chrome::kAboutBlankURL), | 247 EXPECT_EQ(std::string(chrome::kAboutBlankURL), |
248 omnibox()->model()->PermanentURL().spec()); | 248 omnibox()->model()->PermanentURL().spec()); |
249 | 249 |
250 // Commit the search by clicking on the preview. | 250 // Commit the search by clicking on the overlay. |
251 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); | 251 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); |
252 | 252 |
253 // After the commit, Instant should not be showing. | 253 // After the commit, Instant should not be showing. |
254 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 254 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
255 EXPECT_TRUE(instant()->model()->mode().is_default()); | 255 EXPECT_TRUE(instant()->model()->mode().is_default()); |
256 | 256 |
257 // The old overlay is deleted and a new one is created. | 257 // The old overlay is deleted and a new one is created. |
258 EXPECT_TRUE(instant()->GetPreviewContents()); | 258 EXPECT_TRUE(instant()->GetOverlayContents()); |
259 EXPECT_NE(instant()->GetPreviewContents(), preview_tab); | 259 EXPECT_NE(instant()->GetOverlayContents(), overlay); |
260 | 260 |
261 // Check that the current active tab is indeed what was once the preview. | 261 // Check that the current active tab is indeed what was once the overlay. |
262 EXPECT_EQ(preview_tab, browser()->tab_strip_model()->GetActiveWebContents()); | 262 EXPECT_EQ(overlay, browser()->tab_strip_model()->GetActiveWebContents()); |
263 | 263 |
264 // We should have two navigation entries, one for the NTP, and one for the | 264 // We should have two navigation entries, one for the NTP, and one for the |
265 // Instant search that was committed. | 265 // Instant search that was committed. |
266 EXPECT_EQ(2, preview_tab->GetController().GetEntryCount()); | 266 EXPECT_EQ(2, overlay->GetController().GetEntryCount()); |
267 | 267 |
268 // Check that the omnibox contains the Instant URL we loaded. | 268 // Check that the omnibox contains the Instant URL we loaded. |
269 EXPECT_EQ(instant_url_, omnibox()->model()->PermanentURL()); | 269 EXPECT_EQ(instant_url_, omnibox()->model()->PermanentURL()); |
270 | 270 |
271 // Check that the searchbox API values have been reset. | 271 // Check that the searchbox API values have been reset. |
272 std::string value; | 272 std::string value; |
273 EXPECT_TRUE(GetStringFromJS(preview_tab, | 273 EXPECT_TRUE(GetStringFromJS(overlay, |
274 "chrome.embeddedSearch.searchBox.value", &value)); | 274 "chrome.embeddedSearch.searchBox.value", &value)); |
275 EXPECT_EQ("", value); | 275 EXPECT_EQ("", value); |
276 | 276 |
277 // However, the page should've correctly received the committed query. | 277 // However, the page should've correctly received the committed query. |
278 EXPECT_TRUE(UpdateSearchState(preview_tab)); | 278 EXPECT_TRUE(UpdateSearchState(overlay)); |
279 EXPECT_EQ("search", value_); | 279 EXPECT_EQ("search", value_); |
280 EXPECT_TRUE(verbatim_); | 280 EXPECT_TRUE(verbatim_); |
281 EXPECT_EQ(1, oncancelcalls_); | 281 EXPECT_EQ(1, oncancelcalls_); |
282 EXPECT_EQ(1, onvisibilitycalls_); | 282 EXPECT_EQ(1, onvisibilitycalls_); |
283 } | 283 } |
284 | 284 |
285 // Test that the onreisze event is dispatched upon typing in the omnibox. | 285 // Test that the onreisze event is dispatched upon typing in the omnibox. |
286 IN_PROC_BROWSER_TEST_F(InstantTest, OnResizeEvent) { | 286 IN_PROC_BROWSER_TEST_F(InstantTest, OnResizeEvent) { |
287 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 287 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
288 | 288 |
289 FocusOmniboxAndWaitForInstantSupport(); | 289 FocusOmniboxAndWaitForInstantSupport(); |
290 | 290 |
291 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); | 291 EXPECT_TRUE(UpdateSearchState(instant()->GetOverlayContents())); |
292 EXPECT_EQ(0, onresizecalls_); | 292 EXPECT_EQ(0, onresizecalls_); |
293 EXPECT_EQ(0, height_); | 293 EXPECT_EQ(0, height_); |
294 | 294 |
295 // Type a query into the omnibox. This should cause an onresize() event, with | 295 // Type a query into the omnibox. This should cause an onresize() event, with |
296 // a valid (non-zero) height. | 296 // a valid (non-zero) height. |
297 SetOmniboxTextAndWaitForInstantToShow("search"); | 297 SetOmniboxTextAndWaitForOverlayToShow("search"); |
298 | 298 |
299 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); | 299 EXPECT_TRUE(UpdateSearchState(instant()->GetOverlayContents())); |
300 EXPECT_EQ(1, onresizecalls_); | 300 EXPECT_EQ(1, onresizecalls_); |
301 EXPECT_LT(0, height_); | 301 EXPECT_LT(0, height_); |
302 } | 302 } |
303 | 303 |
304 // Test that the INSTANT_COMPLETE_NOW behavior works as expected. | 304 // Test that the INSTANT_COMPLETE_NOW behavior works as expected. |
305 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsCompletedNow) { | 305 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsCompletedNow) { |
306 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 306 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
307 FocusOmniboxAndWaitForInstantSupport(); | 307 FocusOmniboxAndWaitForInstantSupport(); |
308 | 308 |
309 // Tell the JS to request the given behavior. | 309 // Tell the JS to request the given behavior. |
310 EXPECT_TRUE(ExecuteScript("behavior = 'now'")); | 310 EXPECT_TRUE(ExecuteScript("behavior = 'now'")); |
311 | 311 |
312 // Type a query, causing the hardcoded "query suggestion" to be returned. | 312 // Type a query, causing the hardcoded "query suggestion" to be returned. |
313 SetOmniboxTextAndWaitForInstantToShow("query"); | 313 SetOmniboxTextAndWaitForOverlayToShow("query"); |
314 | 314 |
315 // Get what's showing in the omnibox, and what's highlighted. | 315 // Get what's showing in the omnibox, and what's highlighted. |
316 string16 text = omnibox()->GetText(); | 316 string16 text = omnibox()->GetText(); |
317 size_t start = 0, end = 0; | 317 size_t start = 0, end = 0; |
318 omnibox()->GetSelectionBounds(&start, &end); | 318 omnibox()->GetSelectionBounds(&start, &end); |
319 if (start > end) | 319 if (start > end) |
320 std::swap(start, end); | 320 std::swap(start, end); |
321 | 321 |
322 EXPECT_EQ(ASCIIToUTF16("query suggestion"), text); | 322 EXPECT_EQ(ASCIIToUTF16("query suggestion"), text); |
323 EXPECT_EQ(ASCIIToUTF16(" suggestion"), text.substr(start, end - start)); | 323 EXPECT_EQ(ASCIIToUTF16(" suggestion"), text.substr(start, end - start)); |
324 EXPECT_EQ(ASCIIToUTF16(""), omnibox()->GetInstantSuggestion()); | 324 EXPECT_EQ(ASCIIToUTF16(""), omnibox()->GetInstantSuggestion()); |
325 } | 325 } |
326 | 326 |
327 // Test that the INSTANT_COMPLETE_NEVER behavior works as expected. | 327 // Test that the INSTANT_COMPLETE_NEVER behavior works as expected. |
328 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsCompletedNever) { | 328 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsCompletedNever) { |
329 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 329 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
330 FocusOmniboxAndWaitForInstantSupport(); | 330 FocusOmniboxAndWaitForInstantSupport(); |
331 | 331 |
332 // Tell the JS to request the given behavior. | 332 // Tell the JS to request the given behavior. |
333 EXPECT_TRUE(ExecuteScript("behavior = 'never'")); | 333 EXPECT_TRUE(ExecuteScript("behavior = 'never'")); |
334 | 334 |
335 // Type a query, causing the hardcoded "query suggestion" to be returned. | 335 // Type a query, causing the hardcoded "query suggestion" to be returned. |
336 SetOmniboxTextAndWaitForInstantToShow("query"); | 336 SetOmniboxTextAndWaitForOverlayToShow("query"); |
337 | 337 |
338 // Get what's showing in the omnibox, and what's highlighted. | 338 // Get what's showing in the omnibox, and what's highlighted. |
339 string16 text = omnibox()->GetText(); | 339 string16 text = omnibox()->GetText(); |
340 size_t start = 0, end = 0; | 340 size_t start = 0, end = 0; |
341 omnibox()->GetSelectionBounds(&start, &end); | 341 omnibox()->GetSelectionBounds(&start, &end); |
342 if (start > end) | 342 if (start > end) |
343 std::swap(start, end); | 343 std::swap(start, end); |
344 | 344 |
345 EXPECT_EQ(ASCIIToUTF16("query"), text); | 345 EXPECT_EQ(ASCIIToUTF16("query"), text); |
346 EXPECT_EQ(ASCIIToUTF16(""), text.substr(start, end - start)); | 346 EXPECT_EQ(ASCIIToUTF16(""), text.substr(start, end - start)); |
347 EXPECT_EQ(ASCIIToUTF16(" suggestion"), omnibox()->GetInstantSuggestion()); | 347 EXPECT_EQ(ASCIIToUTF16(" suggestion"), omnibox()->GetInstantSuggestion()); |
348 } | 348 } |
349 | 349 |
350 // Test that a valid suggestion is accepted. | 350 // Test that a valid suggestion is accepted. |
351 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsValidObject) { | 351 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsValidObject) { |
352 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 352 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
353 FocusOmniboxAndWaitForInstantSupport(); | 353 FocusOmniboxAndWaitForInstantSupport(); |
354 | 354 |
355 // Tell the JS to use the given suggestion. | 355 // Tell the JS to use the given suggestion. |
356 EXPECT_TRUE(ExecuteScript("suggestion = [ { value: 'query completion' } ]")); | 356 EXPECT_TRUE(ExecuteScript("suggestion = [ { value: 'query completion' } ]")); |
357 | 357 |
358 // Type a query, causing "query completion" to be returned as the suggestion. | 358 // Type a query, causing "query completion" to be returned as the suggestion. |
359 SetOmniboxTextAndWaitForInstantToShow("query"); | 359 SetOmniboxTextAndWaitForOverlayToShow("query"); |
360 EXPECT_EQ(ASCIIToUTF16("query completion"), omnibox()->GetText()); | 360 EXPECT_EQ(ASCIIToUTF16("query completion"), omnibox()->GetText()); |
361 } | 361 } |
362 | 362 |
363 // Test that an invalid suggestion is rejected. | 363 // Test that an invalid suggestion is rejected. |
364 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsInvalidObject) { | 364 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsInvalidObject) { |
365 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 365 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
366 FocusOmniboxAndWaitForInstantSupport(); | 366 FocusOmniboxAndWaitForInstantSupport(); |
367 | 367 |
368 // Tell the JS to use an object in an invalid format. | 368 // Tell the JS to use an object in an invalid format. |
369 EXPECT_TRUE(ExecuteScript("suggestion = { value: 'query completion' }")); | 369 EXPECT_TRUE(ExecuteScript("suggestion = { value: 'query completion' }")); |
370 | 370 |
371 // Type a query, but expect no suggestion. | 371 // Type a query, but expect no suggestion. |
372 SetOmniboxTextAndWaitForInstantToShow("query"); | 372 SetOmniboxTextAndWaitForOverlayToShow("query"); |
373 EXPECT_EQ(ASCIIToUTF16("query"), omnibox()->GetText()); | 373 EXPECT_EQ(ASCIIToUTF16("query"), omnibox()->GetText()); |
374 } | 374 } |
375 | 375 |
376 // Test that various forms of empty suggestions are rejected. | 376 // Test that various forms of empty suggestions are rejected. |
377 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsEmpty) { | 377 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionIsEmpty) { |
378 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 378 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
379 FocusOmniboxAndWaitForInstantSupport(); | 379 FocusOmniboxAndWaitForInstantSupport(); |
380 | 380 |
381 EXPECT_TRUE(ExecuteScript("suggestion = {}")); | 381 EXPECT_TRUE(ExecuteScript("suggestion = {}")); |
382 SetOmniboxTextAndWaitForInstantToShow("query"); | 382 SetOmniboxTextAndWaitForOverlayToShow("query"); |
383 EXPECT_EQ(ASCIIToUTF16("query"), omnibox()->GetText()); | 383 EXPECT_EQ(ASCIIToUTF16("query"), omnibox()->GetText()); |
384 | 384 |
385 omnibox()->RevertAll(); | 385 omnibox()->RevertAll(); |
386 | 386 |
387 EXPECT_TRUE(ExecuteScript("suggestion = []")); | 387 EXPECT_TRUE(ExecuteScript("suggestion = []")); |
388 SetOmniboxTextAndWaitForInstantToShow("query sugg"); | 388 SetOmniboxTextAndWaitForOverlayToShow("query sugg"); |
389 EXPECT_EQ(ASCIIToUTF16("query sugg"), omnibox()->GetText()); | 389 EXPECT_EQ(ASCIIToUTF16("query sugg"), omnibox()->GetText()); |
390 | 390 |
391 omnibox()->RevertAll(); | 391 omnibox()->RevertAll(); |
392 | 392 |
393 EXPECT_TRUE(ExecuteScript("suggestion = [{}]")); | 393 EXPECT_TRUE(ExecuteScript("suggestion = [{}]")); |
394 SetOmniboxTextAndWaitForInstantToShow("query suggest"); | 394 SetOmniboxTextAndWaitForOverlayToShow("query suggest"); |
395 EXPECT_EQ(ASCIIToUTF16("query suggest"), omnibox()->GetText()); | 395 EXPECT_EQ(ASCIIToUTF16("query suggest"), omnibox()->GetText()); |
396 } | 396 } |
397 | 397 |
398 // Test that Instant doesn't process URLs. | 398 // Test that Instant doesn't process URLs. |
399 IN_PROC_BROWSER_TEST_F(InstantTest, RejectsURLs) { | 399 IN_PROC_BROWSER_TEST_F(InstantTest, RejectsURLs) { |
400 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 400 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
401 FocusOmniboxAndWaitForInstantSupport(); | 401 FocusOmniboxAndWaitForInstantSupport(); |
402 | 402 |
403 // Note that we are not actually navigating to these URLs yet. We are just | 403 // Note that we are not actually navigating to these URLs yet. We are just |
404 // typing them into the omnibox (without pressing Enter) and checking that | 404 // typing them into the omnibox (without pressing Enter) and checking that |
405 // Instant doesn't try to process them. | 405 // Instant doesn't try to process them. |
406 SetOmniboxText(content::kChromeUICrashURL); | 406 SetOmniboxText(content::kChromeUICrashURL); |
407 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 407 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
408 EXPECT_TRUE(instant()->model()->mode().is_default()); | 408 EXPECT_TRUE(instant()->model()->mode().is_default()); |
409 | 409 |
410 SetOmniboxText(content::kChromeUIHangURL); | 410 SetOmniboxText(content::kChromeUIHangURL); |
411 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 411 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
412 EXPECT_TRUE(instant()->model()->mode().is_default()); | 412 EXPECT_TRUE(instant()->model()->mode().is_default()); |
413 | 413 |
414 SetOmniboxText(content::kChromeUIKillURL); | 414 SetOmniboxText(content::kChromeUIKillURL); |
415 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 415 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
416 EXPECT_TRUE(instant()->model()->mode().is_default()); | 416 EXPECT_TRUE(instant()->model()->mode().is_default()); |
417 | 417 |
418 // Make sure that the URLs were never sent to the preview page. | 418 // Make sure that the URLs were never sent to the overlay page. |
419 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); | 419 EXPECT_TRUE(UpdateSearchState(instant()->GetOverlayContents())); |
420 EXPECT_EQ("", value_); | 420 EXPECT_EQ("", value_); |
421 } | 421 } |
422 | 422 |
423 // Test that Instant doesn't fire for intranet paths that look like searches. | 423 // Test that Instant doesn't fire for intranet paths that look like searches. |
424 // http://crbug.com/99836 | 424 // http://crbug.com/99836 |
425 IN_PROC_BROWSER_TEST_F(InstantTest, IntranetPathLooksLikeSearch) { | 425 IN_PROC_BROWSER_TEST_F(InstantTest, IntranetPathLooksLikeSearch) { |
426 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 426 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
427 | 427 |
428 // Navigate to a URL that looks like a search (when the scheme is stripped). | 428 // Navigate to a URL that looks like a search (when the scheme is stripped). |
429 // It's okay if the host is bogus or the navigation fails, since we only care | 429 // It's okay if the host is bogus or the navigation fails, since we only care |
430 // that Instant doesn't act on it. | 430 // that Instant doesn't act on it. |
431 ui_test_utils::NavigateToURL(browser(), GURL("http://baby/beluga")); | 431 ui_test_utils::NavigateToURL(browser(), GURL("http://baby/beluga")); |
432 EXPECT_EQ(ASCIIToUTF16("baby/beluga"), omnibox()->GetText()); | 432 EXPECT_EQ(ASCIIToUTF16("baby/beluga"), omnibox()->GetText()); |
433 | 433 |
434 EXPECT_TRUE(instant()->GetPreviewContents()); | 434 EXPECT_TRUE(instant()->GetOverlayContents()); |
435 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 435 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
436 EXPECT_TRUE(instant()->model()->mode().is_default()); | 436 EXPECT_TRUE(instant()->model()->mode().is_default()); |
437 } | 437 } |
438 | 438 |
439 // Test that transitions between searches and non-searches work as expected. | 439 // Test that transitions between searches and non-searches work as expected. |
440 IN_PROC_BROWSER_TEST_F(InstantTest, TransitionsBetweenSearchAndURL) { | 440 IN_PROC_BROWSER_TEST_F(InstantTest, TransitionsBetweenSearchAndURL) { |
441 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 441 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
442 FocusOmniboxAndWaitForInstantSupport(); | 442 FocusOmniboxAndWaitForInstantSupport(); |
443 | 443 |
444 // Type a search, and immediately a URL, without waiting for Instant to show. | 444 // Type a search, and immediately a URL, without waiting for Instant to show. |
445 // The page is told about the search. Though the page isn't told about the | 445 // The page is told about the search. Though the page isn't told about the |
446 // subsequent URL, it invalidates the search, so a blank query is sent in its | 446 // subsequent URL, it invalidates the search, so a blank query is sent in its |
447 // place to indicate that the search is "out of date". | 447 // place to indicate that the search is "out of date". |
448 SetOmniboxText("query"); | 448 SetOmniboxText("query"); |
449 SetOmniboxText("http://monstrous/nightmare"); | 449 SetOmniboxText("http://monstrous/nightmare"); |
450 int min_onchangecalls = 2; | 450 int min_onchangecalls = 2; |
451 | 451 |
452 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); | 452 EXPECT_TRUE(UpdateSearchState(instant()->GetOverlayContents())); |
453 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 453 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
454 EXPECT_TRUE(instant()->model()->mode().is_default()); | 454 EXPECT_TRUE(instant()->model()->mode().is_default()); |
455 EXPECT_EQ("", value_); | 455 EXPECT_EQ("", value_); |
456 EXPECT_LE(min_onchangecalls, onchangecalls_); | 456 EXPECT_LE(min_onchangecalls, onchangecalls_); |
457 min_onchangecalls = onchangecalls_; | 457 min_onchangecalls = onchangecalls_; |
458 | 458 |
459 // Type a search. Instant should show. | 459 // Type a search. Instant should show. |
460 SetOmniboxTextAndWaitForInstantToShow("search"); | 460 SetOmniboxTextAndWaitForOverlayToShow("search"); |
461 ++min_onchangecalls; | 461 ++min_onchangecalls; |
462 | 462 |
463 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); | 463 EXPECT_TRUE(UpdateSearchState(instant()->GetOverlayContents())); |
464 EXPECT_TRUE(instant()->IsPreviewingSearchResults()); | 464 EXPECT_TRUE(instant()->IsOverlayingSearchResults()); |
465 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); | 465 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); |
466 EXPECT_EQ("search", value_); | 466 EXPECT_EQ("search", value_); |
467 EXPECT_LE(min_onchangecalls, onchangecalls_); | 467 EXPECT_LE(min_onchangecalls, onchangecalls_); |
468 min_onchangecalls = onchangecalls_; | 468 min_onchangecalls = onchangecalls_; |
469 | 469 |
470 // Type another URL. The preview should be hidden. | 470 // Type another URL. The overlay should be hidden. |
471 SetOmniboxText("http://terrible/terror"); | 471 SetOmniboxText("http://terrible/terror"); |
472 ++min_onchangecalls; | 472 ++min_onchangecalls; |
473 | 473 |
474 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); | 474 EXPECT_TRUE(UpdateSearchState(instant()->GetOverlayContents())); |
475 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 475 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
476 EXPECT_TRUE(instant()->model()->mode().is_default()); | 476 EXPECT_TRUE(instant()->model()->mode().is_default()); |
477 EXPECT_EQ("", value_); | 477 EXPECT_EQ("", value_); |
478 EXPECT_LE(min_onchangecalls, onchangecalls_); | 478 EXPECT_LE(min_onchangecalls, onchangecalls_); |
479 min_onchangecalls = onchangecalls_; | 479 min_onchangecalls = onchangecalls_; |
480 | 480 |
481 // Type the same search as before. | 481 // Type the same search as before. |
482 SetOmniboxTextAndWaitForInstantToShow("search"); | 482 SetOmniboxTextAndWaitForOverlayToShow("search"); |
483 min_onchangecalls++; | 483 min_onchangecalls++; |
484 | 484 |
485 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); | 485 EXPECT_TRUE(UpdateSearchState(instant()->GetOverlayContents())); |
486 EXPECT_TRUE(instant()->IsPreviewingSearchResults()); | 486 EXPECT_TRUE(instant()->IsOverlayingSearchResults()); |
487 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); | 487 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); |
488 EXPECT_EQ("search", value_); | 488 EXPECT_EQ("search", value_); |
489 EXPECT_LE(min_onchangecalls, onchangecalls_); | 489 EXPECT_LE(min_onchangecalls, onchangecalls_); |
490 min_onchangecalls = onchangecalls_; | 490 min_onchangecalls = onchangecalls_; |
491 | 491 |
492 // Revert the omnibox. | 492 // Revert the omnibox. |
493 omnibox()->RevertAll(); | 493 omnibox()->RevertAll(); |
494 min_onchangecalls++; | 494 min_onchangecalls++; |
495 | 495 |
496 EXPECT_TRUE(UpdateSearchState(instant()->GetPreviewContents())); | 496 EXPECT_TRUE(UpdateSearchState(instant()->GetOverlayContents())); |
497 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 497 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
498 EXPECT_TRUE(instant()->model()->mode().is_default()); | 498 EXPECT_TRUE(instant()->model()->mode().is_default()); |
499 EXPECT_EQ("", value_); | 499 EXPECT_EQ("", value_); |
500 EXPECT_LE(min_onchangecalls, onchangecalls_); | 500 EXPECT_LE(min_onchangecalls, onchangecalls_); |
501 } | 501 } |
502 | 502 |
503 // Test that Instant can't be fooled into committing a URL. | 503 // Test that Instant can't be fooled into committing a URL. |
504 IN_PROC_BROWSER_TEST_F(InstantTest, DoesNotCommitURLsOne) { | 504 IN_PROC_BROWSER_TEST_F(InstantTest, DoesNotCommitURLsOne) { |
505 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 505 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
506 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 506 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
507 | 507 |
508 // Type a URL. The Instant preview shouldn't be showing. | 508 // Type a URL. The Instant overlay shouldn't be showing. |
509 SetOmniboxText("http://deadly/nadder"); | 509 SetOmniboxText("http://deadly/nadder"); |
510 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 510 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
511 EXPECT_TRUE(instant()->model()->mode().is_default()); | 511 EXPECT_TRUE(instant()->model()->mode().is_default()); |
512 | 512 |
513 // Unfocus and refocus the omnibox. | 513 // Unfocus and refocus the omnibox. |
514 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); | 514 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); |
515 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); | 515 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); |
516 FocusOmnibox(); | 516 FocusOmnibox(); |
517 | 517 |
518 content::WebContents* preview_tab = instant()->GetPreviewContents(); | 518 content::WebContents* overlay = instant()->GetOverlayContents(); |
519 EXPECT_TRUE(preview_tab); | 519 EXPECT_TRUE(overlay); |
520 | 520 |
521 // The omnibox text hasn't changed, so Instant still shouldn't be showing. | 521 // The omnibox text hasn't changed, so Instant still shouldn't be showing. |
522 EXPECT_EQ(ASCIIToUTF16("http://deadly/nadder"), omnibox()->GetText()); | 522 EXPECT_EQ(ASCIIToUTF16("http://deadly/nadder"), omnibox()->GetText()); |
523 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 523 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
524 EXPECT_TRUE(instant()->model()->mode().is_default()); | 524 EXPECT_TRUE(instant()->model()->mode().is_default()); |
525 | 525 |
526 // Commit the URL. The omnibox should reflect the URL minus the scheme. | 526 // Commit the URL. The omnibox should reflect the URL minus the scheme. |
527 browser()->window()->GetLocationBar()->AcceptInput(); | 527 browser()->window()->GetLocationBar()->AcceptInput(); |
528 content::WebContents* active_tab = | 528 content::WebContents* active_tab = |
529 browser()->tab_strip_model()->GetActiveWebContents(); | 529 browser()->tab_strip_model()->GetActiveWebContents(); |
530 EXPECT_NE(preview_tab, active_tab); | 530 EXPECT_NE(overlay, active_tab); |
531 EXPECT_EQ(ASCIIToUTF16("deadly/nadder"), omnibox()->GetText()); | 531 EXPECT_EQ(ASCIIToUTF16("deadly/nadder"), omnibox()->GetText()); |
532 | 532 |
533 // Instant shouldn't have done anything. | 533 // Instant shouldn't have done anything. |
534 EXPECT_EQ(preview_tab, instant()->GetPreviewContents()); | 534 EXPECT_EQ(overlay, instant()->GetOverlayContents()); |
535 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 535 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
536 EXPECT_TRUE(instant()->model()->mode().is_default()); | 536 EXPECT_TRUE(instant()->model()->mode().is_default()); |
537 } | 537 } |
538 | 538 |
539 // Test that Instant can't be fooled into committing a URL. | 539 // Test that Instant can't be fooled into committing a URL. |
540 IN_PROC_BROWSER_TEST_F(InstantTest, DoesNotCommitURLsTwo) { | 540 IN_PROC_BROWSER_TEST_F(InstantTest, DoesNotCommitURLsTwo) { |
541 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 541 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
542 FocusOmniboxAndWaitForInstantSupport(); | 542 FocusOmniboxAndWaitForInstantSupport(); |
543 | 543 |
544 // Type a query. This causes the preview to be shown. | 544 // Type a query. This causes the overlay to be shown. |
545 SetOmniboxTextAndWaitForInstantToShow("query"); | 545 SetOmniboxTextAndWaitForOverlayToShow("query"); |
546 | 546 |
547 content::WebContents* preview_tab = instant()->GetPreviewContents(); | 547 content::WebContents* overlay = instant()->GetOverlayContents(); |
548 EXPECT_TRUE(preview_tab); | 548 EXPECT_TRUE(overlay); |
549 | 549 |
550 // Type a URL. This causes the preview to be hidden. | 550 // Type a URL. This causes the overlay to be hidden. |
551 SetOmniboxText("http://hideous/zippleback"); | 551 SetOmniboxText("http://hideous/zippleback"); |
552 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 552 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
553 EXPECT_TRUE(instant()->model()->mode().is_default()); | 553 EXPECT_TRUE(instant()->model()->mode().is_default()); |
554 | 554 |
555 // Pretend the omnibox got focus. It already had focus, so we are just trying | 555 // Pretend the omnibox got focus. It already had focus, so we are just trying |
556 // to tickle a different code path. | 556 // to tickle a different code path. |
557 instant()->OmniboxFocusChanged(OMNIBOX_FOCUS_VISIBLE, | 557 instant()->OmniboxFocusChanged(OMNIBOX_FOCUS_VISIBLE, |
558 OMNIBOX_FOCUS_CHANGE_EXPLICIT, NULL); | 558 OMNIBOX_FOCUS_CHANGE_EXPLICIT, NULL); |
559 | 559 |
560 // Commit the URL. As before, check that Instant wasn't committed. | 560 // Commit the URL. As before, check that Instant wasn't committed. |
561 browser()->window()->GetLocationBar()->AcceptInput(); | 561 browser()->window()->GetLocationBar()->AcceptInput(); |
562 content::WebContents* active_tab = | 562 content::WebContents* active_tab = |
563 browser()->tab_strip_model()->GetActiveWebContents(); | 563 browser()->tab_strip_model()->GetActiveWebContents(); |
564 EXPECT_NE(preview_tab, active_tab); | 564 EXPECT_NE(overlay, active_tab); |
565 EXPECT_EQ(ASCIIToUTF16("hideous/zippleback"), omnibox()->GetText()); | 565 EXPECT_EQ(ASCIIToUTF16("hideous/zippleback"), omnibox()->GetText()); |
566 | 566 |
567 // As before, Instant shouldn't have done anything. | 567 // As before, Instant shouldn't have done anything. |
568 EXPECT_EQ(preview_tab, instant()->GetPreviewContents()); | 568 EXPECT_EQ(overlay, instant()->GetOverlayContents()); |
569 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 569 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
570 EXPECT_TRUE(instant()->model()->mode().is_default()); | 570 EXPECT_TRUE(instant()->model()->mode().is_default()); |
571 } | 571 } |
572 | 572 |
573 // Test that a non-Instant search provider shows no previews. | 573 // Test that a non-Instant search provider shows no overlays. |
574 IN_PROC_BROWSER_TEST_F(InstantTest, NonInstantSearchProvider) { | 574 IN_PROC_BROWSER_TEST_F(InstantTest, NonInstantSearchProvider) { |
575 instant_url_ = test_server()->GetURL("files/empty.html"); | 575 instant_url_ = test_server()->GetURL("files/empty.html"); |
576 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 576 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
577 | 577 |
578 // Focus the omnibox. When the support determination response comes back, | 578 // Focus the omnibox. When the support determination response comes back, |
579 // Instant will destroy the non-Instant page, and attempt to recreate it. | 579 // Instant will destroy the non-Instant page, and attempt to recreate it. |
580 // We can know this happened by looking at the blacklist. | 580 // We can know this happened by looking at the blacklist. |
581 EXPECT_EQ(0, instant()->blacklisted_urls_[instant_url_.spec()]); | 581 EXPECT_EQ(0, instant()->blacklisted_urls_[instant_url_.spec()]); |
582 FocusOmniboxAndWaitForInstantSupport(); | 582 FocusOmniboxAndWaitForInstantSupport(); |
583 EXPECT_EQ(1, instant()->blacklisted_urls_[instant_url_.spec()]); | 583 EXPECT_EQ(1, instant()->blacklisted_urls_[instant_url_.spec()]); |
584 } | 584 } |
585 | 585 |
586 // Test that the renderer doesn't crash if JavaScript is blocked. | 586 // Test that the renderer doesn't crash if JavaScript is blocked. |
587 IN_PROC_BROWSER_TEST_F(InstantTest, NoCrashOnBlockedJS) { | 587 IN_PROC_BROWSER_TEST_F(InstantTest, NoCrashOnBlockedJS) { |
588 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 588 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
589 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); | 589 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); |
590 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 590 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
591 | 591 |
592 // Wait for notification that the Instant API has been determined. As long as | 592 // Wait for notification that the Instant API has been determined. As long as |
593 // we get the notification we're good (the renderer didn't crash). | 593 // we get the notification we're good (the renderer didn't crash). |
594 FocusOmniboxAndWaitForInstantSupport(); | 594 FocusOmniboxAndWaitForInstantSupport(); |
595 } | 595 } |
596 | 596 |
597 // Test that the preview and active tab's visibility states are set correctly. | 597 // Test that the overlay and active tab's visibility states are set correctly. |
598 IN_PROC_BROWSER_TEST_F(InstantTest, PageVisibility) { | 598 IN_PROC_BROWSER_TEST_F(InstantTest, PageVisibility) { |
599 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 599 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
600 FocusOmniboxAndWaitForInstantSupport(); | 600 FocusOmniboxAndWaitForInstantSupport(); |
601 | 601 |
602 content::WebContents* active_tab = | 602 content::WebContents* active_tab = |
603 browser()->tab_strip_model()->GetActiveWebContents(); | 603 browser()->tab_strip_model()->GetActiveWebContents(); |
604 content::WebContents* preview_tab = instant()->GetPreviewContents(); | 604 content::WebContents* overlay = instant()->GetOverlayContents(); |
605 | 605 |
606 // Inititally, the active tab is showing; the preview is not. | 606 // Inititally, the active tab is showing; the overlay is not. |
607 EXPECT_TRUE(CheckVisibilityIs(active_tab, true)); | 607 EXPECT_TRUE(CheckVisibilityIs(active_tab, true)); |
608 EXPECT_TRUE(CheckVisibilityIs(preview_tab, false)); | 608 EXPECT_TRUE(CheckVisibilityIs(overlay, false)); |
609 | 609 |
610 // Type a query and wait for Instant to show. | 610 // Type a query and wait for Instant to show. |
611 SetOmniboxTextAndWaitForInstantToShow("query"); | 611 SetOmniboxTextAndWaitForOverlayToShow("query"); |
612 EXPECT_TRUE(CheckVisibilityIs(active_tab, true)); | 612 EXPECT_TRUE(CheckVisibilityIs(active_tab, true)); |
613 EXPECT_TRUE(CheckVisibilityIs(preview_tab, true)); | 613 EXPECT_TRUE(CheckVisibilityIs(overlay, true)); |
614 | 614 |
615 // Deleting the omnibox text should hide the preview. | 615 // Deleting the omnibox text should hide the overlay. |
616 SetOmniboxText(""); | 616 SetOmniboxText(""); |
617 EXPECT_TRUE(CheckVisibilityIs(active_tab, true)); | 617 EXPECT_TRUE(CheckVisibilityIs(active_tab, true)); |
618 EXPECT_TRUE(CheckVisibilityIs(preview_tab, false)); | 618 EXPECT_TRUE(CheckVisibilityIs(overlay, false)); |
619 | 619 |
620 // Typing a query should show the preview again. | 620 // Typing a query should show the overlay again. |
621 SetOmniboxTextAndWaitForInstantToShow("query"); | 621 SetOmniboxTextAndWaitForOverlayToShow("query"); |
622 EXPECT_TRUE(CheckVisibilityIs(active_tab, true)); | 622 EXPECT_TRUE(CheckVisibilityIs(active_tab, true)); |
623 EXPECT_TRUE(CheckVisibilityIs(preview_tab, true)); | 623 EXPECT_TRUE(CheckVisibilityIs(overlay, true)); |
624 | 624 |
625 // Commit the preview. | 625 // Commit the overlay. |
626 browser()->window()->GetLocationBar()->AcceptInput(); | 626 browser()->window()->GetLocationBar()->AcceptInput(); |
627 EXPECT_EQ(preview_tab, browser()->tab_strip_model()->GetActiveWebContents()); | 627 EXPECT_EQ(overlay, browser()->tab_strip_model()->GetActiveWebContents()); |
628 EXPECT_TRUE(CheckVisibilityIs(preview_tab, true)); | 628 EXPECT_TRUE(CheckVisibilityIs(overlay, true)); |
629 } | 629 } |
630 | 630 |
631 // Test that the task manager identifies Instant's preview tab correctly. | 631 // Test that the task manager identifies Instant's overlay correctly. |
632 IN_PROC_BROWSER_TEST_F(InstantTest, TaskManagerPrefix) { | 632 IN_PROC_BROWSER_TEST_F(InstantTest, TaskManagerPrefix) { |
633 // The browser starts with a new tab, so there's just one renderer initially. | 633 // The browser starts with a new tab, so there's just one renderer initially. |
634 TaskManagerModel* task_manager = TaskManager::GetInstance()->model(); | 634 TaskManagerModel* task_manager = TaskManager::GetInstance()->model(); |
635 task_manager->StartUpdating(); | 635 task_manager->StartUpdating(); |
636 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); | 636 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); |
637 | 637 |
638 string16 prefix = l10n_util::GetStringFUTF16( | 638 string16 prefix = l10n_util::GetStringFUTF16( |
639 IDS_TASK_MANAGER_INSTANT_PREVIEW_PREFIX, string16()); | 639 IDS_TASK_MANAGER_INSTANT_OVERLAY_PREFIX, string16()); |
640 | 640 |
641 // There should be no Instant preview yet. | 641 // There should be no Instant overlay yet. |
642 for (int i = 0; i < task_manager->ResourceCount(); ++i) { | 642 for (int i = 0; i < task_manager->ResourceCount(); ++i) { |
643 string16 title = task_manager->GetResourceTitle(i); | 643 string16 title = task_manager->GetResourceTitle(i); |
644 EXPECT_FALSE(StartsWith(title, prefix, true)) << title << " vs " << prefix; | 644 EXPECT_FALSE(StartsWith(title, prefix, true)) << title << " vs " << prefix; |
645 } | 645 } |
646 | 646 |
647 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 647 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
648 FocusOmnibox(); | 648 FocusOmnibox(); |
649 | 649 |
650 // Now there should be two renderers, the second being the Instant preview. | 650 // Now there should be two renderers, the second being the Instant overlay. |
651 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); | 651 TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); |
652 | 652 |
653 int instant_previews = 0; | 653 int instant_overlays = 0; |
654 for (int i = 0; i < task_manager->ResourceCount(); ++i) { | 654 for (int i = 0; i < task_manager->ResourceCount(); ++i) { |
655 string16 title = task_manager->GetResourceTitle(i); | 655 string16 title = task_manager->GetResourceTitle(i); |
656 if (StartsWith(title, prefix, true)) | 656 if (StartsWith(title, prefix, true)) |
657 ++instant_previews; | 657 ++instant_overlays; |
658 } | 658 } |
659 EXPECT_EQ(1, instant_previews); | 659 EXPECT_EQ(1, instant_overlays); |
660 } | 660 } |
661 | 661 |
662 void HistoryQueryDone(base::RunLoop* run_loop, | 662 void HistoryQueryDone(base::RunLoop* run_loop, |
663 bool* result, | 663 bool* result, |
664 HistoryService::Handle /* handle */, | 664 HistoryService::Handle /* handle */, |
665 bool success, | 665 bool success, |
666 const history::URLRow* /* urlrow */, | 666 const history::URLRow* /* urlrow */, |
667 history::VisitVector* /* visitvector */) { | 667 history::VisitVector* /* visitvector */) { |
668 *result = success; | 668 *result = success; |
669 run_loop->Quit(); | 669 run_loop->Quit(); |
(...skipping 19 matching lines...) Expand all Loading... |
689 // |instant_url| is the URL Instant loads. |search_url| is the fake URL we | 689 // |instant_url| is the URL Instant loads. |search_url| is the fake URL we |
690 // enter into history for search terms extraction to work correctly. | 690 // enter into history for search terms extraction to work correctly. |
691 std::string search_url = template_url->url_ref().ReplaceSearchTerms( | 691 std::string search_url = template_url->url_ref().ReplaceSearchTerms( |
692 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("search"))); | 692 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("search"))); |
693 | 693 |
694 HistoryService* history = HistoryServiceFactory::GetForProfile( | 694 HistoryService* history = HistoryServiceFactory::GetForProfile( |
695 browser()->profile(), Profile::EXPLICIT_ACCESS); | 695 browser()->profile(), Profile::EXPLICIT_ACCESS); |
696 ui_test_utils::WaitForHistoryToLoad(history); | 696 ui_test_utils::WaitForHistoryToLoad(history); |
697 | 697 |
698 // Perform a search. | 698 // Perform a search. |
699 SetOmniboxTextAndWaitForInstantToShow("search"); | 699 SetOmniboxTextAndWaitForOverlayToShow("search"); |
700 | 700 |
701 // Commit the search. | 701 // Commit the search. |
702 browser()->window()->GetLocationBar()->AcceptInput(); | 702 browser()->window()->GetLocationBar()->AcceptInput(); |
703 | 703 |
704 bool found = false; | 704 bool found = false; |
705 CancelableRequestConsumer consumer; | 705 CancelableRequestConsumer consumer; |
706 | 706 |
707 // The fake search URL should be in history. | 707 // The fake search URL should be in history. |
708 base::RunLoop run_loop1; | 708 base::RunLoop run_loop1; |
709 history->QueryURL(GURL(search_url), false, &consumer, | 709 history->QueryURL(GURL(search_url), false, &consumer, |
(...skipping 19 matching lines...) Expand all Loading... |
729 EXPECT_EQ(ASCIIToUTF16("search"), queries[0]); | 729 EXPECT_EQ(ASCIIToUTF16("search"), queries[0]); |
730 } | 730 } |
731 | 731 |
732 // TODO(jered): Fix this test on Mac. It fails currently, but the behavior is | 732 // TODO(jered): Fix this test on Mac. It fails currently, but the behavior is |
733 // actually closer to what we'd like. | 733 // actually closer to what we'd like. |
734 #if defined(OS_MACOSX) | 734 #if defined(OS_MACOSX) |
735 #define MAYBE_NewWindowDismissesInstant DISABLED_NewWindowDismissesInstant | 735 #define MAYBE_NewWindowDismissesInstant DISABLED_NewWindowDismissesInstant |
736 #else | 736 #else |
737 #define MAYBE_NewWindowDismissesInstant NewWindowDismissesInstant | 737 #define MAYBE_NewWindowDismissesInstant NewWindowDismissesInstant |
738 #endif | 738 #endif |
739 // Test that creating a new window hides any currently showing Instant preview. | 739 // Test that creating a new window hides any currently showing Instant overlay. |
740 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_NewWindowDismissesInstant) { | 740 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_NewWindowDismissesInstant) { |
741 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 741 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
742 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 742 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
743 FocusOmniboxAndWaitForInstantSupport(); | 743 FocusOmniboxAndWaitForInstantSupport(); |
744 SetOmniboxTextAndWaitForInstantToShow("search"); | 744 SetOmniboxTextAndWaitForOverlayToShow("search"); |
745 | 745 |
746 Browser* previous_window = browser(); | 746 Browser* previous_window = browser(); |
747 EXPECT_TRUE(instant()->IsPreviewingSearchResults()); | 747 EXPECT_TRUE(instant()->IsOverlayingSearchResults()); |
748 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); | 748 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); |
749 | 749 |
750 InstantTestModelObserver observer(instant()->model(), | 750 InstantTestModelObserver observer(instant()->model(), |
751 chrome::search::Mode::MODE_DEFAULT); | 751 chrome::search::Mode::MODE_DEFAULT); |
752 chrome::NewEmptyWindow(browser()->profile(), | 752 chrome::NewEmptyWindow(browser()->profile(), |
753 chrome::HOST_DESKTOP_TYPE_NATIVE); | 753 chrome::HOST_DESKTOP_TYPE_NATIVE); |
754 observer.WaitUntilDesiredPreviewState(); | 754 observer.WaitForDesiredOverlayState(); |
755 | 755 |
756 // Even though we just created a new Browser object (for the new window), the | 756 // Even though we just created a new Browser object (for the new window), the |
757 // browser() accessor should still give us the first window's Browser object. | 757 // browser() accessor should still give us the first window's Browser object. |
758 EXPECT_EQ(previous_window, browser()); | 758 EXPECT_EQ(previous_window, browser()); |
759 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 759 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
760 EXPECT_TRUE(instant()->model()->mode().is_default()); | 760 EXPECT_TRUE(instant()->model()->mode().is_default()); |
761 } | 761 } |
762 | 762 |
763 // Test that the Instant overlay is recreated when all these conditions are met: | 763 // Test that the Instant overlay is recreated when all these conditions are met: |
764 // - The stale overlay timer has fired. | 764 // - The stale overlay timer has fired. |
765 // - The preview is not showing. | 765 // - The overlay is not showing. |
766 // - The omnibox doesn't have focus. | 766 // - The omnibox doesn't have focus. |
767 IN_PROC_BROWSER_TEST_F(InstantTest, InstantOverlayRefresh) { | 767 IN_PROC_BROWSER_TEST_F(InstantTest, InstantOverlayRefresh) { |
768 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 768 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
769 FocusOmniboxAndWaitForInstantSupport(); | 769 FocusOmniboxAndWaitForInstantSupport(); |
770 | 770 |
771 // The preview is refreshed only after all three conditions above are met. | 771 // The overlay is refreshed only after all three conditions above are met. |
772 SetOmniboxTextAndWaitForInstantToShow("query"); | 772 SetOmniboxTextAndWaitForOverlayToShow("query"); |
773 instant()->overlay_->is_stale_ = true; | 773 instant()->overlay_->is_stale_ = true; |
774 instant()->ReloadOverlayIfStale(); | 774 instant()->ReloadOverlayIfStale(); |
775 EXPECT_TRUE(instant()->overlay_->supports_instant()); | 775 EXPECT_TRUE(instant()->overlay_->supports_instant()); |
776 instant()->HideOverlay(); | 776 instant()->HideOverlay(); |
777 EXPECT_TRUE(instant()->overlay_->supports_instant()); | 777 EXPECT_TRUE(instant()->overlay_->supports_instant()); |
778 instant()->OmniboxFocusChanged(OMNIBOX_FOCUS_NONE, | 778 instant()->OmniboxFocusChanged(OMNIBOX_FOCUS_NONE, |
779 OMNIBOX_FOCUS_CHANGE_EXPLICIT, NULL); | 779 OMNIBOX_FOCUS_CHANGE_EXPLICIT, NULL); |
780 EXPECT_FALSE(instant()->overlay_->supports_instant()); | 780 EXPECT_FALSE(instant()->overlay_->supports_instant()); |
781 | 781 |
782 // Try with a different ordering. | 782 // Try with a different ordering. |
783 SetOmniboxTextAndWaitForInstantToShow("query"); | 783 SetOmniboxTextAndWaitForOverlayToShow("query"); |
784 instant()->overlay_->is_stale_ = true; | 784 instant()->overlay_->is_stale_ = true; |
785 instant()->ReloadOverlayIfStale(); | 785 instant()->ReloadOverlayIfStale(); |
786 EXPECT_TRUE(instant()->overlay_->supports_instant()); | 786 EXPECT_TRUE(instant()->overlay_->supports_instant()); |
787 instant()->OmniboxFocusChanged(OMNIBOX_FOCUS_NONE, | 787 instant()->OmniboxFocusChanged(OMNIBOX_FOCUS_NONE, |
788 OMNIBOX_FOCUS_CHANGE_EXPLICIT, NULL); | 788 OMNIBOX_FOCUS_CHANGE_EXPLICIT, NULL); |
789 // TODO(sreeram): Currently, OmniboxLostFocus() calls HideOverlay(). When it | 789 // TODO(sreeram): Currently, OmniboxLostFocus() calls HideOverlay(). When it |
790 // stops hiding the preview eventually, uncomment these two lines: | 790 // stops hiding the overlay eventually, uncomment these two lines: |
791 // EXPECT_TRUE(instant()->overlay_->supports_instant()); | 791 // EXPECT_TRUE(instant()->overlay_->supports_instant()); |
792 // instant()->HideOverlay(); | 792 // instant()->HideOverlay(); |
793 EXPECT_FALSE(instant()->overlay_->supports_instant()); | 793 EXPECT_FALSE(instant()->overlay_->supports_instant()); |
794 } | 794 } |
795 | 795 |
796 // Test that suggestions are case insensitive. http://crbug.com/150728 | 796 // Test that suggestions are case insensitive. http://crbug.com/150728 |
797 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionsAreCaseInsensitive) { | 797 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionsAreCaseInsensitive) { |
798 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 798 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
799 FocusOmniboxAndWaitForInstantSupport(); | 799 FocusOmniboxAndWaitForInstantSupport(); |
800 | 800 |
801 EXPECT_TRUE(ExecuteScript("suggestion = [ { value: 'INSTANT' } ]")); | 801 EXPECT_TRUE(ExecuteScript("suggestion = [ { value: 'INSTANT' } ]")); |
802 | 802 |
803 SetOmniboxTextAndWaitForInstantToShow("in"); | 803 SetOmniboxTextAndWaitForOverlayToShow("in"); |
804 EXPECT_EQ(ASCIIToUTF16("instant"), omnibox()->GetText()); | 804 EXPECT_EQ(ASCIIToUTF16("instant"), omnibox()->GetText()); |
805 | 805 |
806 omnibox()->RevertAll(); | 806 omnibox()->RevertAll(); |
807 SetOmniboxTextAndWaitForInstantToShow("IN"); | 807 SetOmniboxTextAndWaitForOverlayToShow("IN"); |
808 EXPECT_EQ(ASCIIToUTF16("INSTANT"), omnibox()->GetText()); | 808 EXPECT_EQ(ASCIIToUTF16("INSTANT"), omnibox()->GetText()); |
809 | 809 |
810 // U+0130 == LATIN CAPITAL LETTER I WITH DOT ABOVE | 810 // U+0130 == LATIN CAPITAL LETTER I WITH DOT ABOVE |
811 EXPECT_TRUE(ExecuteScript("suggestion = [ { value: '\\u0130NSTANT' } ]")); | 811 EXPECT_TRUE(ExecuteScript("suggestion = [ { value: '\\u0130NSTANT' } ]")); |
812 | 812 |
813 omnibox()->RevertAll(); | 813 omnibox()->RevertAll(); |
814 SetOmniboxTextAndWaitForInstantToShow("i"); | 814 SetOmniboxTextAndWaitForOverlayToShow("i"); |
815 EXPECT_EQ(WideToUTF16(L"i\u0307nstant"), omnibox()->GetText()); | 815 EXPECT_EQ(WideToUTF16(L"i\u0307nstant"), omnibox()->GetText()); |
816 | 816 |
817 omnibox()->RevertAll(); | 817 omnibox()->RevertAll(); |
818 SetOmniboxTextAndWaitForInstantToShow("I"); | 818 SetOmniboxTextAndWaitForOverlayToShow("I"); |
819 EXPECT_EQ(WideToUTF16(L"I\u0307nstant"), omnibox()->GetText()); | 819 EXPECT_EQ(WideToUTF16(L"I\u0307nstant"), omnibox()->GetText()); |
820 | 820 |
821 omnibox()->RevertAll(); | 821 omnibox()->RevertAll(); |
822 SetOmniboxTextAndWaitForInstantToShow(WideToUTF8(L"i\u0307")); | 822 SetOmniboxTextAndWaitForOverlayToShow(WideToUTF8(L"i\u0307")); |
823 EXPECT_EQ(WideToUTF16(L"i\u0307nstant"), omnibox()->GetText()); | 823 EXPECT_EQ(WideToUTF16(L"i\u0307nstant"), omnibox()->GetText()); |
824 | 824 |
825 omnibox()->RevertAll(); | 825 omnibox()->RevertAll(); |
826 SetOmniboxTextAndWaitForInstantToShow(WideToUTF8(L"I\u0307")); | 826 SetOmniboxTextAndWaitForOverlayToShow(WideToUTF8(L"I\u0307")); |
827 EXPECT_EQ(WideToUTF16(L"I\u0307nstant"), omnibox()->GetText()); | 827 EXPECT_EQ(WideToUTF16(L"I\u0307nstant"), omnibox()->GetText()); |
828 | 828 |
829 omnibox()->RevertAll(); | 829 omnibox()->RevertAll(); |
830 SetOmniboxTextAndWaitForInstantToShow(WideToUTF8(L"\u0130")); | 830 SetOmniboxTextAndWaitForOverlayToShow(WideToUTF8(L"\u0130")); |
831 EXPECT_EQ(WideToUTF16(L"\u0130NSTANT"), omnibox()->GetText()); | 831 EXPECT_EQ(WideToUTF16(L"\u0130NSTANT"), omnibox()->GetText()); |
832 | 832 |
833 omnibox()->RevertAll(); | 833 omnibox()->RevertAll(); |
834 SetOmniboxTextAndWaitForInstantToShow("in"); | 834 SetOmniboxTextAndWaitForOverlayToShow("in"); |
835 EXPECT_EQ(ASCIIToUTF16("in"), omnibox()->GetText()); | 835 EXPECT_EQ(ASCIIToUTF16("in"), omnibox()->GetText()); |
836 | 836 |
837 omnibox()->RevertAll(); | 837 omnibox()->RevertAll(); |
838 SetOmniboxTextAndWaitForInstantToShow("IN"); | 838 SetOmniboxTextAndWaitForOverlayToShow("IN"); |
839 EXPECT_EQ(ASCIIToUTF16("IN"), omnibox()->GetText()); | 839 EXPECT_EQ(ASCIIToUTF16("IN"), omnibox()->GetText()); |
840 | 840 |
841 // Check that a d with a dot above and below it is completed regardless of | 841 // Check that a d with a dot above and below it is completed regardless of |
842 // how that is encoded. | 842 // how that is encoded. |
843 // U+1E0D = LATIN SMALL LETTER D WITH DOT BELOW | 843 // U+1E0D = LATIN SMALL LETTER D WITH DOT BELOW |
844 // U+1E0B = LATIN SMALL LETTER D WITH DOT ABOVE | 844 // U+1E0B = LATIN SMALL LETTER D WITH DOT ABOVE |
845 EXPECT_TRUE(ExecuteScript("suggestion = [ { value: '\\u1e0d\\u0307oh' } ]")); | 845 EXPECT_TRUE(ExecuteScript("suggestion = [ { value: '\\u1e0d\\u0307oh' } ]")); |
846 | 846 |
847 omnibox()->RevertAll(); | 847 omnibox()->RevertAll(); |
848 SetOmniboxTextAndWaitForInstantToShow(WideToUTF8(L"\u1e0b\u0323")); | 848 SetOmniboxTextAndWaitForOverlayToShow(WideToUTF8(L"\u1e0b\u0323")); |
849 EXPECT_EQ(WideToUTF16(L"\u1e0b\u0323oh"), omnibox()->GetText()); | 849 EXPECT_EQ(WideToUTF16(L"\u1e0b\u0323oh"), omnibox()->GetText()); |
850 } | 850 } |
851 | 851 |
852 // Flakes on Windows and Mac: http://crbug.com/170677 | 852 // Flakes on Windows and Mac: http://crbug.com/170677 |
853 #if defined(OS_WIN) || defined(OS_MACOSX) | 853 #if defined(OS_WIN) || defined(OS_MACOSX) |
854 #define MAYBE_CommitInNewTab DISABLED_CommitInNewTab | 854 #define MAYBE_CommitInNewTab DISABLED_CommitInNewTab |
855 #else | 855 #else |
856 #define MAYBE_CommitInNewTab CommitInNewTab | 856 #define MAYBE_CommitInNewTab CommitInNewTab |
857 #endif | 857 #endif |
858 // Test that the preview can be committed onto a new tab. | 858 // Test that the overlay can be committed onto a new tab. |
859 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_CommitInNewTab) { | 859 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_CommitInNewTab) { |
860 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 860 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
861 FocusOmniboxAndWaitForInstantSupport(); | 861 FocusOmniboxAndWaitForInstantSupport(); |
862 | 862 |
863 // Use the Instant page as the active tab, so we can exploit its visibility | 863 // Use the Instant page as the active tab, so we can exploit its visibility |
864 // handler to check visibility transitions. | 864 // handler to check visibility transitions. |
865 ui_test_utils::NavigateToURL(browser(), instant_url_); | 865 ui_test_utils::NavigateToURL(browser(), instant_url_); |
866 content::WebContents* active_tab = | 866 content::WebContents* active_tab = |
867 browser()->tab_strip_model()->GetActiveWebContents(); | 867 browser()->tab_strip_model()->GetActiveWebContents(); |
868 | 868 |
869 int active_tab_onvisibilitycalls = -1; | 869 int active_tab_onvisibilitycalls = -1; |
870 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", | 870 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", |
871 &active_tab_onvisibilitycalls)); | 871 &active_tab_onvisibilitycalls)); |
872 EXPECT_EQ(0, active_tab_onvisibilitycalls); | 872 EXPECT_EQ(0, active_tab_onvisibilitycalls); |
873 | 873 |
874 SetOmniboxTextAndWaitForInstantToShow("search"); | 874 SetOmniboxTextAndWaitForOverlayToShow("search"); |
875 | 875 |
876 // Stash a reference to the preview, so we can refer to it after commit. | 876 // Stash a reference to the overlay, so we can refer to it after commit. |
877 content::WebContents* preview_tab = instant()->GetPreviewContents(); | 877 content::WebContents* overlay = instant()->GetOverlayContents(); |
878 EXPECT_TRUE(preview_tab); | 878 EXPECT_TRUE(overlay); |
879 | 879 |
880 // The state of the searchbox before the commit. | 880 // The state of the searchbox before the commit. |
881 EXPECT_TRUE(UpdateSearchState(preview_tab)); | 881 EXPECT_TRUE(UpdateSearchState(overlay)); |
882 EXPECT_EQ("search", value_); | 882 EXPECT_EQ("search", value_); |
883 EXPECT_FALSE(verbatim_); | 883 EXPECT_FALSE(verbatim_); |
884 EXPECT_EQ(0, onsubmitcalls_); | 884 EXPECT_EQ(0, onsubmitcalls_); |
885 EXPECT_EQ(1, onvisibilitycalls_); | 885 EXPECT_EQ(1, onvisibilitycalls_); |
886 | 886 |
887 // The state of the active tab before the commit. | 887 // The state of the active tab before the commit. |
888 EXPECT_NE(preview_tab, active_tab); | 888 EXPECT_NE(overlay, active_tab); |
889 EXPECT_EQ(2, active_tab->GetController().GetEntryCount()); | 889 EXPECT_EQ(2, active_tab->GetController().GetEntryCount()); |
890 EXPECT_EQ(instant_url_, omnibox()->model()->PermanentURL()); | 890 EXPECT_EQ(instant_url_, omnibox()->model()->PermanentURL()); |
891 active_tab_onvisibilitycalls = -1; | 891 active_tab_onvisibilitycalls = -1; |
892 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", | 892 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", |
893 &active_tab_onvisibilitycalls)); | 893 &active_tab_onvisibilitycalls)); |
894 EXPECT_EQ(0, active_tab_onvisibilitycalls); | 894 EXPECT_EQ(0, active_tab_onvisibilitycalls); |
895 | 895 |
896 // Commit the search by pressing Alt-Enter. | 896 // Commit the search by pressing Alt-Enter. |
897 omnibox()->model()->AcceptInput(NEW_FOREGROUND_TAB, false); | 897 omnibox()->model()->AcceptInput(NEW_FOREGROUND_TAB, false); |
898 | 898 |
899 // After the commit, Instant should not be showing. | 899 // After the commit, Instant should not be showing. |
900 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); | 900 EXPECT_FALSE(instant()->IsOverlayingSearchResults()); |
901 EXPECT_TRUE(instant()->model()->mode().is_default()); | 901 EXPECT_TRUE(instant()->model()->mode().is_default()); |
902 | 902 |
903 // The old overlay is deleted and a new one is created. | 903 // The old overlay is deleted and a new one is created. |
904 EXPECT_TRUE(instant()->GetPreviewContents()); | 904 EXPECT_TRUE(instant()->GetOverlayContents()); |
905 EXPECT_NE(instant()->GetPreviewContents(), preview_tab); | 905 EXPECT_NE(instant()->GetOverlayContents(), overlay); |
906 | 906 |
907 // Check that we have two tabs and that the new active tab is indeed what was | 907 // Check that we have two tabs and that the new active tab is indeed what was |
908 // once the preview. The preview tab should have just one navigation entry, | 908 // once the overlay. The overlay should have just one navigation entry, for |
909 // for the Instant search that was committed. | 909 // the Instant search that was committed. |
910 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 910 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
911 EXPECT_EQ(preview_tab, browser()->tab_strip_model()->GetActiveWebContents()); | 911 EXPECT_EQ(overlay, browser()->tab_strip_model()->GetActiveWebContents()); |
912 EXPECT_EQ(1, preview_tab->GetController().GetEntryCount()); | 912 EXPECT_EQ(1, overlay->GetController().GetEntryCount()); |
913 | 913 |
914 // Check that the omnibox contains the Instant URL we loaded. | 914 // Check that the omnibox contains the Instant URL we loaded. |
915 EXPECT_EQ(instant_url_, omnibox()->model()->PermanentURL()); | 915 EXPECT_EQ(instant_url_, omnibox()->model()->PermanentURL()); |
916 | 916 |
917 // Check that the searchbox API values have been reset. | 917 // Check that the searchbox API values have been reset. |
918 std::string value; | 918 std::string value; |
919 EXPECT_TRUE(GetStringFromJS(preview_tab, | 919 EXPECT_TRUE(GetStringFromJS(overlay, |
920 "chrome.embeddedSearch.searchBox.value", &value)); | 920 "chrome.embeddedSearch.searchBox.value", &value)); |
921 EXPECT_EQ("", value); | 921 EXPECT_EQ("", value); |
922 | 922 |
923 // However, the page should've correctly received the committed query. | 923 // However, the page should've correctly received the committed query. |
924 EXPECT_TRUE(UpdateSearchState(preview_tab)); | 924 EXPECT_TRUE(UpdateSearchState(overlay)); |
925 EXPECT_EQ("search", value_); | 925 EXPECT_EQ("search", value_); |
926 EXPECT_TRUE(verbatim_); | 926 EXPECT_TRUE(verbatim_); |
927 EXPECT_EQ(1, onsubmitcalls_); | 927 EXPECT_EQ(1, onsubmitcalls_); |
928 EXPECT_EQ(1, onvisibilitycalls_); | 928 EXPECT_EQ(1, onvisibilitycalls_); |
929 | 929 |
930 // The ex-active tab should've gotten a visibility change marking it hidden. | 930 // The ex-active tab should've gotten a visibility change marking it hidden. |
931 EXPECT_NE(active_tab, preview_tab); | 931 EXPECT_NE(active_tab, overlay); |
932 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", | 932 EXPECT_TRUE(GetIntFromJS(active_tab, "onvisibilitycalls", |
933 &active_tab_onvisibilitycalls)); | 933 &active_tab_onvisibilitycalls)); |
934 EXPECT_EQ(1, active_tab_onvisibilitycalls); | 934 EXPECT_EQ(1, active_tab_onvisibilitycalls); |
935 } | 935 } |
936 | 936 |
937 // Test that suggestions are reusable. | 937 // Test that suggestions are reusable. |
938 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionsAreReusable) { | 938 IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionsAreReusable) { |
939 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 939 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
940 FocusOmniboxAndWaitForInstantSupport(); | 940 FocusOmniboxAndWaitForInstantSupport(); |
941 | 941 |
942 EXPECT_TRUE(ExecuteScript("suggestion = [ { value: 'instant' } ];" | 942 EXPECT_TRUE(ExecuteScript("suggestion = [ { value: 'instant' } ];" |
943 "behavior = 'never';")); | 943 "behavior = 'never';")); |
944 | 944 |
945 SetOmniboxTextAndWaitForInstantToShow("in"); | 945 SetOmniboxTextAndWaitForOverlayToShow("in"); |
946 EXPECT_EQ(ASCIIToUTF16("stant"), omnibox()->GetInstantSuggestion()); | 946 EXPECT_EQ(ASCIIToUTF16("stant"), omnibox()->GetInstantSuggestion()); |
947 | 947 |
948 SetOmniboxText("ins"); | 948 SetOmniboxText("ins"); |
949 EXPECT_EQ(ASCIIToUTF16("tant"), omnibox()->GetInstantSuggestion()); | 949 EXPECT_EQ(ASCIIToUTF16("tant"), omnibox()->GetInstantSuggestion()); |
950 | 950 |
951 SetOmniboxText("in"); | 951 SetOmniboxText("in"); |
952 EXPECT_EQ(ASCIIToUTF16("stant"), omnibox()->GetInstantSuggestion()); | 952 EXPECT_EQ(ASCIIToUTF16("stant"), omnibox()->GetInstantSuggestion()); |
953 | 953 |
954 SetOmniboxText("insane"); | 954 SetOmniboxText("insane"); |
955 EXPECT_EQ(ASCIIToUTF16(""), omnibox()->GetInstantSuggestion()); | 955 EXPECT_EQ(ASCIIToUTF16(""), omnibox()->GetInstantSuggestion()); |
956 } | 956 } |
957 | 957 |
958 // Test that instant overlay is recreated if it gets destroyed. | 958 // Test that the Instant overlay is recreated if it gets destroyed. |
959 IN_PROC_BROWSER_TEST_F(InstantTest, InstantRenderViewGone) { | 959 IN_PROC_BROWSER_TEST_F(InstantTest, InstantRenderViewGone) { |
960 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 960 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
961 FocusOmniboxAndWaitForInstantSupport(); | 961 FocusOmniboxAndWaitForInstantSupport(); |
962 | 962 |
963 // Type partial query, get suggestion to show. | 963 // Type partial query, get suggestion to show. |
964 SetOmniboxTextAndWaitForInstantToShow("q"); | 964 SetOmniboxTextAndWaitForOverlayToShow("q"); |
965 EXPECT_EQ(ASCIIToUTF16("query suggestion"), omnibox()->GetText()); | 965 EXPECT_EQ(ASCIIToUTF16("query suggestion"), omnibox()->GetText()); |
966 | 966 |
967 // Kill the instant renderer and wait for instant support again. | 967 // Kill the Instant renderer and wait for Instant support again. |
968 KillInstantRenderView(); | 968 KillInstantRenderView(); |
969 FocusOmniboxAndWaitForInstantSupport(); | 969 FocusOmniboxAndWaitForInstantSupport(); |
970 | 970 |
971 SetOmniboxTextAndWaitForInstantToShow("qu"); | 971 SetOmniboxTextAndWaitForOverlayToShow("qu"); |
972 EXPECT_EQ(ASCIIToUTF16("query suggestion"), omnibox()->GetText()); | 972 EXPECT_EQ(ASCIIToUTF16("query suggestion"), omnibox()->GetText()); |
973 } | 973 } |
974 | 974 |
975 IN_PROC_BROWSER_TEST_F(InstantTest, ProcessIsolation) { | 975 IN_PROC_BROWSER_TEST_F(InstantTest, ProcessIsolation) { |
976 // Prior to setup no render process is dedicated to Instant. | 976 // Prior to setup no render process is dedicated to Instant. |
977 InstantService* instant_service = | 977 InstantService* instant_service = |
978 InstantServiceFactory::GetForProfile(browser()->profile()); | 978 InstantServiceFactory::GetForProfile(browser()->profile()); |
979 ASSERT_NE(static_cast<InstantService*>(NULL), instant_service); | 979 ASSERT_NE(static_cast<InstantService*>(NULL), instant_service); |
980 EXPECT_EQ(0, instant_service->GetInstantProcessCount()); | 980 EXPECT_EQ(0, instant_service->GetInstantProcessCount()); |
981 | 981 |
982 // Setup Instant. | 982 // Setup Instant. |
983 ASSERT_NO_FATAL_FAILURE(SetupInstant()); | 983 ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
984 FocusOmniboxAndWaitForInstantSupport(); | 984 FocusOmniboxAndWaitForInstantSupport(); |
985 | 985 |
986 // Now there should be a registered Instant render process. | 986 // Now there should be a registered Instant render process. |
987 EXPECT_LT(0, instant_service->GetInstantProcessCount()); | 987 EXPECT_LT(0, instant_service->GetInstantProcessCount()); |
988 | 988 |
989 // And the Instant preview should live inside it. | 989 // And the Instant overlay should live inside it. |
990 content::WebContents* preview = instant()->GetPreviewContents(); | 990 content::WebContents* overlay = instant()->GetOverlayContents(); |
991 EXPECT_TRUE(instant_service->IsInstantProcess( | 991 EXPECT_TRUE(instant_service->IsInstantProcess( |
992 preview->GetRenderProcessHost()->GetID())); | 992 overlay->GetRenderProcessHost()->GetID())); |
993 | 993 |
994 // Search and commit the search by pressing Alt-Enter. | 994 // Search and commit the search by pressing Alt-Enter. |
995 SetOmniboxTextAndWaitForInstantToShow("tractor"); | 995 SetOmniboxTextAndWaitForOverlayToShow("tractor"); |
996 omnibox()->model()->AcceptInput(NEW_FOREGROUND_TAB, false); | 996 omnibox()->model()->AcceptInput(NEW_FOREGROUND_TAB, false); |
997 | 997 |
998 // The committed search results page should also live inside the | 998 // The committed search results page should also live inside the |
999 // Instant process. | 999 // Instant process. |
1000 content::WebContents* active_tab = | 1000 content::WebContents* active_tab = |
1001 browser()->tab_strip_model()->GetActiveWebContents(); | 1001 browser()->tab_strip_model()->GetActiveWebContents(); |
1002 EXPECT_TRUE(instant_service->IsInstantProcess( | 1002 EXPECT_TRUE(instant_service->IsInstantProcess( |
1003 active_tab->GetRenderProcessHost()->GetID())); | 1003 active_tab->GetRenderProcessHost()->GetID())); |
1004 | 1004 |
1005 // Navigating away should change the process. | 1005 // Navigating away should change the process. |
1006 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 1006 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
1007 EXPECT_FALSE(instant_service->IsInstantProcess( | 1007 EXPECT_FALSE(instant_service->IsInstantProcess( |
1008 active_tab->GetRenderProcessHost()->GetID())); | 1008 active_tab->GetRenderProcessHost()->GetID())); |
1009 } | 1009 } |
OLD | NEW |