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

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

Issue 302433013: Instant interactive_ui_tests should wait for main frame load. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: only change first wait to wait for frame load Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_test_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <sstream> 5 #include <sstream>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_base.h" 8 #include "base/metrics/histogram_base.h"
9 #include "base/metrics/histogram_samples.h" 9 #include "base/metrics/histogram_samples.h"
10 #include "base/metrics/statistics_recorder.h" 10 #include "base/metrics/statistics_recorder.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 }; 352 };
353 353
354 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, SearchReusesInstantTab) { 354 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, SearchReusesInstantTab) {
355 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 355 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
356 FocusOmnibox(); 356 FocusOmnibox();
357 357
358 content::WindowedNotificationObserver observer( 358 content::WindowedNotificationObserver observer(
359 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, 359 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED,
360 content::NotificationService::AllSources()); 360 content::NotificationService::AllSources());
361 SetOmniboxText("flowers"); 361 SetOmniboxText("flowers");
362 PressEnterAndWaitForNavigation(); 362 PressEnterAndWaitForFrameLoad();
363 observer.Wait(); 363 observer.Wait();
364 364
365 // Just did a regular search. 365 // Just did a regular search.
366 content::WebContents* active_tab = 366 content::WebContents* active_tab =
367 browser()->tab_strip_model()->GetActiveWebContents(); 367 browser()->tab_strip_model()->GetActiveWebContents();
368 ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=flowers")); 368 ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=flowers"));
369 ASSERT_TRUE(UpdateSearchState(active_tab)); 369 ASSERT_TRUE(UpdateSearchState(active_tab));
370 ASSERT_EQ(0, submit_count_); 370 ASSERT_EQ(0, submit_count_);
371 371
372 SetOmniboxText("puppies"); 372 SetOmniboxText("puppies");
(...skipping 27 matching lines...) Expand all
400 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, 400 IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
401 TypedSearchURLDoesntReuseInstantTab) { 401 TypedSearchURLDoesntReuseInstantTab) {
402 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 402 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
403 FocusOmnibox(); 403 FocusOmnibox();
404 404
405 // Create an observer to wait for the instant tab to support Instant. 405 // Create an observer to wait for the instant tab to support Instant.
406 content::WindowedNotificationObserver observer_1( 406 content::WindowedNotificationObserver observer_1(
407 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, 407 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED,
408 content::NotificationService::AllSources()); 408 content::NotificationService::AllSources());
409 SetOmniboxText("flowers"); 409 SetOmniboxText("flowers");
410 PressEnterAndWaitForNavigation(); 410 PressEnterAndWaitForFrameLoad();
411 observer_1.Wait(); 411 observer_1.Wait();
412 412
413 // Just did a regular search. 413 // Just did a regular search.
414 content::WebContents* active_tab = 414 content::WebContents* active_tab =
415 browser()->tab_strip_model()->GetActiveWebContents(); 415 browser()->tab_strip_model()->GetActiveWebContents();
416 ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=flowers")); 416 ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=flowers"));
417 ASSERT_TRUE(UpdateSearchState(active_tab)); 417 ASSERT_TRUE(UpdateSearchState(active_tab));
418 ASSERT_EQ(0, submit_count_); 418 ASSERT_EQ(0, submit_count_);
419 419
420 // Typed in a search URL "by hand". 420 // Typed in a search URL "by hand".
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 // Check that clicking on a result sends the correct referrer. 955 // Check that clicking on a result sends the correct referrer.
956 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, Referrer) { 956 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, Referrer) {
957 ASSERT_TRUE(test_server()->Start()); 957 ASSERT_TRUE(test_server()->Start());
958 GURL result_url = 958 GURL result_url =
959 test_server()->GetURL("files/referrer_policy/referrer-policy-log.html"); 959 test_server()->GetURL("files/referrer_policy/referrer-policy-log.html");
960 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 960 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
961 FocusOmnibox(); 961 FocusOmnibox();
962 962
963 // Type a query and press enter to get results. 963 // Type a query and press enter to get results.
964 SetOmniboxText("query"); 964 SetOmniboxText("query");
965 PressEnterAndWaitForNavigation(); 965 PressEnterAndWaitForFrameLoad();
966 966
967 // Simulate going to a result. 967 // Simulate going to a result.
968 content::WebContents* contents = 968 content::WebContents* contents =
969 browser()->tab_strip_model()->GetActiveWebContents(); 969 browser()->tab_strip_model()->GetActiveWebContents();
970 std::ostringstream stream; 970 std::ostringstream stream;
971 stream << "var link = document.createElement('a');"; 971 stream << "var link = document.createElement('a');";
972 stream << "link.href = \"" << result_url.spec() << "\";"; 972 stream << "link.href = \"" << result_url.spec() << "\";";
973 stream << "document.body.appendChild(link);"; 973 stream << "document.body.appendChild(link);";
974 stream << "link.click();"; 974 stream << "link.click();";
975 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); 975 EXPECT_TRUE(content::ExecuteScript(contents, stream.str()));
976 976
977 content::WaitForLoadStop(contents); 977 content::WaitForLoadStop(contents);
978 std::string expected_title = 978 std::string expected_title =
979 "Referrer is " + instant_url().GetWithEmptyPath().spec(); 979 "Referrer is " + instant_url().GetWithEmptyPath().spec();
980 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); 980 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle());
981 } 981 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698