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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 // stop loading before navigating. | 1508 // stop loading before navigating. |
1509 // | 1509 // |
1510 // This may result in either 0 or 1 DidStopLoading events. If there is one, | 1510 // This may result in either 0 or 1 DidStopLoading events. If there is one, |
1511 // it must happen before the CaptivePortalService sends out its test request, | 1511 // it must happen before the CaptivePortalService sends out its test request, |
1512 // so waiting for PortalObserver to see that request prevents it from | 1512 // so waiting for PortalObserver to see that request prevents it from |
1513 // confusing the MultiNavigationObservers used later. | 1513 // confusing the MultiNavigationObservers used later. |
1514 tab_strip_model->ActivateTabAt(0, true); | 1514 tab_strip_model->ActivateTabAt(0, true); |
1515 browser->OpenURL(content::OpenURLParams(timeout_url, | 1515 browser->OpenURL(content::OpenURLParams(timeout_url, |
1516 content::Referrer(), | 1516 content::Referrer(), |
1517 CURRENT_TAB, | 1517 CURRENT_TAB, |
1518 content::PAGE_TRANSITION_TYPED, | 1518 ui::PAGE_TRANSITION_TYPED, |
1519 false)); | 1519 false)); |
1520 portal_observer.WaitForResults(1); | 1520 portal_observer.WaitForResults(1); |
1521 EXPECT_FALSE(CheckPending(browser)); | 1521 EXPECT_FALSE(CheckPending(browser)); |
1522 EXPECT_EQ(1, NumLoadingTabs()); | 1522 EXPECT_EQ(1, NumLoadingTabs()); |
1523 EXPECT_EQ(CaptivePortalTabReloader::STATE_BROKEN_BY_PORTAL, | 1523 EXPECT_EQ(CaptivePortalTabReloader::STATE_BROKEN_BY_PORTAL, |
1524 GetStateOfTabReloaderAt(browser, 0)); | 1524 GetStateOfTabReloaderAt(browser, 0)); |
1525 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, | 1525 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, |
1526 GetStateOfTabReloaderAt(browser, 1)); | 1526 GetStateOfTabReloaderAt(browser, 1)); |
1527 ASSERT_TRUE(IsLoginTab(tab_strip_model->GetWebContentsAt(1))); | 1527 ASSERT_TRUE(IsLoginTab(tab_strip_model->GetWebContentsAt(1))); |
1528 | 1528 |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 } | 2095 } |
2096 | 2096 |
2097 CaptivePortalObserver portal_observer(browser()->profile()); | 2097 CaptivePortalObserver portal_observer(browser()->profile()); |
2098 MultiNavigationObserver navigation_observer; | 2098 MultiNavigationObserver navigation_observer; |
2099 | 2099 |
2100 // Navigate the tab in the inactive browser to an SSL timeout. Have to use | 2100 // Navigate the tab in the inactive browser to an SSL timeout. Have to use |
2101 // chrome::NavigateParams and NEW_BACKGROUND_TAB to avoid activating the | 2101 // chrome::NavigateParams and NEW_BACKGROUND_TAB to avoid activating the |
2102 // window. | 2102 // window. |
2103 chrome::NavigateParams params(inactive_browser, | 2103 chrome::NavigateParams params(inactive_browser, |
2104 GURL(kMockHttpsQuickTimeoutUrl), | 2104 GURL(kMockHttpsQuickTimeoutUrl), |
2105 content::PAGE_TRANSITION_TYPED); | 2105 ui::PAGE_TRANSITION_TYPED); |
2106 params.disposition = NEW_BACKGROUND_TAB; | 2106 params.disposition = NEW_BACKGROUND_TAB; |
2107 params.window_action = chrome::NavigateParams::NO_ACTION; | 2107 params.window_action = chrome::NavigateParams::NO_ACTION; |
2108 ui_test_utils::NavigateToURL(¶ms); | 2108 ui_test_utils::NavigateToURL(¶ms); |
2109 navigation_observer.WaitForNavigations(2); | 2109 navigation_observer.WaitForNavigations(2); |
2110 | 2110 |
2111 // Make sure the active window hasn't changed, and its new tab is | 2111 // Make sure the active window hasn't changed, and its new tab is |
2112 // active. | 2112 // active. |
2113 ASSERT_EQ(active_browser, | 2113 ASSERT_EQ(active_browser, |
2114 chrome::FindTabbedBrowser(browser()->profile(), true, | 2114 chrome::FindTabbedBrowser(browser()->profile(), true, |
2115 browser()->host_desktop_type())); | 2115 browser()->host_desktop_type())); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2204 content::BrowserThread::PostTask( | 2204 content::BrowserThread::PostTask( |
2205 content::BrowserThread::IO, FROM_HERE, | 2205 content::BrowserThread::IO, FROM_HERE, |
2206 base::Bind(&AddHstsHost, | 2206 base::Bind(&AddHstsHost, |
2207 make_scoped_refptr(browser()->profile()->GetRequestContext()), | 2207 make_scoped_refptr(browser()->profile()->GetRequestContext()), |
2208 http_timeout_url.host())); | 2208 http_timeout_url.host())); |
2209 | 2209 |
2210 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1); | 2210 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1); |
2211 Login(browser(), 1, 0); | 2211 Login(browser(), 1, 0); |
2212 FailLoadsAfterLogin(browser(), 1); | 2212 FailLoadsAfterLogin(browser(), 1); |
2213 } | 2213 } |
OLD | NEW |