summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_focus_uitest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 20:07:11 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 20:07:11 +0000
commit95409e1020037b0bbfbce17f861d3de090d10186 (patch)
tree90a893af1247b1d4a3767c5ab14aae797f467946 /chrome/browser/browser_focus_uitest.cc
parent701e869b30deffda579c5c413cf1d73defee34fa (diff)
downloadchromium_src-95409e1020037b0bbfbce17f861d3de090d10186.zip
chromium_src-95409e1020037b0bbfbce17f861d3de090d10186.tar.gz
chromium_src-95409e1020037b0bbfbce17f861d3de090d10186.tar.bz2
Test server cleanup patch of death:
- reduce the number of different classes - clean up the internal code - modify the interface to expose less internal details (this will allow more flexibility with port numbers) TEST=many BUG=49680 Review URL: http://codereview.chromium.org/3080029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_focus_uitest.cc')
-rw-r--r--chrome/browser/browser_focus_uitest.cc57
1 files changed, 23 insertions, 34 deletions
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index 84a2ba8..6f2e0ad 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -187,11 +187,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, ClickingMovesFocus) {
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BrowsersRememberFocus) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// First we navigate to our test page.
- GURL url = server->TestServerPage(kSimplePage);
+ GURL url = test_server()->GetURL(kSimplePage);
ui_test_utils::NavigateToURL(browser(), url);
gfx::NativeWindow window = browser()->window()->GetNativeHandle();
@@ -252,11 +251,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BrowsersRememberFocus) {
// Tabs remember focus.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabsRememberFocus) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// First we navigate to our test page.
- GURL url = server->TestServerPage(kSimplePage);
+ GURL url = test_server()->GetURL(kSimplePage);
ui_test_utils::NavigateToURL(browser(), url);
// Create several tabs.
@@ -331,11 +329,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabsRememberFocus) {
// Tabs remember focus with find-in-page box.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocusFindInPage) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// First we navigate to our test page.
- GURL url = server->TestServerPage(kSimplePage);
+ GURL url = test_server()->GetURL(kSimplePage);
ui_test_utils::NavigateToURL(browser(), url);
browser()->Find();
@@ -374,11 +371,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocusFindInPage) {
// Background window does not steal focus.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// First we navigate to our test page.
- GURL url = server->TestServerPage(kSimplePage);
+ GURL url = test_server()->GetURL(kSimplePage);
ui_test_utils::NavigateToURL(browser(), url);
// Open a new browser window.
@@ -410,7 +406,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) {
unfocused_browser = browser();
#endif
- GURL steal_focus_url = server->TestServerPage(kStealFocusPage);
+ GURL steal_focus_url = test_server()->GetURL(kStealFocusPage);
ui_test_utils::NavigateToURL(unfocused_browser, steal_focus_url);
// Activate the first browser.
@@ -431,11 +427,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) {
// Page cannot steal focus when focus is on location bar.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// Open the page that steals focus.
- GURL url = server->TestServerPage(kStealFocusPage);
+ GURL url = test_server()->GetURL(kStealFocusPage);
ui_test_utils::NavigateToURL(browser(), url);
browser()->FocusLocationBar();
@@ -454,11 +449,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) {
// RenderWidget::didFocus()).
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// First we navigate to our test page.
- GURL url = server->TestServerPage(kTypicalPage);
+ GURL url = test_server()->GetURL(kTypicalPage);
ui_test_utils::NavigateToURL(browser(), url);
browser()->FocusLocationBar();
@@ -548,11 +542,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) {
// Focus traversal while an interstitial is showing.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// First we navigate to our test page.
- GURL url = server->TestServerPage(kSimplePage);
+ GURL url = test_server()->GetURL(kSimplePage);
ui_test_utils::NavigateToURL(browser(), url);
// Focus should be on the page.
@@ -640,11 +633,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) {
// Focus stays on page with interstitials.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, InterstitialFocus) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// First we navigate to our test page.
- GURL url = server->TestServerPage(kSimplePage);
+ GURL url = test_server()->GetURL(kSimplePage);
ui_test_utils::NavigateToURL(browser(), url);
// Page should have focus.
@@ -677,11 +669,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, InterstitialFocus) {
// Make sure Find box can request focus, even when it is already open.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// Open some page (any page that doesn't steal focus).
- GURL url = server->TestServerPage(kTypicalPage);
+ GURL url = test_server()->GetURL(kTypicalPage);
ui_test_utils::NavigateToURL(browser(), url);
gfx::NativeWindow window = browser()->window()->GetNativeHandle();
@@ -779,8 +770,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FLAKY_TabInitialFocus) {
// Tests that focus goes where expected when using reload.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// Open the new tab, reload.
browser()->NewTab();
@@ -792,7 +782,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) {
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
// Open a regular page, focus the location bar, reload.
- ui_test_utils::NavigateToURL(browser(), server->TestServerPage(kSimplePage));
+ ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage));
browser()->FocusLocationBar();
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
browser()->Reload(CURRENT_TAB);
@@ -814,11 +804,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) {
// Tests that focus goes where expected when using reload on a crashed tab.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusOnReloadCrashedTab) {
BringBrowserWindowToFront();
- net::HTTPTestServer* server = StartHTTPServer();
- ASSERT_TRUE(server);
+ ASSERT_TRUE(test_server()->Start());
// Open a regular page, crash, reload.
- ui_test_utils::NavigateToURL(browser(), server->TestServerPage(kSimplePage));
+ ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage));
ui_test_utils::CrashTab(browser()->GetSelectedTabContents());
browser()->Reload(CURRENT_TAB);
ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));