summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_focus_uitest.cc
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-30 21:49:21 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-30 21:49:21 +0000
commitbaf9e25f103eb1138fcd41d917728faee80e62e2 (patch)
tree8d9b78fc3afb7e9c79570873b2c7d5529d1a02be /chrome/browser/browser_focus_uitest.cc
parent1ea316d7174804dd49c43fe4abcb15620b248634 (diff)
downloadchromium_src-baf9e25f103eb1138fcd41d917728faee80e62e2.zip
chromium_src-baf9e25f103eb1138fcd41d917728faee80e62e2.tar.gz
chromium_src-baf9e25f103eb1138fcd41d917728faee80e62e2.tar.bz2
Add FTP unit test in preparation for portable FTP implementation.
Clean up test server code. Originally from issue 12939, written by Ibrar Ahmed (ibrar.ahmed@gmail.com) Review URL: http://codereview.chromium.org/16490 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7508 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_focus_uitest.cc')
-rw-r--r--chrome/browser/browser_focus_uitest.cc38
1 files changed, 25 insertions, 13 deletions
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index ca89162..160c3ab 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -55,10 +55,12 @@ bool ActivateTabByClick(AutomationProxy* automation,
} // namespace
TEST_F(BrowserFocusTest, BrowsersRememberFocus) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// First we navigate to our test page.
- GURL url = server.TestServerPageW(kSimplePage);
+ GURL url = server->TestServerPageW(kSimplePage);
scoped_ptr<TabProxy> tab(GetActiveTab());
EXPECT_NE(AUTOMATION_MSG_NAVIGATION_ERROR, tab->NavigateToURL(url));
@@ -130,7 +132,9 @@ TEST_F(BrowserFocusTest, BrowsersRememberFocus) {
// Tabs remember focus.
TEST_F(BrowserFocusTest, TabsRememberFocus) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
scoped_ptr<WindowProxy> window(automation()->GetActiveWindow());
ASSERT_TRUE(window.get() != NULL);
@@ -139,7 +143,7 @@ TEST_F(BrowserFocusTest, TabsRememberFocus) {
ASSERT_TRUE(browser.get() != NULL);
// First we navigate to our test page.
- GURL url = server.TestServerPageW(kSimplePage);
+ GURL url = server->TestServerPageW(kSimplePage);
scoped_ptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(url);
@@ -194,10 +198,12 @@ TEST_F(BrowserFocusTest, TabsRememberFocus) {
// Background window does not steal focus.
TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// First we navigate to our test page.
- GURL simple_page_url = server.TestServerPageW(kSimplePage);
+ GURL simple_page_url = server->TestServerPageW(kSimplePage);
scoped_ptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(simple_page_url);
@@ -215,7 +221,7 @@ TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) {
automation()->GetBrowserForWindow(new_window.get()));
ASSERT_TRUE(new_browser.get() != NULL);
- GURL steal_focus_url = server.TestServerPageW(kStealFocusPage);
+ GURL steal_focus_url = server->TestServerPageW(kStealFocusPage);
new_browser->AppendTab(steal_focus_url);
// Make the first browser active
@@ -232,10 +238,12 @@ TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) {
// Page cannot steal focus when focus is on location bar.
TEST_F(BrowserFocusTest, LocationBarLockFocus) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// Open the page that steals focus.
- GURL url = server.TestServerPageW(kStealFocusPage);
+ GURL url = server->TestServerPageW(kStealFocusPage);
scoped_ptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(url);
@@ -264,10 +272,12 @@ TEST_F(BrowserFocusTest, LocationBarLockFocus) {
// Focus traversal
TEST_F(BrowserFocusTest, FocusTraversal) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// Open the page the test page.
- GURL url = server.TestServerPageW(kTypicalPage);
+ GURL url = server->TestServerPageW(kTypicalPage);
scoped_ptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(url);
@@ -337,10 +347,12 @@ TEST_F(BrowserFocusTest, FocusTraversal) {
// Make sure Find box can request focus, even when it is already open.
TEST_F(BrowserFocusTest, FindFocusTest) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// Open some page (any page that doesn't steal focus).
- GURL url = server.TestServerPageW(kTypicalPage);
+ GURL url = server->TestServerPageW(kTypicalPage);
scoped_ptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(url);