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

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

Issue 17424004: Added test to verify that onmostvisitedchange event is dispatched when an user navigate from SRP to… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/search/instant_controller.h ('k') | no next file » | 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/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram_base.h" 9 #include "base/metrics/histogram_base.h"
10 #include "base/metrics/histogram_samples.h" 10 #include "base/metrics/histogram_samples.h"
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 content::WindowedNotificationObserver load_stop_observer_2( 1632 content::WindowedNotificationObserver load_stop_observer_2(
1633 content::NOTIFICATION_LOAD_STOP, 1633 content::NOTIFICATION_LOAD_STOP,
1634 content::Source<content::NavigationController>( 1634 content::Source<content::NavigationController>(
1635 &active_tab->GetController())); 1635 &active_tab->GetController()));
1636 active_tab->GetController().GoBack(); 1636 active_tab->GetController().GoBack();
1637 load_stop_observer_2.Wait(); 1637 load_stop_observer_2.Wait();
1638 1638
1639 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); 1639 active_tab = browser()->tab_strip_model()->GetActiveWebContents();
1640 EXPECT_TRUE(chrome::IsInstantNTP(active_tab)); 1640 EXPECT_TRUE(chrome::IsInstantNTP(active_tab));
1641 } 1641 }
1642
1643 // Flaky on Windows and Mac try bots.
1644 #if defined(OS_CHROMEOS)
1645 #define MAYBE_DispatchMVChangeEventWhileNavigatingBackToNTP DispatchMVChangeEven tWhileNavigatingBackToNTP
1646 #else
1647 #define MAYBE_DispatchMVChangeEventWhileNavigatingBackToNTP DISABLED_DispatchMVC hangeEventWhileNavigatingBackToNTP
1648 #endif
1649 IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
1650 MAYBE_DispatchMVChangeEventWhileNavigatingBackToNTP) {
1651 // Setup Instant.
1652 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
1653 FocusOmniboxAndWaitForInstantNTPSupport();
1654
1655 // Open new tab. Preloaded NTP contents should have been used.
1656 ui_test_utils::NavigateToURLWithDisposition(
1657 browser(),
1658 GURL(chrome::kChromeUINewTabURL),
1659 NEW_FOREGROUND_TAB,
1660 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
1661
1662 content::WebContents* active_tab =
1663 browser()->tab_strip_model()->GetActiveWebContents();
1664 EXPECT_TRUE(UpdateSearchState(active_tab));
1665 EXPECT_EQ(1, on_most_visited_change_calls_);
1666
1667 content::WindowedNotificationObserver observer(
1668 content::NOTIFICATION_LOAD_STOP,
1669 content::NotificationService::AllSources());
1670 // Set the text and press enter to navigate from NTP.
1671 SetOmniboxText("Pen");
1672 PressEnterAndWaitForNavigation();
1673 EXPECT_EQ(ASCIIToUTF16("Pen"), omnibox()->GetText());
1674 observer.Wait();
1675
1676 // Navigate back to NTP.
1677 content::WindowedNotificationObserver back_observer(
1678 content::NOTIFICATION_LOAD_STOP,
1679 content::NotificationService::AllSources());
1680 active_tab = browser()->tab_strip_model()->GetActiveWebContents();
1681 EXPECT_TRUE(active_tab->GetController().CanGoBack());
1682 active_tab->GetController().GoBack();
1683 back_observer.Wait();
1684
1685 // Verify that onmostvisitedchange event is dispatched when we navigate from
1686 // SRP to NTP.
1687 active_tab = browser()->tab_strip_model()->GetActiveWebContents();
1688 EXPECT_TRUE(UpdateSearchState(active_tab));
1689 EXPECT_EQ(1, on_most_visited_change_calls_);
1690 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698