| 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 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 EXPECT_EQ(num_timed_out_tabs, NumBrokenTabs() - NumLoadingTabs()); | 1312 EXPECT_EQ(num_timed_out_tabs, NumBrokenTabs() - NumLoadingTabs()); |
| 1313 | 1313 |
| 1314 int login_tab_index = tab_strip_model->active_index(); | 1314 int login_tab_index = tab_strip_model->active_index(); |
| 1315 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, | 1315 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, |
| 1316 GetStateOfTabReloader(tab_strip_model->GetActiveWebContents())); | 1316 GetStateOfTabReloader(tab_strip_model->GetActiveWebContents())); |
| 1317 ASSERT_TRUE(IsLoginTab(browser->tab_strip_model()->GetActiveWebContents())); | 1317 ASSERT_TRUE(IsLoginTab(browser->tab_strip_model()->GetActiveWebContents())); |
| 1318 | 1318 |
| 1319 // Do the navigation. | 1319 // Do the navigation. |
| 1320 content::RenderViewHost* render_view_host = | 1320 content::RenderViewHost* render_view_host = |
| 1321 tab_strip_model->GetActiveWebContents()->GetRenderViewHost(); | 1321 tab_strip_model->GetActiveWebContents()->GetRenderViewHost(); |
| 1322 render_view_host->ExecuteJavascriptInWebFrame(string16(), | 1322 render_view_host->ExecuteJavascriptInWebFrame(base::string16(), |
| 1323 ASCIIToUTF16("submitForm()")); | 1323 ASCIIToUTF16("submitForm()")); |
| 1324 | 1324 |
| 1325 portal_observer.WaitForResults(1); | 1325 portal_observer.WaitForResults(1); |
| 1326 navigation_observer.WaitForNavigations(1); | 1326 navigation_observer.WaitForNavigations(1); |
| 1327 | 1327 |
| 1328 // Check the captive portal result. | 1328 // Check the captive portal result. |
| 1329 EXPECT_EQ(RESULT_BEHIND_CAPTIVE_PORTAL, | 1329 EXPECT_EQ(RESULT_BEHIND_CAPTIVE_PORTAL, |
| 1330 portal_observer.captive_portal_result()); | 1330 portal_observer.captive_portal_result()); |
| 1331 EXPECT_EQ(1, portal_observer.num_results_received()); | 1331 EXPECT_EQ(1, portal_observer.num_results_received()); |
| 1332 EXPECT_FALSE(CheckPending(browser)); | 1332 EXPECT_FALSE(CheckPending(browser)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1360 | 1360 |
| 1361 // Verify that the login page is on top. | 1361 // Verify that the login page is on top. |
| 1362 int login_tab_index = tab_strip_model->active_index(); | 1362 int login_tab_index = tab_strip_model->active_index(); |
| 1363 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, | 1363 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, |
| 1364 GetStateOfTabReloaderAt(browser, login_tab_index)); | 1364 GetStateOfTabReloaderAt(browser, login_tab_index)); |
| 1365 ASSERT_TRUE(IsLoginTab(tab_strip_model->GetWebContentsAt(login_tab_index))); | 1365 ASSERT_TRUE(IsLoginTab(tab_strip_model->GetWebContentsAt(login_tab_index))); |
| 1366 | 1366 |
| 1367 // Trigger a navigation. | 1367 // Trigger a navigation. |
| 1368 content::RenderViewHost* render_view_host = | 1368 content::RenderViewHost* render_view_host = |
| 1369 tab_strip_model->GetActiveWebContents()->GetRenderViewHost(); | 1369 tab_strip_model->GetActiveWebContents()->GetRenderViewHost(); |
| 1370 render_view_host->ExecuteJavascriptInWebFrame(string16(), | 1370 render_view_host->ExecuteJavascriptInWebFrame(base::string16(), |
| 1371 ASCIIToUTF16("submitForm()")); | 1371 ASCIIToUTF16("submitForm()")); |
| 1372 | 1372 |
| 1373 portal_observer.WaitForResults(1); | 1373 portal_observer.WaitForResults(1); |
| 1374 | 1374 |
| 1375 // Wait for all the timed out tabs to reload. | 1375 // Wait for all the timed out tabs to reload. |
| 1376 navigation_observer.WaitForNavigations(1 + num_timed_out_tabs); | 1376 navigation_observer.WaitForNavigations(1 + num_timed_out_tabs); |
| 1377 EXPECT_EQ(1, portal_observer.num_results_received()); | 1377 EXPECT_EQ(1, portal_observer.num_results_received()); |
| 1378 | 1378 |
| 1379 // The tabs that were loading before should still be loading, and now be in | 1379 // The tabs that were loading before should still be loading, and now be in |
| 1380 // STATE_NEEDS_RELOAD. | 1380 // STATE_NEEDS_RELOAD. |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 // like a cross between a hung tab (Load was never committed) and a tab at an | 1715 // like a cross between a hung tab (Load was never committed) and a tab at an |
| 1716 // error page (The load was stopped). | 1716 // error page (The load was stopped). |
| 1717 URLRequestMockCaptivePortalJobFactory::SetBehindCaptivePortal(false); | 1717 URLRequestMockCaptivePortalJobFactory::SetBehindCaptivePortal(false); |
| 1718 MultiNavigationObserver navigation_observer; | 1718 MultiNavigationObserver navigation_observer; |
| 1719 CaptivePortalObserver portal_observer(browser()->profile()); | 1719 CaptivePortalObserver portal_observer(browser()->profile()); |
| 1720 | 1720 |
| 1721 TabStripModel* tab_strip_model = browser()->tab_strip_model(); | 1721 TabStripModel* tab_strip_model = browser()->tab_strip_model(); |
| 1722 content::RenderViewHost* render_view_host = | 1722 content::RenderViewHost* render_view_host = |
| 1723 tab_strip_model->GetActiveWebContents()->GetRenderViewHost(); | 1723 tab_strip_model->GetActiveWebContents()->GetRenderViewHost(); |
| 1724 render_view_host->ExecuteJavascriptInWebFrame( | 1724 render_view_host->ExecuteJavascriptInWebFrame( |
| 1725 string16(), | 1725 base::string16(), |
| 1726 ASCIIToUTF16("submitForm()")); | 1726 ASCIIToUTF16("submitForm()")); |
| 1727 | 1727 |
| 1728 // The captive portal tab navigation will trigger a captive portal check, | 1728 // The captive portal tab navigation will trigger a captive portal check, |
| 1729 // and reloading the original tab will bring up the interstitial page again, | 1729 // and reloading the original tab will bring up the interstitial page again, |
| 1730 // triggering a second captive portal check. | 1730 // triggering a second captive portal check. |
| 1731 portal_observer.WaitForResults(2); | 1731 portal_observer.WaitForResults(2); |
| 1732 | 1732 |
| 1733 // Wait for both tabs to finish loading. | 1733 // Wait for both tabs to finish loading. |
| 1734 navigation_observer.WaitForNavigations(2); | 1734 navigation_observer.WaitForNavigations(2); |
| 1735 EXPECT_EQ(2, portal_observer.num_results_received()); | 1735 EXPECT_EQ(2, portal_observer.num_results_received()); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2197 base::Bind(&AddHstsHost, | 2197 base::Bind(&AddHstsHost, |
| 2198 make_scoped_refptr(browser()->profile()->GetRequestContext()), | 2198 make_scoped_refptr(browser()->profile()->GetRequestContext()), |
| 2199 http_timeout_url.host())); | 2199 http_timeout_url.host())); |
| 2200 | 2200 |
| 2201 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1); | 2201 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1); |
| 2202 Login(browser(), 1, 0); | 2202 Login(browser(), 1, 0); |
| 2203 FailLoadsAfterLogin(browser(), 1); | 2203 FailLoadsAfterLogin(browser(), 1); |
| 2204 } | 2204 } |
| 2205 | 2205 |
| 2206 } // namespace captive_portal | 2206 } // namespace captive_portal |
| OLD | NEW |