OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 8 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
9 #include "chrome/browser/browser_list.h" | 9 #include "chrome/browser/browser_list.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 model->SetDefaultSearchProvider(template_url); | 60 model->SetDefaultSearchProvider(template_url); |
61 } | 61 } |
62 | 62 |
63 virtual void FindLocationBar() { | 63 virtual void FindLocationBar() { |
64 if (location_bar_) | 64 if (location_bar_) |
65 return; | 65 return; |
66 location_bar_ = browser()->window()->GetLocationBar(); | 66 location_bar_ = browser()->window()->GetLocationBar(); |
67 ASSERT_TRUE(location_bar_); | 67 ASSERT_TRUE(location_bar_); |
68 } | 68 } |
69 | 69 |
| 70 TabContentsWrapper* GetPendingPreviewContents() { |
| 71 return browser()->instant()->GetPendingPreviewContents(); |
| 72 } |
| 73 |
70 // Type a character to get instant to trigger. | 74 // Type a character to get instant to trigger. |
71 void SetupLocationBar() { | 75 void SetupLocationBar() { |
72 FindLocationBar(); | 76 FindLocationBar(); |
73 location_bar_->location_entry()->SetUserText(L"a"); | 77 location_bar_->location_entry()->SetUserText(L"a"); |
74 } | 78 } |
75 | 79 |
| 80 // Waits for preview to be shown. |
| 81 void WaitForPreviewToNavigate(bool use_current) { |
| 82 InstantController* instant = browser()->instant(); |
| 83 ASSERT_TRUE(instant); |
| 84 TabContentsWrapper* tab = use_current ? |
| 85 instant->GetPreviewContents() : GetPendingPreviewContents(); |
| 86 ASSERT_TRUE(tab); |
| 87 preview_ = tab->tab_contents(); |
| 88 ASSERT_TRUE(preview_); |
| 89 ui_test_utils::WaitForNavigation(&preview_->controller()); |
| 90 } |
| 91 |
76 // Wait for instant to load and ensure it is in the state we expect. | 92 // Wait for instant to load and ensure it is in the state we expect. |
77 void SetupPreview() { | 93 void SetupPreview() { |
78 preview_ = browser()->instant()->GetPreviewContents()->tab_contents(); | 94 // Wait for the preview to navigate. |
79 ASSERT_TRUE(preview_); | 95 WaitForPreviewToNavigate(true); |
80 ui_test_utils::WaitForNavigation(&preview_->controller()); | |
81 | 96 |
82 // Verify the initial setup of the search box. | |
83 ASSERT_TRUE(browser()->instant()); | |
84 EXPECT_TRUE(browser()->instant()->IsShowingInstant()); | 97 EXPECT_TRUE(browser()->instant()->IsShowingInstant()); |
85 EXPECT_FALSE(browser()->instant()->is_active()); | 98 EXPECT_FALSE(browser()->instant()->is_displayable()); |
| 99 EXPECT_TRUE(browser()->instant()->is_active()); |
86 | 100 |
87 // When the page loads, the initial searchBox values are set and only a | 101 // When the page loads, the initial searchBox values are set and only a |
88 // resize will have been sent. | 102 // resize will have been sent. |
89 EXPECT_NO_FATAL_FAILURE(CheckBoolValueFromJavascript( | 103 EXPECT_NO_FATAL_FAILURE(CheckBoolValueFromJavascript( |
90 true, "window.chrome.sv", preview_)); | 104 true, "window.chrome.sv", preview_)); |
91 EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript( | 105 EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript( |
92 0, "window.onsubmitcalls", preview_)); | 106 0, "window.onsubmitcalls", preview_)); |
93 EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript( | 107 EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript( |
94 0, "window.oncancelcalls", preview_)); | 108 0, "window.oncancelcalls", preview_)); |
95 EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript( | 109 EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 TabContents* tab_contents) { | 160 TabContents* tab_contents) { |
147 std::string script = StringPrintf( | 161 std::string script = StringPrintf( |
148 "window.domAutomationController.send(%s)", function.c_str()); | 162 "window.domAutomationController.send(%s)", function.c_str()); |
149 int result; | 163 int result; |
150 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( | 164 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( |
151 tab_contents->render_view_host(), | 165 tab_contents->render_view_host(), |
152 std::wstring(), UTF8ToWide(script), &result)); | 166 std::wstring(), UTF8ToWide(script), &result)); |
153 EXPECT_EQ(expected, result); | 167 EXPECT_EQ(expected, result); |
154 } | 168 } |
155 | 169 |
| 170 // Sends a message to the renderer and waits for the response to come back to |
| 171 // the browser. |
| 172 void WaitForMessageToBeProcessedByRenderer(TabContentsWrapper* tab) { |
| 173 ASSERT_NO_FATAL_FAILURE( |
| 174 CheckBoolValueFromJavascript(true, "true", tab->tab_contents())); |
| 175 } |
| 176 |
156 protected: | 177 protected: |
157 virtual void SetUpCommandLine(CommandLine* command_line) { | 178 virtual void SetUpCommandLine(CommandLine* command_line) { |
158 command_line->AppendSwitch(switches::kEnablePredictiveInstant); | 179 command_line->AppendSwitch(switches::kEnablePredictiveInstant); |
159 } | 180 } |
160 | 181 |
161 LocationBar* location_bar_; | 182 LocationBar* location_bar_; |
162 TabContents* preview_; | 183 TabContents* preview_; |
163 }; | 184 }; |
164 | 185 |
165 // TODO(tonyg): Add the following tests: | 186 // TODO(tonyg): Add the following tests: |
(...skipping 13 matching lines...) Expand all Loading... |
179 | 200 |
180 // Check that the value is reflected and onchange is called. | 201 // Check that the value is reflected and onchange is called. |
181 EXPECT_NO_FATAL_FAILURE(CheckStringValueFromJavascript( | 202 EXPECT_NO_FATAL_FAILURE(CheckStringValueFromJavascript( |
182 "abc", "window.chrome.searchBox.value", preview_)); | 203 "abc", "window.chrome.searchBox.value", preview_)); |
183 EXPECT_NO_FATAL_FAILURE(CheckBoolValueFromJavascript( | 204 EXPECT_NO_FATAL_FAILURE(CheckBoolValueFromJavascript( |
184 false, "window.chrome.searchBox.verbatim", preview_)); | 205 false, "window.chrome.searchBox.verbatim", preview_)); |
185 EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript( | 206 EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript( |
186 1, "window.onchangecalls", preview_)); | 207 1, "window.onchangecalls", preview_)); |
187 } | 208 } |
188 | 209 |
| 210 // Verify instant preview is shown correctly for a non-search query. |
| 211 IN_PROC_BROWSER_TEST_F(InstantTest, ShowPreviewNonSearch) { |
| 212 ASSERT_TRUE(test_server()->Start()); |
| 213 GURL url(test_server()->GetURL("files/instant/empty.html")); |
| 214 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(UTF8ToWide(url.spec()))); |
| 215 // The preview should be active and showing. |
| 216 ASSERT_TRUE(browser()->instant()->is_active()); |
| 217 ASSERT_TRUE(browser()->instant()->is_displayable()); |
| 218 ASSERT_TRUE(browser()->instant()->IsCurrent()); |
| 219 ASSERT_TRUE(browser()->instant()->GetPreviewContents()); |
| 220 RenderWidgetHostView* rwhv = |
| 221 browser()->instant()->GetPreviewContents()->tab_contents()-> |
| 222 GetRenderWidgetHostView(); |
| 223 ASSERT_TRUE(rwhv); |
| 224 ASSERT_TRUE(rwhv->IsShowing()); |
| 225 } |
| 226 |
| 227 // Transition from non-search to search and make sure everything is shown |
| 228 // correctly. |
| 229 IN_PROC_BROWSER_TEST_F(InstantTest, NonSearchToSearch) { |
| 230 ASSERT_TRUE(test_server()->Start()); |
| 231 GURL url(test_server()->GetURL("files/instant/empty.html")); |
| 232 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(UTF8ToWide(url.spec()))); |
| 233 // The preview should be active and showing. |
| 234 ASSERT_TRUE(browser()->instant()->is_active()); |
| 235 ASSERT_TRUE(browser()->instant()->is_displayable()); |
| 236 TabContentsWrapper* initial_tab = browser()->instant()->GetPreviewContents(); |
| 237 ASSERT_TRUE(initial_tab); |
| 238 RenderWidgetHostView* rwhv = |
| 239 initial_tab->tab_contents()->GetRenderWidgetHostView(); |
| 240 ASSERT_TRUE(rwhv); |
| 241 ASSERT_TRUE(rwhv->IsShowing()); |
| 242 |
| 243 // Now type in some search text. |
| 244 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); |
| 245 location_bar_->location_entry()->SetUserText(L"abc"); |
| 246 |
| 247 // Wait for the preview to navigate. |
| 248 ASSERT_NO_FATAL_FAILURE(WaitForPreviewToNavigate(false)); |
| 249 |
| 250 // The controller is still determining if the provider really supports |
| 251 // instant. As a result the tabcontents should not have changed. |
| 252 TabContentsWrapper* current_tab = browser()->instant()->GetPreviewContents(); |
| 253 ASSERT_EQ(current_tab, initial_tab); |
| 254 // The preview should still be showing. |
| 255 rwhv = current_tab->tab_contents()->GetRenderWidgetHostView(); |
| 256 ASSERT_TRUE(rwhv); |
| 257 ASSERT_TRUE(rwhv->IsShowing()); |
| 258 |
| 259 // Use MightSupportInstant as the controller is still determining if the |
| 260 // page supports instant and hasn't actually commited yet. |
| 261 EXPECT_TRUE(browser()->instant()->MightSupportInstant()); |
| 262 |
| 263 // Instant should still be active. |
| 264 EXPECT_TRUE(browser()->instant()->is_active()); |
| 265 EXPECT_TRUE(browser()->instant()->is_displayable()); |
| 266 |
| 267 // Because we're waiting on the page, instant isn't current. |
| 268 ASSERT_FALSE(browser()->instant()->IsCurrent()); |
| 269 |
| 270 // Bounce a message to the renderer so that we know the instant has gotten a |
| 271 // response back from the renderer as to whether the page supports instant. |
| 272 ASSERT_NO_FATAL_FAILURE( |
| 273 WaitForMessageToBeProcessedByRenderer(GetPendingPreviewContents())); |
| 274 |
| 275 // Reset the user text so that the page is told the text changed. We should be |
| 276 // able to nuke this once 66104 is fixed. |
| 277 location_bar_->location_entry()->SetUserText(L"abcd"); |
| 278 |
| 279 // Wait for the renderer to process it. |
| 280 ASSERT_NO_FATAL_FAILURE( |
| 281 WaitForMessageToBeProcessedByRenderer(GetPendingPreviewContents())); |
| 282 |
| 283 // We should have gotten a response back from the renderer that resulted in |
| 284 // committing. |
| 285 ASSERT_FALSE(GetPendingPreviewContents()); |
| 286 ASSERT_TRUE(browser()->instant()->is_active()); |
| 287 ASSERT_TRUE(browser()->instant()->is_displayable()); |
| 288 TabContentsWrapper* new_tab = browser()->instant()->GetPreviewContents(); |
| 289 ASSERT_TRUE(new_tab); |
| 290 ASSERT_NE(new_tab, initial_tab); |
| 291 RenderWidgetHostView* new_rwhv = |
| 292 new_tab->tab_contents()->GetRenderWidgetHostView(); |
| 293 ASSERT_TRUE(new_rwhv); |
| 294 ASSERT_NE(new_rwhv, rwhv); |
| 295 ASSERT_TRUE(new_rwhv->IsShowing()); |
| 296 } |
| 297 |
189 // Makes sure that if the server doesn't support the instant API we don't show | 298 // Makes sure that if the server doesn't support the instant API we don't show |
190 // anything. | 299 // anything. |
191 IN_PROC_BROWSER_TEST_F(InstantTest, SearchServerDoesntSupportInstant) { | 300 IN_PROC_BROWSER_TEST_F(InstantTest, SearchServerDoesntSupportInstant) { |
192 ASSERT_TRUE(test_server()->Start()); | 301 ASSERT_TRUE(test_server()->Start()); |
193 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("empty.html")); | 302 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("empty.html")); |
194 ASSERT_NO_FATAL_FAILURE(FindLocationBar()); | 303 ASSERT_NO_FATAL_FAILURE(FindLocationBar()); |
195 location_bar_->location_entry()->SetUserText(L"a"); | 304 location_bar_->location_entry()->SetUserText(L"a"); |
196 ASSERT_TRUE(browser()->instant()); | 305 ASSERT_TRUE(browser()->instant()); |
197 // Because we typed in a search string we should think we're showing instant | 306 // Because we typed in a search string we should think we're showing instant |
198 // results. | 307 // results. |
199 EXPECT_TRUE(browser()->instant()->IsShowingInstant()); | 308 EXPECT_TRUE(browser()->instant()->IsShowingInstant()); |
200 // But because we're waiting to determine if the page really supports instant | 309 // But because we're waiting to determine if the page really supports instant |
201 // we shouldn't be showing the preview. | 310 // we shouldn't be showing the preview. |
202 EXPECT_FALSE(browser()->instant()->is_active()); | 311 EXPECT_FALSE(browser()->instant()->is_displayable()); |
| 312 // But instant should still be active. |
| 313 EXPECT_TRUE(browser()->instant()->is_active()); |
203 | 314 |
204 // When the response comes back that the page doesn't support instant the tab | 315 // When the response comes back that the page doesn't support instant the tab |
205 // should be closed. | 316 // should be closed. |
206 ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED); | 317 ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED); |
207 EXPECT_FALSE(browser()->instant()->IsShowingInstant()); | 318 EXPECT_FALSE(browser()->instant()->IsShowingInstant()); |
208 EXPECT_FALSE(browser()->instant()->is_active()); | 319 EXPECT_FALSE(browser()->instant()->is_displayable()); |
| 320 EXPECT_TRUE(browser()->instant()->is_active()); |
| 321 EXPECT_FALSE(browser()->instant()->IsCurrent()); |
209 } | 322 } |
210 | 323 |
211 // Verifies transitioning from loading a non-search string to a search string | 324 // Verifies transitioning from loading a non-search string to a search string |
212 // with the provider not supporting instant works (meaning we don't display | 325 // with the provider not supporting instant works (meaning we don't display |
213 // anything). | 326 // anything). |
214 IN_PROC_BROWSER_TEST_F(InstantTest, NonSearchToSearchDoesntSupportInstant) { | 327 IN_PROC_BROWSER_TEST_F(InstantTest, NonSearchToSearchDoesntSupportInstant) { |
215 ASSERT_TRUE(test_server()->Start()); | 328 ASSERT_TRUE(test_server()->Start()); |
216 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("empty.html")); | 329 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("empty.html")); |
217 GURL url(test_server()->GetURL("files/instant/empty.html")); | 330 GURL url(test_server()->GetURL("files/instant/empty.html")); |
218 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(UTF8ToWide(url.spec()))); | 331 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(UTF8ToWide(url.spec()))); |
219 // The preview should be active and showing. | 332 // The preview should be active and showing. |
| 333 ASSERT_TRUE(browser()->instant()->is_displayable()); |
220 ASSERT_TRUE(browser()->instant()->is_active()); | 334 ASSERT_TRUE(browser()->instant()->is_active()); |
221 TabContentsWrapper* initial_tab = browser()->instant()->GetPreviewContents(); | 335 TabContentsWrapper* initial_tab = browser()->instant()->GetPreviewContents(); |
222 ASSERT_TRUE(initial_tab); | 336 ASSERT_TRUE(initial_tab); |
223 RenderWidgetHostView* rwhv = | 337 RenderWidgetHostView* rwhv = |
224 initial_tab->tab_contents()->GetRenderWidgetHostView(); | 338 initial_tab->tab_contents()->GetRenderWidgetHostView(); |
225 ASSERT_TRUE(rwhv); | 339 ASSERT_TRUE(rwhv); |
226 ASSERT_TRUE(rwhv->IsShowing()); | 340 ASSERT_TRUE(rwhv->IsShowing()); |
227 | 341 |
228 // Now type in some search text. | 342 // Now type in some search text. |
229 location_bar_->location_entry()->SetUserText(L"a"); | 343 location_bar_->location_entry()->SetUserText(L"a"); |
230 | 344 |
231 // Instant should still be live. | 345 // Instant should still be live. |
| 346 ASSERT_TRUE(browser()->instant()->is_displayable()); |
232 ASSERT_TRUE(browser()->instant()->is_active()); | 347 ASSERT_TRUE(browser()->instant()->is_active()); |
233 // Because we typed in a search string we should think we're showing instant | 348 // Because we typed in a search string we should think we're showing instant |
234 // results. | 349 // results. |
235 EXPECT_TRUE(browser()->instant()->MightSupportInstant()); | 350 EXPECT_TRUE(browser()->instant()->MightSupportInstant()); |
236 // Instant should not be current (it's still loading). | 351 // Instant should not be current (it's still loading). |
237 EXPECT_FALSE(browser()->instant()->IsCurrent()); | 352 EXPECT_FALSE(browser()->instant()->IsCurrent()); |
238 | 353 |
239 // When the response comes back that the page doesn't support instant the tab | 354 // When the response comes back that the page doesn't support instant the tab |
240 // should be closed. | 355 // should be closed. |
241 ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED); | 356 ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED); |
242 EXPECT_FALSE(browser()->instant()->IsShowingInstant()); | 357 EXPECT_FALSE(browser()->instant()->IsShowingInstant()); |
243 EXPECT_FALSE(browser()->instant()->is_active()); | 358 EXPECT_FALSE(browser()->instant()->is_displayable()); |
| 359 // But because the omnibox is still open, instant should be active. |
| 360 ASSERT_TRUE(browser()->instant()->is_active()); |
244 } | 361 } |
245 | 362 |
246 // Verifies the page was told a non-zero height. | 363 // Verifies the page was told a non-zero height. |
247 // TODO: when we nuke the old api and fix 66104, this test should load | 364 // TODO: when we nuke the old api and fix 66104, this test should load |
248 // search.html. | 365 // search.html. |
249 IN_PROC_BROWSER_TEST_F(InstantTest, ValidHeight) { | 366 IN_PROC_BROWSER_TEST_F(InstantTest, ValidHeight) { |
250 ASSERT_TRUE(test_server()->Start()); | 367 ASSERT_TRUE(test_server()->Start()); |
251 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("old_api.html")); | 368 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("old_api.html")); |
252 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"a")); | 369 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"a")); |
253 // The preview should be active. | 370 // The preview should be active. |
254 ASSERT_TRUE(browser()->instant()->is_active()); | 371 ASSERT_TRUE(browser()->instant()->is_displayable()); |
255 // And the height should be valid. | 372 // And the height should be valid. |
256 TabContents* tab = browser()->instant()->GetPreviewContents()->tab_contents(); | 373 TabContents* tab = browser()->instant()->GetPreviewContents()->tab_contents(); |
257 ASSERT_NO_FATAL_FAILURE( | 374 ASSERT_NO_FATAL_FAILURE( |
258 CheckBoolValueFromJavascript(true, "window.validHeight", tab)); | 375 CheckBoolValueFromJavascript(true, "window.validHeight", tab)); |
259 | 376 |
260 // Check that searchbox height was also set. | 377 // Check that searchbox height was also set. |
261 std::wstring script = | 378 std::wstring script = |
262 L"window.domAutomationController.send(window.chrome.searchBox.height)"; | 379 L"window.domAutomationController.send(window.chrome.searchBox.height)"; |
263 int height; | 380 int height; |
264 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( | 381 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( |
265 tab->render_view_host(), std::wstring(), script, &height)); | 382 tab->render_view_host(), std::wstring(), script, &height)); |
266 EXPECT_GT(height, 0); | 383 EXPECT_GT(height, 0); |
267 } | 384 } |
268 | 385 |
| 386 // Verifies that if the server returns a 403 we don't show the preview and |
| 387 // query the host again. |
| 388 IN_PROC_BROWSER_TEST_F(InstantTest, HideOn403) { |
| 389 ASSERT_TRUE(test_server()->Start()); |
| 390 GURL url(test_server()->GetURL("files/instant/403.html")); |
| 391 ASSERT_NO_FATAL_FAILURE(FindLocationBar()); |
| 392 location_bar_->location_entry()->SetUserText(UTF8ToWide(url.spec())); |
| 393 // The preview shouldn't be showing, but it should be loading. |
| 394 ASSERT_TRUE(browser()->instant()->GetPreviewContents()); |
| 395 ASSERT_TRUE(browser()->instant()->is_active()); |
| 396 ASSERT_FALSE(browser()->instant()->is_displayable()); |
| 397 |
| 398 // When instant sees the 403, it should close the tab. |
| 399 ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED); |
| 400 ASSERT_FALSE(browser()->instant()->GetPreviewContents()); |
| 401 ASSERT_TRUE(browser()->instant()->is_active()); |
| 402 ASSERT_FALSE(browser()->instant()->is_displayable()); |
| 403 |
| 404 // Try loading another url on the server. Instant shouldn't create a new tab |
| 405 // as the server returned 403. |
| 406 GURL url2(test_server()->GetURL("files/instant/empty.html")); |
| 407 location_bar_->location_entry()->SetUserText(UTF8ToWide(url2.spec())); |
| 408 ASSERT_FALSE(browser()->instant()->GetPreviewContents()); |
| 409 ASSERT_TRUE(browser()->instant()->is_active()); |
| 410 ASSERT_FALSE(browser()->instant()->is_displayable()); |
| 411 } |
| 412 |
269 // Verify that the onsubmit event is dispatched upon pressing enter. | 413 // Verify that the onsubmit event is dispatched upon pressing enter. |
270 // TODO(sky): Disabled, http://crbug.com/62940. | 414 // TODO(sky): Disabled, http://crbug.com/62940. |
271 IN_PROC_BROWSER_TEST_F(InstantTest, DISABLED_OnSubmitEvent) { | 415 IN_PROC_BROWSER_TEST_F(InstantTest, DISABLED_OnSubmitEvent) { |
272 ASSERT_TRUE(test_server()->Start()); | 416 ASSERT_TRUE(test_server()->Start()); |
273 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); | 417 ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html")); |
274 ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); | 418 ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); |
275 ASSERT_NO_FATAL_FAILURE(SetupPreview()); | 419 ASSERT_NO_FATAL_FAILURE(SetupPreview()); |
276 | 420 |
277 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"abc")); | 421 ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"abc")); |
278 ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN)); | 422 ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // Check that the value is reflected and oncancel is called. | 462 // Check that the value is reflected and oncancel is called. |
319 EXPECT_NO_FATAL_FAILURE(CheckBoolValueFromJavascript( | 463 EXPECT_NO_FATAL_FAILURE(CheckBoolValueFromJavascript( |
320 true, "window.chrome.sv", contents)); | 464 true, "window.chrome.sv", contents)); |
321 EXPECT_NO_FATAL_FAILURE(CheckStringValueFromJavascript( | 465 EXPECT_NO_FATAL_FAILURE(CheckStringValueFromJavascript( |
322 "abc", "window.chrome.searchBox.value", contents)); | 466 "abc", "window.chrome.searchBox.value", contents)); |
323 EXPECT_NO_FATAL_FAILURE(CheckBoolValueFromJavascript( | 467 EXPECT_NO_FATAL_FAILURE(CheckBoolValueFromJavascript( |
324 false, "window.chrome.searchBox.verbatim", contents)); | 468 false, "window.chrome.searchBox.verbatim", contents)); |
325 EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript( | 469 EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript( |
326 1, "window.oncancelcalls", contents)); | 470 1, "window.oncancelcalls", contents)); |
327 } | 471 } |
OLD | NEW |