| 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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/captive_portal/captive_portal_service.h" | 16 #include "chrome/browser/captive_portal/captive_portal_service.h" |
| 17 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" | 17 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" |
| 18 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 18 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
| 19 #include "chrome/browser/captive_portal/captive_portal_tab_reloader.h" | 19 #include "chrome/browser/captive_portal/captive_portal_tab_reloader.h" |
| 20 #include "chrome/browser/net/url_request_mock_util.h" | 20 #include "chrome/browser/net/url_request_mock_util.h" |
| 21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_commands.h" | 24 #include "chrome/browser/ui/browser_commands.h" |
| 25 #include "chrome/browser/ui/browser_finder.h" | 25 #include "chrome/browser/ui/browser_finder.h" |
| 26 #include "chrome/browser/ui/browser_navigator.h" | 26 #include "chrome/browser/ui/browser_navigator.h" |
| 27 #include "chrome/browser/ui/browser_tabstrip.h" | 27 #include "chrome/browser/ui/browser_tabstrip.h" |
| 28 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 28 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 29 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 29 #include "chrome/browser/ui/tab_contents/tab_contents.h" | |
| 30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
| 31 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/test/base/in_process_browser_test.h" | 34 #include "chrome/test/base/in_process_browser_test.h" |
| 35 #include "chrome/test/base/ui_test_utils.h" | 35 #include "chrome/test/base/ui_test_utils.h" |
| 36 #include "content/public/browser/browser_thread.h" | 36 #include "content/public/browser/browser_thread.h" |
| 37 #include "content/public/browser/navigation_controller.h" | 37 #include "content/public/browser/navigation_controller.h" |
| 38 #include "content/public/browser/notification_observer.h" | 38 #include "content/public/browser/notification_observer.h" |
| 39 #include "content/public/browser/notification_registrar.h" | 39 #include "content/public/browser/notification_registrar.h" |
| (...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 inactive_browser = browser(); | 1839 inactive_browser = browser(); |
| 1840 } else { | 1840 } else { |
| 1841 ASSERT_EQ(active_browser, browser()); | 1841 ASSERT_EQ(active_browser, browser()); |
| 1842 inactive_browser = browser2; | 1842 inactive_browser = browser2; |
| 1843 } | 1843 } |
| 1844 | 1844 |
| 1845 CaptivePortalObserver portal_observer(browser()->profile()); | 1845 CaptivePortalObserver portal_observer(browser()->profile()); |
| 1846 MultiNavigationObserver navigation_observer; | 1846 MultiNavigationObserver navigation_observer; |
| 1847 | 1847 |
| 1848 // Navigate the tab in the inactive browser to an SSL timeout. Have to use | 1848 // Navigate the tab in the inactive browser to an SSL timeout. Have to use |
| 1849 // browser::NavigateParams and NEW_BACKGROUND_TAB to avoid activating the | 1849 // chrome::NavigateParams and NEW_BACKGROUND_TAB to avoid activating the |
| 1850 // window. | 1850 // window. |
| 1851 browser::NavigateParams params(inactive_browser, | 1851 chrome::NavigateParams params(inactive_browser, |
| 1852 GURL(kMockHttpsQuickTimeoutUrl), | 1852 GURL(kMockHttpsQuickTimeoutUrl), |
| 1853 content::PAGE_TRANSITION_TYPED); | 1853 content::PAGE_TRANSITION_TYPED); |
| 1854 params.disposition = NEW_BACKGROUND_TAB; | 1854 params.disposition = NEW_BACKGROUND_TAB; |
| 1855 params.window_action = browser::NavigateParams::NO_ACTION; | 1855 params.window_action = chrome::NavigateParams::NO_ACTION; |
| 1856 ui_test_utils::NavigateToURL(¶ms); | 1856 ui_test_utils::NavigateToURL(¶ms); |
| 1857 navigation_observer.WaitForNavigations(2); | 1857 navigation_observer.WaitForNavigations(2); |
| 1858 | 1858 |
| 1859 // Make sure the active window hasn't changed, and its new tab is | 1859 // Make sure the active window hasn't changed, and its new tab is |
| 1860 // active. | 1860 // active. |
| 1861 ASSERT_EQ(active_browser, | 1861 ASSERT_EQ(active_browser, |
| 1862 browser::FindTabbedBrowser(browser()->profile(), true)); | 1862 browser::FindTabbedBrowser(browser()->profile(), true)); |
| 1863 ASSERT_EQ(1, active_browser->active_index()); | 1863 ASSERT_EQ(1, active_browser->active_index()); |
| 1864 | 1864 |
| 1865 // Check that the only two navigated tabs were the new error tab in the | 1865 // Check that the only two navigated tabs were the new error tab in the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1889 GetStateOfTabReloaderAt(active_browser, 0)); | 1889 GetStateOfTabReloaderAt(active_browser, 0)); |
| 1890 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, | 1890 EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, |
| 1891 GetStateOfTabReloaderAt(active_browser, 1)); | 1891 GetStateOfTabReloaderAt(active_browser, 1)); |
| 1892 EXPECT_TRUE(IsLoginTab(chrome::GetTabContentsAt(active_browser, 1))); | 1892 EXPECT_TRUE(IsLoginTab(chrome::GetTabContentsAt(active_browser, 1))); |
| 1893 | 1893 |
| 1894 // Simulate logging in. | 1894 // Simulate logging in. |
| 1895 Login(active_browser, 0, 1); | 1895 Login(active_browser, 0, 1); |
| 1896 } | 1896 } |
| 1897 | 1897 |
| 1898 } // namespace captive_portal | 1898 } // namespace captive_portal |
| OLD | NEW |