Chromium Code Reviews| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 for (TabContentsIterator tab_contents_it; | 478 for (TabContentsIterator tab_contents_it; |
| 479 !tab_contents_it.done(); | 479 !tab_contents_it.done(); |
| 480 ++tab_contents_it) { | 480 ++tab_contents_it) { |
| 481 if (tab_contents_it->web_contents()->IsLoading()) | 481 if (tab_contents_it->web_contents()->IsLoading()) |
| 482 ++num_loading_tabs; | 482 ++num_loading_tabs; |
| 483 } | 483 } |
| 484 return num_loading_tabs; | 484 return num_loading_tabs; |
| 485 } | 485 } |
| 486 | 486 |
| 487 bool IsLoginTab(TabContents* tab_contents) { | 487 bool IsLoginTab(TabContents* tab_contents) { |
| 488 return tab_contents->captive_portal_tab_helper()->IsLoginTab(); | 488 return captive_portal::CaptivePortalTabHelper::FromWebContents( |
| 489 tab_contents->web_contents())->IsLoginTab(); | |
|
mmenke
2012/09/19 16:11:30
nit: We're in the captive_portal namespace, so no
| |
| 489 } | 490 } |
| 490 | 491 |
| 491 // Tracks how many times each tab has been navigated since the Observer was | 492 // Tracks how many times each tab has been navigated since the Observer was |
| 492 // created. The standard TestNavigationObserver can only watch specific | 493 // created. The standard TestNavigationObserver can only watch specific |
| 493 // pre-existing tabs or loads in serial for all tabs. | 494 // pre-existing tabs or loads in serial for all tabs. |
| 494 class MultiNavigationObserver : public content::NotificationObserver { | 495 class MultiNavigationObserver : public content::NotificationObserver { |
| 495 public: | 496 public: |
| 496 MultiNavigationObserver(); | 497 MultiNavigationObserver(); |
| 497 virtual ~MultiNavigationObserver(); | 498 virtual ~MultiNavigationObserver(); |
| 498 | 499 |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1532 } | 1533 } |
| 1533 | 1534 |
| 1534 void CaptivePortalBrowserTest::SetSlowSSLLoadTime( | 1535 void CaptivePortalBrowserTest::SetSlowSSLLoadTime( |
| 1535 CaptivePortalTabReloader* tab_reloader, | 1536 CaptivePortalTabReloader* tab_reloader, |
| 1536 base::TimeDelta slow_ssl_load_time) { | 1537 base::TimeDelta slow_ssl_load_time) { |
| 1537 tab_reloader->set_slow_ssl_load_time(slow_ssl_load_time); | 1538 tab_reloader->set_slow_ssl_load_time(slow_ssl_load_time); |
| 1538 } | 1539 } |
| 1539 | 1540 |
| 1540 CaptivePortalTabReloader* CaptivePortalBrowserTest::GetTabReloader( | 1541 CaptivePortalTabReloader* CaptivePortalBrowserTest::GetTabReloader( |
| 1541 TabContents* tab_contents) const { | 1542 TabContents* tab_contents) const { |
| 1542 return tab_contents->captive_portal_tab_helper()->GetTabReloaderForTest(); | 1543 return captive_portal::CaptivePortalTabHelper::FromWebContents( |
| 1544 tab_contents->web_contents())->GetTabReloaderForTest(); | |
|
mmenke
2012/09/19 16:11:30
nit: We're in the captive_portal namespace, so no
| |
| 1543 } | 1545 } |
| 1544 | 1546 |
| 1545 // Make sure there's no test for a captive portal on HTTP timeouts. This will | 1547 // Make sure there's no test for a captive portal on HTTP timeouts. This will |
| 1546 // also trigger the link doctor page, which results in the load of a second | 1548 // also trigger the link doctor page, which results in the load of a second |
| 1547 // error page. | 1549 // error page. |
| 1548 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpTimeout) { | 1550 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpTimeout) { |
| 1549 GURL url = URLRequestFailedJob::GetMockHttpUrl(net::ERR_CONNECTION_TIMED_OUT); | 1551 GURL url = URLRequestFailedJob::GetMockHttpUrl(net::ERR_CONNECTION_TIMED_OUT); |
| 1550 NavigateToPageExpectNoTest(browser(), url, 2); | 1552 NavigateToPageExpectNoTest(browser(), url, 2); |
| 1551 } | 1553 } |
| 1552 | 1554 |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2177 base::Bind(&AddHstsHost, | 2179 base::Bind(&AddHstsHost, |
| 2178 make_scoped_refptr(browser()->profile()->GetRequestContext()), | 2180 make_scoped_refptr(browser()->profile()->GetRequestContext()), |
| 2179 http_timeout_url.host())); | 2181 http_timeout_url.host())); |
| 2180 | 2182 |
| 2181 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1); | 2183 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1); |
| 2182 Login(browser(), 1, 0); | 2184 Login(browser(), 1, 0); |
| 2183 FailLoadsAfterLogin(browser(), 1); | 2185 FailLoadsAfterLogin(browser(), 1); |
| 2184 } | 2186 } |
| 2185 | 2187 |
| 2186 } // namespace captive_portal | 2188 } // namespace captive_portal |
| OLD | NEW |