Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: chrome/browser/captive_portal/captive_portal_browsertest.cc

Issue 11779019: browser: Move FindTabbedBrowser() function into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/enrollment_dialog_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 Browser* browser2 = new Browser(Browser::CreateParams(browser()->profile())); 2063 Browser* browser2 = new Browser(Browser::CreateParams(browser()->profile()));
2064 // Navigate the new browser window so it'll be shown and we can pick the 2064 // Navigate the new browser window so it'll be shown and we can pick the
2065 // active window. 2065 // active window.
2066 ui_test_utils::NavigateToURL(browser2, GURL(chrome::kAboutBlankURL)); 2066 ui_test_utils::NavigateToURL(browser2, GURL(chrome::kAboutBlankURL));
2067 2067
2068 // Generally, |browser2| will be the active window. However, if the 2068 // Generally, |browser2| will be the active window. However, if the
2069 // original browser window lost focus before creating the new one, such as 2069 // original browser window lost focus before creating the new one, such as
2070 // when running multiple tests at once, the original browser window may 2070 // when running multiple tests at once, the original browser window may
2071 // remain the profile's active window. 2071 // remain the profile's active window.
2072 Browser* active_browser = 2072 Browser* active_browser =
2073 browser::FindTabbedBrowser(browser()->profile(), true, 2073 chrome::FindTabbedBrowser(browser()->profile(), true,
2074 browser()->host_desktop_type()); 2074 browser()->host_desktop_type());
2075 Browser* inactive_browser; 2075 Browser* inactive_browser;
2076 if (active_browser == browser2) { 2076 if (active_browser == browser2) {
2077 // When only one test is running at a time, the new browser will probably be 2077 // When only one test is running at a time, the new browser will probably be
2078 // on top, but when multiple tests are running at once, this is not 2078 // on top, but when multiple tests are running at once, this is not
2079 // guaranteed. 2079 // guaranteed.
2080 inactive_browser = browser(); 2080 inactive_browser = browser();
2081 } else { 2081 } else {
2082 ASSERT_EQ(active_browser, browser()); 2082 ASSERT_EQ(active_browser, browser());
2083 inactive_browser = browser2; 2083 inactive_browser = browser2;
2084 } 2084 }
2085 2085
2086 CaptivePortalObserver portal_observer(browser()->profile()); 2086 CaptivePortalObserver portal_observer(browser()->profile());
2087 MultiNavigationObserver navigation_observer; 2087 MultiNavigationObserver navigation_observer;
2088 2088
2089 // Navigate the tab in the inactive browser to an SSL timeout. Have to use 2089 // Navigate the tab in the inactive browser to an SSL timeout. Have to use
2090 // chrome::NavigateParams and NEW_BACKGROUND_TAB to avoid activating the 2090 // chrome::NavigateParams and NEW_BACKGROUND_TAB to avoid activating the
2091 // window. 2091 // window.
2092 chrome::NavigateParams params(inactive_browser, 2092 chrome::NavigateParams params(inactive_browser,
2093 GURL(kMockHttpsQuickTimeoutUrl), 2093 GURL(kMockHttpsQuickTimeoutUrl),
2094 content::PAGE_TRANSITION_TYPED); 2094 content::PAGE_TRANSITION_TYPED);
2095 params.disposition = NEW_BACKGROUND_TAB; 2095 params.disposition = NEW_BACKGROUND_TAB;
2096 params.window_action = chrome::NavigateParams::NO_ACTION; 2096 params.window_action = chrome::NavigateParams::NO_ACTION;
2097 ui_test_utils::NavigateToURL(&params); 2097 ui_test_utils::NavigateToURL(&params);
2098 navigation_observer.WaitForNavigations(2); 2098 navigation_observer.WaitForNavigations(2);
2099 2099
2100 // Make sure the active window hasn't changed, and its new tab is 2100 // Make sure the active window hasn't changed, and its new tab is
2101 // active. 2101 // active.
2102 ASSERT_EQ(active_browser, 2102 ASSERT_EQ(active_browser,
2103 browser::FindTabbedBrowser(browser()->profile(), true, 2103 chrome::FindTabbedBrowser(browser()->profile(), true,
2104 browser()->host_desktop_type())); 2104 browser()->host_desktop_type()));
2105 ASSERT_EQ(1, active_browser->tab_strip_model()->active_index()); 2105 ASSERT_EQ(1, active_browser->tab_strip_model()->active_index());
2106 2106
2107 // Check that the only two navigated tabs were the new error tab in the 2107 // Check that the only two navigated tabs were the new error tab in the
2108 // backround windows, and the login tab in the active window. 2108 // backround windows, and the login tab in the active window.
2109 EXPECT_EQ(1, navigation_observer.NumNavigationsForTab( 2109 EXPECT_EQ(1, navigation_observer.NumNavigationsForTab(
2110 inactive_browser->tab_strip_model()->GetWebContentsAt(1))); 2110 inactive_browser->tab_strip_model()->GetWebContentsAt(1)));
2111 EXPECT_EQ(1, navigation_observer.NumNavigationsForTab( 2111 EXPECT_EQ(1, navigation_observer.NumNavigationsForTab(
2112 active_browser->tab_strip_model()->GetWebContentsAt(1))); 2112 active_browser->tab_strip_model()->GetWebContentsAt(1)));
2113 EXPECT_EQ(0, NumLoadingTabs()); 2113 EXPECT_EQ(0, NumLoadingTabs());
2114 2114
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 base::Bind(&AddHstsHost, 2195 base::Bind(&AddHstsHost,
2196 make_scoped_refptr(browser()->profile()->GetRequestContext()), 2196 make_scoped_refptr(browser()->profile()->GetRequestContext()),
2197 http_timeout_url.host())); 2197 http_timeout_url.host()));
2198 2198
2199 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1); 2199 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1);
2200 Login(browser(), 1, 0); 2200 Login(browser(), 1, 0);
2201 FailLoadsAfterLogin(browser(), 1); 2201 FailLoadsAfterLogin(browser(), 1);
2202 } 2202 }
2203 2203
2204 } // namespace captive_portal 2204 } // namespace captive_portal
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/enrollment_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698