OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2673 browser()->host_desktop_type())); | 2673 browser()->host_desktop_type())); |
2674 // Navigate the new browser window so it'll be shown and we can pick the | 2674 // Navigate the new browser window so it'll be shown and we can pick the |
2675 // active window. | 2675 // active window. |
2676 ui_test_utils::NavigateToURL(browser2, GURL(url::kAboutBlankURL)); | 2676 ui_test_utils::NavigateToURL(browser2, GURL(url::kAboutBlankURL)); |
2677 | 2677 |
2678 // Generally, |browser2| will be the active window. However, if the | 2678 // Generally, |browser2| will be the active window. However, if the |
2679 // original browser window lost focus before creating the new one, such as | 2679 // original browser window lost focus before creating the new one, such as |
2680 // when running multiple tests at once, the original browser window may | 2680 // when running multiple tests at once, the original browser window may |
2681 // remain the profile's active window. | 2681 // remain the profile's active window. |
2682 Browser* active_browser = | 2682 Browser* active_browser = |
2683 chrome::FindTabbedBrowser(browser()->profile(), true, | 2683 chrome::FindTabbedBrowser(browser()->profile(), true); |
2684 browser()->host_desktop_type()); | |
2685 Browser* inactive_browser; | 2684 Browser* inactive_browser; |
2686 if (active_browser == browser2) { | 2685 if (active_browser == browser2) { |
2687 // When only one test is running at a time, the new browser will probably be | 2686 // When only one test is running at a time, the new browser will probably be |
2688 // on top, but when multiple tests are running at once, this is not | 2687 // on top, but when multiple tests are running at once, this is not |
2689 // guaranteed. | 2688 // guaranteed. |
2690 inactive_browser = browser(); | 2689 inactive_browser = browser(); |
2691 } else { | 2690 } else { |
2692 ASSERT_EQ(active_browser, browser()); | 2691 ASSERT_EQ(active_browser, browser()); |
2693 inactive_browser = browser2; | 2692 inactive_browser = browser2; |
2694 } | 2693 } |
2695 | 2694 |
2696 CaptivePortalObserver portal_observer(browser()->profile()); | 2695 CaptivePortalObserver portal_observer(browser()->profile()); |
2697 MultiNavigationObserver navigation_observer; | 2696 MultiNavigationObserver navigation_observer; |
2698 | 2697 |
2699 // Navigate the tab in the inactive browser to an SSL timeout. Have to use | 2698 // Navigate the tab in the inactive browser to an SSL timeout. Have to use |
2700 // chrome::NavigateParams and NEW_BACKGROUND_TAB to avoid activating the | 2699 // chrome::NavigateParams and NEW_BACKGROUND_TAB to avoid activating the |
2701 // window. | 2700 // window. |
2702 chrome::NavigateParams params(inactive_browser, | 2701 chrome::NavigateParams params(inactive_browser, |
2703 GURL(kMockHttpsQuickTimeoutUrl), | 2702 GURL(kMockHttpsQuickTimeoutUrl), |
2704 ui::PAGE_TRANSITION_TYPED); | 2703 ui::PAGE_TRANSITION_TYPED); |
2705 params.disposition = NEW_BACKGROUND_TAB; | 2704 params.disposition = NEW_BACKGROUND_TAB; |
2706 params.window_action = chrome::NavigateParams::NO_ACTION; | 2705 params.window_action = chrome::NavigateParams::NO_ACTION; |
2707 ui_test_utils::NavigateToURL(¶ms); | 2706 ui_test_utils::NavigateToURL(¶ms); |
2708 navigation_observer.WaitForNavigations(2); | 2707 navigation_observer.WaitForNavigations(2); |
2709 | 2708 |
2710 // Make sure the active window hasn't changed, and its new tab is | 2709 // Make sure the active window hasn't changed, and its new tab is |
2711 // active. | 2710 // active. |
2712 ASSERT_EQ(active_browser, | 2711 ASSERT_EQ(active_browser, |
2713 chrome::FindTabbedBrowser(browser()->profile(), true, | 2712 chrome::FindTabbedBrowser(browser()->profile(), true)); |
2714 browser()->host_desktop_type())); | |
2715 ASSERT_EQ(1, active_browser->tab_strip_model()->active_index()); | 2713 ASSERT_EQ(1, active_browser->tab_strip_model()->active_index()); |
2716 | 2714 |
2717 // Check that the only two navigated tabs were the new error tab in the | 2715 // Check that the only two navigated tabs were the new error tab in the |
2718 // backround windows, and the login tab in the active window. | 2716 // backround windows, and the login tab in the active window. |
2719 EXPECT_EQ(1, navigation_observer.NumNavigationsForTab( | 2717 EXPECT_EQ(1, navigation_observer.NumNavigationsForTab( |
2720 inactive_browser->tab_strip_model()->GetWebContentsAt(1))); | 2718 inactive_browser->tab_strip_model()->GetWebContentsAt(1))); |
2721 EXPECT_EQ(1, navigation_observer.NumNavigationsForTab( | 2719 EXPECT_EQ(1, navigation_observer.NumNavigationsForTab( |
2722 active_browser->tab_strip_model()->GetWebContentsAt(1))); | 2720 active_browser->tab_strip_model()->GetWebContentsAt(1))); |
2723 EXPECT_EQ(0, NumLoadingTabs()); | 2721 EXPECT_EQ(0, NumLoadingTabs()); |
2724 | 2722 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2840 | 2838 |
2841 EXPECT_EQ(CaptivePortalTabReloader::STATE_NEEDS_RELOAD, | 2839 EXPECT_EQ(CaptivePortalTabReloader::STATE_NEEDS_RELOAD, |
2842 GetStateOfTabReloaderAt(browser(), broken_tab_index)); | 2840 GetStateOfTabReloaderAt(browser(), broken_tab_index)); |
2843 | 2841 |
2844 WaitForInterstitialAttach(broken_tab_contents); | 2842 WaitForInterstitialAttach(broken_tab_contents); |
2845 portal_observer.WaitForResults(1); | 2843 portal_observer.WaitForResults(1); |
2846 | 2844 |
2847 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, | 2845 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, |
2848 GetInterstitialType(broken_tab_contents)); | 2846 GetInterstitialType(broken_tab_contents)); |
2849 } | 2847 } |
OLD | NEW |