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