summaryrefslogtreecommitdiffstats
path: root/chrome
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
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')
-rw-r--r--chrome/browser/browser_focus_uitest.cc38
-rw-r--r--chrome/browser/browser_uitest.cc8
-rw-r--r--chrome/browser/errorpage_uitest.cc6
-rw-r--r--chrome/browser/history/redirect_uitest.cc128
-rw-r--r--chrome/browser/interstitial_page_uitest.cc35
-rw-r--r--chrome/browser/login_prompt_uitest.cc42
-rw-r--r--chrome/browser/printing/printing_layout_uitest.cc33
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc29
-rw-r--r--chrome/browser/session_history_uitest.cc62
-rw-r--r--chrome/browser/sessions/session_restore_uitest.cc6
-rw-r--r--chrome/browser/ssl_uitest.cc35
-rw-r--r--chrome/browser/tab_restore_uitest.cc16
-rw-r--r--chrome/browser/url_fetcher_unittest.cc48
-rw-r--r--chrome/browser/view_source_uitest.cc24
-rw-r--r--chrome/browser/views/find_bar_win_interactive_uitest.cc6
-rw-r--r--chrome/browser/views/find_bar_win_uitest.cc54
-rw-r--r--chrome/common/chrome_plugin_unittest.cc7
-rw-r--r--chrome/common/net/cache_uitest.cc6
-rw-r--r--chrome/test/ui/inspector_controller_uitest.cc14
19 files changed, 375 insertions, 222 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);
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc
index f4ca495..237c0bd 100644
--- a/chrome/browser/browser_uitest.cc
+++ b/chrome/browser/browser_uitest.cc
@@ -240,7 +240,9 @@ TEST_F(BrowserTest, NullOpenerRedirectForksProcess) {
return;
const wchar_t kDocRoot[] = L"chrome/test/data";
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
std::wstring test_file(test_data_directory_);
scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
scoped_ptr<TabProxy> tab(window->GetActiveTab());
@@ -278,7 +280,9 @@ TEST_F(BrowserTest, OtherRedirectsDontForkProcess) {
return;
const wchar_t kDocRoot[] = L"chrome/test/data";
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
std::wstring test_file(test_data_directory_);
scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
scoped_ptr<TabProxy> tab(window->GetActiveTab());
diff --git a/chrome/browser/errorpage_uitest.cc b/chrome/browser/errorpage_uitest.cc
index ec63430..a071fb2 100644
--- a/chrome/browser/errorpage_uitest.cc
+++ b/chrome/browser/errorpage_uitest.cc
@@ -38,8 +38,10 @@ TEST_F(ErrorPageTest, IFrame404) {
// In this test, the iframe sets the title of the parent page to "SUCCESS"
// when the iframe loads. If the iframe fails to load (because an alternate
// error page loads instead), then the title will remain as "FAIL".
- TestServer server(L"chrome/test/data");
- GURL test_url = server.TestServerPage("files/iframe404.html");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
+ GURL test_url = server->TestServerPage("files/iframe404.html");
NavigateToURL(test_url);
// Verify that the url is in the title. Since it's set via Javascript, we
diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc
index 272c59a..4002500 100644
--- a/chrome/browser/history/redirect_uitest.cc
+++ b/chrome/browser/history/redirect_uitest.cc
@@ -30,10 +30,12 @@ class RedirectTest : public UITest {
// Tests a single server redirect
TEST_F(RedirectTest, Server) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
- GURL final_url = server.TestServerPageW(std::wstring());
- GURL first_url = server.TestServerPageW(
+ GURL final_url = server->TestServerPageW(std::wstring());
+ GURL first_url = server->TestServerPageW(
std::wstring(L"server-redirect?") + UTF8ToWide(final_url.spec()));
NavigateToURL(first_url);
@@ -50,10 +52,12 @@ TEST_F(RedirectTest, Server) {
// Tests a single client redirect.
TEST_F(RedirectTest, Client) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
- GURL final_url = server.TestServerPageW(std::wstring());
- GURL first_url = server.TestServerPageW(
+ GURL final_url = server->TestServerPageW(std::wstring());
+ GURL first_url = server->TestServerPageW(
std::wstring(L"client-redirect?") + UTF8ToWide(final_url.spec()));
// We need the sleep for the client redirects, because it appears as two
@@ -72,30 +76,32 @@ TEST_F(RedirectTest, Client) {
}
TEST_F(RedirectTest, ClientEmptyReferer) {
- TestServer server(kDocRoot);
-
- GURL final_url = server.TestServerPageW(std::wstring());
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, L"file_client_redirect.html");
- GURL first_url = net::FilePathToFileURL(test_file);
-
- NavigateToURL(first_url);
- std::vector<GURL> redirects;
- // We need the sleeps for the client redirects, because it appears as two
- // page visits in the browser. And note for this test the browser actually
- // loads the html file on disk, rather than just getting a response from
- // the TestServer.
- for (int i = 0; i < 10; ++i) {
- Sleep(kWaitForActionMaxMsec / 10);
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
- ASSERT_TRUE(tab_proxy.get());
- ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
- if (!redirects.empty())
- break;
- }
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+
+ GURL final_url = server->TestServerPageW(std::wstring());
+ std::wstring test_file = test_data_directory_;
+ file_util::AppendToPath(&test_file, L"file_client_redirect.html");
+ GURL first_url = net::FilePathToFileURL(test_file);
- EXPECT_EQ(1, redirects.size());
- EXPECT_EQ(final_url.spec(), redirects[0].spec());
+ NavigateToURL(first_url);
+ std::vector<GURL> redirects;
+ // We need the sleeps for the client redirects, because it appears as two
+ // page visits in the browser. And note for this test the browser actually
+ // loads the html file on disk, rather than just getting a response from
+ // the TestServer.
+ for (int i = 0; i < 10; ++i) {
+ Sleep(kWaitForActionMaxMsec / 10);
+ scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ ASSERT_TRUE(tab_proxy.get());
+ ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
+ if (!redirects.empty())
+ break;
+ }
+
+ EXPECT_EQ(1, redirects.size());
+ EXPECT_EQ(final_url.spec(), redirects[0].spec());
}
// Tests to make sure a location change when a pending redirect exists isn't
@@ -136,14 +142,16 @@ TEST_F(RedirectTest, ClientCancelled) {
// TODO(creis): This is disabled temporarily while I figure out why it is
// failing.
TEST_F(RedirectTest, DISABLED_ClientServerServer) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
- GURL final_url = server.TestServerPageW(std::wstring());
- GURL next_to_last = server.TestServerPageW(
+ GURL final_url = server->TestServerPageW(std::wstring());
+ GURL next_to_last = server->TestServerPageW(
std::wstring(L"server-redirect?") + UTF8ToWide(final_url.spec()));
- GURL second_url = server.TestServerPageW(
+ GURL second_url = server->TestServerPageW(
std::wstring(L"server-redirect?") + UTF8ToWide(next_to_last.spec()));
- GURL first_url = server.TestServerPageW(
+ GURL first_url = server->TestServerPageW(
std::wstring(L"client-redirect?") + UTF8ToWide(second_url.spec()));
std::vector<GURL> redirects;
@@ -168,12 +176,14 @@ TEST_F(RedirectTest, DISABLED_ClientServerServer) {
// Tests that the "#reference" gets preserved across server redirects.
TEST_F(RedirectTest, ServerReference) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
const std::string ref("reference");
- GURL final_url = server.TestServerPageW(std::wstring());
- GURL initial_url = server.TestServerPageW(
+ GURL final_url = server->TestServerPageW(std::wstring());
+ GURL initial_url = server->TestServerPageW(
std::wstring(L"server-redirect?") + UTF8ToWide(final_url.spec()) +
L"#" + UTF8ToWide(ref));
@@ -187,12 +197,14 @@ TEST_F(RedirectTest, ServerReference) {
// A) does not crash the browser or confuse the redirect chain, see bug 1080873
// B) does not take place.
TEST_F(RedirectTest, NoHttpToFile) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
std::wstring test_file = test_data_directory_;
file_util::AppendToPath(&test_file, L"http_to_file.html");
GURL file_url = net::FilePathToFileURL(test_file);
- GURL initial_url = server.TestServerPageW(
+ GURL initial_url = server->TestServerPageW(
std::wstring(L"client-redirect?") + UTF8ToWide(file_url.spec()));
NavigateToURL(initial_url);
@@ -208,7 +220,10 @@ TEST_F(RedirectTest, NoHttpToFile) {
// Ensures that non-user initiated location changes (within page) are
// flagged as client redirects. See bug 1139823.
TEST_F(RedirectTest, ClientFragments) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+
std::wstring test_file = test_data_directory_;
file_util::AppendToPath(&test_file, L"ref_redirect.html");
GURL first_url = net::FilePathToFileURL(test_file);
@@ -229,24 +244,27 @@ TEST_F(RedirectTest, ClientFragments) {
}
// TODO(timsteele): This is disabled because our current testserver can't
-// handle multiple requests in parallel, making it hang on the first request to
-// /slow?60. It's unable to serve our second request for files/title2.html until
-// /slow? completes, which doesn't give the desired behavior. We could
-// alternatively load the second page from disk, but we would need to start the
-// browser for this testcase with --process-per-tab, and I don't think we can do
-// this at test-case-level granularity at the moment.
-TEST_F(RedirectTest, DISABLED_ClientCancelledByNewNavigationAfterProvisionalLoad) {
+// handle multiple requests in parallel, making it hang on the first request
+// to /slow?60. It's unable to serve our second request for files/title2.html
+// until /slow? completes, which doesn't give the desired behavior. We could
+// alternatively load the second page from disk, but we would need to start
+// the browser for this testcase with --process-per-tab, and I don't think
+// we can do this at test-case-level granularity at the moment.
+TEST_F(RedirectTest,
+ DISABLED_ClientCancelledByNewNavigationAfterProvisionalLoad) {
// We want to initiate a second navigation after the provisional load for
// the client redirect destination has started, but before this load is
// committed. To achieve this, we tell the browser to load a slow page,
// which causes it to start a provisional load, and while it is waiting
// for the response (which means it hasn't committed the load for the client
// redirect destination page yet), we issue a new navigation request.
- TestServer server(kDocRoot);
-
- GURL final_url = server.TestServerPageW(std::wstring(L"files/title2.html"));
- GURL slow = server.TestServerPageW(std::wstring(L"slow?60"));
- GURL first_url = server.TestServerPageW(
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+
+ GURL final_url = server->TestServerPageW(std::wstring(L"files/title2.html"));
+ GURL slow = server->TestServerPageW(std::wstring(L"slow?60"));
+ GURL first_url = server->TestServerPageW(
std::wstring(L"client-redirect?") + UTF8ToWide(slow.spec()));
std::vector<GURL> redirects;
@@ -256,7 +274,7 @@ TEST_F(RedirectTest, DISABLED_ClientCancelledByNewNavigationAfterProvisionalLoad
// started it's provisional load for the client redirect destination page but
// hasn't completed. Our time is now!
NavigateToURL(final_url);
-
+
std::wstring tab_title;
std::wstring final_url_title = L"Title Of Awesomeness";
// Wait till the final page has been loaded.
@@ -271,9 +289,9 @@ TEST_F(RedirectTest, DISABLED_ClientCancelledByNewNavigationAfterProvisionalLoad
}
}
- // Check to make sure the navigation did in fact take place and we are
+ // Check to make sure the navigation did in fact take place and we are
// at the expected page.
- EXPECT_EQ(final_url_title, tab_title);
+ EXPECT_EQ(final_url_title, tab_title);
bool final_navigation_not_redirect = true;
// Check to make sure our request for files/title2.html doesn't get flagged
diff --git a/chrome/browser/interstitial_page_uitest.cc b/chrome/browser/interstitial_page_uitest.cc
index a50908c9..c3d675c 100644
--- a/chrome/browser/interstitial_page_uitest.cc
+++ b/chrome/browser/interstitial_page_uitest.cc
@@ -52,10 +52,13 @@ class InterstitialPageTest : public UITest {
// causes the actual navigation entry (title) to be modified by the content of
// the interstitial.
TEST_F(InterstitialPageTest, TestShowHideInterstitial) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+
::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(),
- server.TestServerPageW(L"files/interstitial_page/google.html"));
+ server->TestServerPageW(L"files/interstitial_page/google.html"));
NavigationEntry::PageType page_type;
EXPECT_TRUE(tab->GetPageType(&page_type));
EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
@@ -78,10 +81,13 @@ TEST_F(InterstitialPageTest, TestShowHideInterstitial) {
// the interstitial. In the mean time, we are treating Back like cancelling
// the interstitial, which breaks this test because no notification occurs.
TEST_F(InterstitialPageTest, DISABLED_TestShowInterstitialThenBack) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+
::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(),
- server.TestServerPageW(L"files/interstitial_page/google.html"));
+ server->TestServerPageW(L"files/interstitial_page/google.html"));
EXPECT_EQ(L"Google", GetActiveTabTitle());
tab->ShowInterstitialPage(kInterstitialPageHTMLText, action_timeout_ms());
@@ -94,26 +100,31 @@ TEST_F(InterstitialPageTest, DISABLED_TestShowInterstitialThenBack) {
// Shows an interstitial page then navigates to a new URL.
// Flacky on Windows 2000 bot. Disabled for now bug #1173138.
TEST_F(InterstitialPageTest, DISABLED_TestShowInterstitialThenNavigate) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+
::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(),
- server.TestServerPageW(L"files/interstitial_page/google.html"));
+ server->TestServerPageW(L"files/interstitial_page/google.html"));
EXPECT_EQ(L"Google", GetActiveTabTitle());
tab->ShowInterstitialPage(kInterstitialPageHTMLText, action_timeout_ms());
EXPECT_EQ(L"Interstitial page", GetActiveTabTitle());
tab->NavigateToURL(
- server.TestServerPageW(L"files/interstitial_page/shopping.html"));
+ server->TestServerPageW(L"files/interstitial_page/shopping.html"));
EXPECT_EQ(L"Google Product Search", GetActiveTabTitle());
}
// Shows an interstitial page then closes the tab (to make sure we don't crash).
TEST_F(InterstitialPageTest, TestShowInterstitialThenCloseTab) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// Create 2 tabs so closing one does not close the browser.
- AppendTab(server.TestServerPageW(L"files/interstitial_page/google.html"));
+ AppendTab(server->TestServerPageW(L"files/interstitial_page/google.html"));
::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
EXPECT_EQ(L"Google", GetActiveTabTitle());
@@ -126,11 +137,13 @@ TEST_F(InterstitialPageTest, TestShowInterstitialThenCloseTab) {
// crash).
// This test is disabled. See bug #1119448.
TEST_F(InterstitialPageTest, DISABLED_TestShowInterstitialThenCloseBrowser) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
tab->NavigateToURL(
- server.TestServerPageW(L"files/interstitial_page/google.html"));
+ server->TestServerPageW(L"files/interstitial_page/google.html"));
EXPECT_EQ(L"Google", GetActiveTabTitle());
tab->ShowInterstitialPage(kInterstitialPageHTMLText, action_timeout_ms());
diff --git a/chrome/browser/login_prompt_uitest.cc b/chrome/browser/login_prompt_uitest.cc
index 3969ccf..1d7d25c 100644
--- a/chrome/browser/login_prompt_uitest.cc
+++ b/chrome/browser/login_prompt_uitest.cc
@@ -62,9 +62,11 @@ wstring ExpectedTitleFromAuth(wstring username, wstring password) {
// Test that "Basic" HTTP authentication works.
TEST_F(LoginPromptTest, TestBasicAuth) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
- NavigateTab(tab.get(), server.TestServerPageW(L"auth-basic"));
+ NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic"));
EXPECT_TRUE(tab->NeedsAuth());
EXPECT_FALSE(tab->SetAuth(username_basic_, password_bad_));
@@ -72,7 +74,7 @@ TEST_F(LoginPromptTest, TestBasicAuth) {
EXPECT_TRUE(tab->CancelAuth());
EXPECT_EQ(L"Denied: wrong password", GetActiveTabTitle());
- NavigateTab(tab.get(), server.TestServerPageW(L"auth-basic"));
+ NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic"));
EXPECT_TRUE(tab->NeedsAuth());
EXPECT_TRUE(tab->SetAuth(username_basic_, password_));
@@ -82,16 +84,18 @@ TEST_F(LoginPromptTest, TestBasicAuth) {
// Test that "Digest" HTTP authentication works.
TEST_F(LoginPromptTest, TestDigestAuth) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
- NavigateTab(tab.get(), server.TestServerPageW(L"auth-digest"));
+ NavigateTab(tab.get(), server->TestServerPageW(L"auth-digest"));
EXPECT_TRUE(tab->NeedsAuth());
EXPECT_FALSE(tab->SetAuth(username_digest_, password_bad_));
EXPECT_TRUE(tab->CancelAuth());
EXPECT_EQ(L"Denied: wrong password", GetActiveTabTitle());
- NavigateTab(tab.get(), server.TestServerPageW(L"auth-digest"));
+ NavigateTab(tab.get(), server->TestServerPageW(L"auth-digest"));
EXPECT_TRUE(tab->NeedsAuth());
EXPECT_TRUE(tab->SetAuth(username_digest_, password_));
@@ -101,14 +105,16 @@ TEST_F(LoginPromptTest, TestDigestAuth) {
// Test that logging in on 2 tabs at once works.
TEST_F(LoginPromptTest, TestTwoAuths) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
::scoped_ptr<TabProxy> basic_tab(GetActiveTabProxy());
- NavigateTab(basic_tab.get(), server.TestServerPageW(L"auth-basic"));
+ NavigateTab(basic_tab.get(), server->TestServerPageW(L"auth-basic"));
AppendTab(GURL("about:blank"));
::scoped_ptr<TabProxy> digest_tab(GetActiveTabProxy());
- NavigateTab(digest_tab.get(), server.TestServerPageW(L"auth-digest"));
+ NavigateTab(digest_tab.get(), server->TestServerPageW(L"auth-digest"));
// TODO(devint): http://b/1158262 basic_tab is not active, so this logs in to
// a page whose tab isn't active, which isn't actually possible for the user
@@ -129,34 +135,36 @@ TEST_F(LoginPromptTest, TestTwoAuths) {
// Test that cancelling authentication works.
TEST_F(LoginPromptTest, TestCancelAuth) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
// First navigate to a test server page so we have something to go back to.
- EXPECT_TRUE(tab->NavigateToURL(server.TestServerPageW(L"a")));
+ EXPECT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"a")));
// Navigating while auth is requested is the same as cancelling.
- NavigateTab(tab.get(), server.TestServerPageW(L"auth-basic"));
+ NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic"));
EXPECT_TRUE(tab->NeedsAuth());
- EXPECT_TRUE(tab->NavigateToURL(server.TestServerPageW(L"b")));
+ EXPECT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"b")));
EXPECT_FALSE(tab->NeedsAuth());
- NavigateTab(tab.get(), server.TestServerPageW(L"auth-basic"));
+ NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic"));
EXPECT_TRUE(tab->NeedsAuth());
EXPECT_TRUE(tab->GoBack()); // should bring us back to 'a'
EXPECT_FALSE(tab->NeedsAuth());
// Now add a page and go back, so we have something to go forward to.
- EXPECT_TRUE(tab->NavigateToURL(server.TestServerPageW(L"c")));
+ EXPECT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"c")));
EXPECT_TRUE(tab->GoBack()); // should bring us back to 'a'
- NavigateTab(tab.get(), server.TestServerPageW(L"auth-basic"));
+ NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic"));
EXPECT_TRUE(tab->NeedsAuth());
EXPECT_TRUE(tab->GoForward()); // should bring us to 'c'
EXPECT_FALSE(tab->NeedsAuth());
// Now test that cancelling works as expected.
- NavigateTab(tab.get(), server.TestServerPageW(L"auth-basic"));
+ NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic"));
EXPECT_TRUE(tab->NeedsAuth());
EXPECT_TRUE(tab->CancelAuth());
EXPECT_FALSE(tab->NeedsAuth());
diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc
index a8c5059..086c2b9 100644
--- a/chrome/browser/printing/printing_layout_uitest.cc
+++ b/chrome/browser/printing/printing_layout_uitest.cc
@@ -457,7 +457,8 @@ class DismissTheWindow : public base::RefCountedThreadSafe<DismissTheWindow> {
dialog_window,
WM_COMMAND,
print_button_id,
- reinterpret_cast<LPARAM>(GetDlgItem(dialog_window, print_button_id)));
+ reinterpret_cast<LPARAM>(GetDlgItem(dialog_window,
+ print_button_id)));
// Try again.
if (res)
return;
@@ -498,8 +499,11 @@ TEST_F(PrintingLayoutTextTest, DISABLED_Complex) {
return;
// Print a document, check its output.
- TestServer server(kDocRoot);
- NavigateToURL(server.TestServerPage("files/printing/test1.html"));
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+
+ NavigateToURL(server->TestServerPage("files/printing/test1.html"));
PrintNowTab();
EXPECT_EQ(0., CompareWithResult(L"test1"));
}
@@ -524,13 +528,16 @@ TEST_F(PrintingLayoutTestHidden, ManyTimes) {
if (IsTestCaseDisabled())
return;
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+
ASSERT_GT(arraysize(kTestPool), 0u);
for (int i = 0; i < arraysize(kTestPool); ++i) {
if (i)
CleanupDumpDirectory();
const TestPool& test = kTestPool[i % arraysize(kTestPool)];
- NavigateToURL(server.TestServerPageW(test.source));
+ NavigateToURL(server->TestServerPageW(test.source));
PrintNowTab();
EXPECT_EQ(0., CompareWithResult(test.result)) << test.result;
CleanupDumpDirectory();
@@ -554,13 +561,15 @@ TEST_F(PrintingLayoutTest, DISABLED_Delayed) {
if (win_util::GetWinVersion() < win_util::WINVERSION_XP)
return;
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
{
scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
bool is_timeout = true;
- GURL url = server.TestServerPage("files/printing/popup_delayed_print.htm");
+ GURL url = server->TestServerPage("files/printing/popup_delayed_print.htm");
EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
tab_proxy->NavigateToURL(url));
@@ -579,7 +588,7 @@ TEST_F(PrintingLayoutTest, DISABLED_Delayed) {
worker->Stop();
// Force a navigation elsewhere to verify that it's fine with it.
- url = server.TestServerPage("files/printing/test1.html");
+ url = server->TestServerPage("files/printing/test1.html");
EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
tab_proxy->NavigateToURL(url));
}
@@ -594,12 +603,14 @@ TEST_F(PrintingLayoutTest, DISABLED_IFrame) {
if (IsTestCaseDisabled())
return;
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
{
scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
- GURL url = server.TestServerPage("files/printing/iframe.htm");
+ GURL url = server->TestServerPage("files/printing/iframe.htm");
EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
tab_proxy->NavigateToURL(url));
@@ -617,7 +628,7 @@ TEST_F(PrintingLayoutTest, DISABLED_IFrame) {
worker->Stop();
// Force a navigation elsewhere to verify that it's fine with it.
- url = server.TestServerPage("files/printing/test1.html");
+ url = server->TestServerPage("files/printing/test1.html");
EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
tab_proxy->NavigateToURL(url));
}
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
index 6d276ee..350e544 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
@@ -89,12 +89,15 @@ TEST_F(ResourceDispatcherTest, ContentDispositionInline) {
// Test for bug #1091358.
TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest) {
const wchar_t kDocRoot[] = L"chrome/test/data";
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
- tab->NavigateToURL(server.TestServerPageW(L"files/sync_xmlhttprequest.html"));
+ tab->NavigateToURL(server->TestServerPageW(
+ L"files/sync_xmlhttprequest.html"));
// Let's check the XMLHttpRequest ran successfully.
bool success = false;
@@ -109,14 +112,16 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest) {
// if executed while navigating to a new page.
TEST_F(ResourceDispatcherTest, SyncXMLHttpRequestDuringUnload) {
const wchar_t kDocRoot[] = L"chrome/test/data";
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
tab->NavigateToURL(
- server.TestServerPageW(L"files/sync_xmlhttprequest_during_unload.html"));
+ server->TestServerPageW(L"files/sync_xmlhttprequest_during_unload.html"));
// Confirm that the page has loaded (since it changes its title during load).
std::wstring tab_title;
@@ -126,7 +131,7 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequestDuringUnload) {
// Navigate to a new page, to dispatch unload event and trigger xhr.
// (the bug would make this step hang the renderer).
bool timed_out = false;
- tab->NavigateToURLWithTimeout(server.TestServerPageW(L"files/title2.html"),
+ tab->NavigateToURLWithTimeout(server->TestServerPageW(L"files/title2.html"),
kWaitForActionMaxMsec,
&timed_out);
EXPECT_FALSE(timed_out);
@@ -142,13 +147,15 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequestDuringUnload) {
// Tests that onunload is run for cross-site requests. (Bug 1114994)
TEST_F(ResourceDispatcherTest, CrossSiteOnunloadCookie) {
const wchar_t kDocRoot[] = L"chrome/test/data";
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
- GURL url(server.TestServerPageW(L"files/onunload_cookie.html"));
+ GURL url(server->TestServerPageW(L"files/onunload_cookie.html"));
tab->NavigateToURL(url);
// Confirm that the page has loaded (since it changes its title during load).
@@ -219,13 +226,15 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationNonBuffered) {
// away from the link doctor page. (Bug 1235537)
TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) {
const wchar_t kDocRoot[] = L"chrome/test/data";
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
- GURL url(server.TestServerPageW(L"files/onunload_cookie.html"));
+ GURL url(server->TestServerPageW(L"files/onunload_cookie.html"));
tab->NavigateToURL(url);
// Confirm that the page has loaded (since it changes its title during load).
@@ -259,7 +268,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) {
// WebContents was in the NORMAL state, it would ignore the attempt to run
// the onunload handler, and the navigation would fail.
// (Test by redirecting to javascript:window.location='someURL'.)
- GURL test_url(server.TestServerPageW(L"files/title2.html"));
+ GURL test_url(server->TestServerPageW(L"files/title2.html"));
std::wstring redirect_url = L"javascript:window.location='" +
ASCIIToWide(test_url.possibly_invalid_spec()) + L"'";
tab->NavigateToURLAsync(GURL(redirect_url));
diff --git a/chrome/browser/session_history_uitest.cc b/chrome/browser/session_history_uitest.cc
index 251a3ba..bc8fadc 100644
--- a/chrome/browser/session_history_uitest.cc
+++ b/chrome/browser/session_history_uitest.cc
@@ -107,22 +107,24 @@ class SessionHistoryTest : public UITest {
} // namespace
TEST_F(SessionHistoryTest, BasicBackForward) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// about:blank should be loaded first.
ASSERT_FALSE(tab_->GoBack());
EXPECT_EQ(L"", GetTabTitle());
ASSERT_TRUE(tab_->NavigateToURL(
- server.TestServerPage("files/session_history/bot1.html")));
+ server->TestServerPage("files/session_history/bot1.html")));
EXPECT_EQ(L"bot1", GetTabTitle());
ASSERT_TRUE(tab_->NavigateToURL(
- server.TestServerPage("files/session_history/bot2.html")));
+ server->TestServerPage("files/session_history/bot2.html")));
EXPECT_EQ(L"bot2", GetTabTitle());
ASSERT_TRUE(tab_->NavigateToURL(
- server.TestServerPage("files/session_history/bot3.html")));
+ server->TestServerPage("files/session_history/bot3.html")));
EXPECT_EQ(L"bot3", GetTabTitle());
// history is [blank, bot1, bot2, *bot3]
@@ -140,7 +142,7 @@ TEST_F(SessionHistoryTest, BasicBackForward) {
EXPECT_EQ(L"bot1", GetTabTitle());
ASSERT_TRUE(tab_->NavigateToURL(
- server.TestServerPage("files/session_history/bot3.html")));
+ server->TestServerPage("files/session_history/bot3.html")));
EXPECT_EQ(L"bot3", GetTabTitle());
// history is [blank, bot1, *bot3]
@@ -171,7 +173,9 @@ TEST_F(SessionHistoryTest, FrameBackForward) {
if (win_util::GetWinVersion() <= win_util::WINVERSION_2000)
return;
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// about:blank should be loaded first.
GURL home(homepage_);
@@ -179,7 +183,7 @@ TEST_F(SessionHistoryTest, FrameBackForward) {
EXPECT_EQ(L"", GetTabTitle());
EXPECT_EQ(home, GetTabURL());
- GURL frames(server.TestServerPage("files/session_history/frames.html"));
+ GURL frames(server->TestServerPage("files/session_history/frames.html"));
ASSERT_TRUE(tab_->NavigateToURL(frames));
EXPECT_EQ(L"bot1", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
@@ -235,13 +239,15 @@ TEST_F(SessionHistoryTest, FrameBackForward) {
// Test that back/forward preserves POST data and document state in subframes.
TEST_F(SessionHistoryTest, FrameFormBackForward) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// about:blank should be loaded first.
ASSERT_FALSE(tab_->GoBack());
EXPECT_EQ(L"", GetTabTitle());
- GURL frames(server.TestServerPage("files/session_history/frames.html"));
+ GURL frames(server->TestServerPage("files/session_history/frames.html"));
ASSERT_TRUE(tab_->NavigateToURL(frames));
EXPECT_EQ(L"bot1", GetTabTitle());
@@ -295,13 +301,15 @@ TEST_F(SessionHistoryTest, FrameFormBackForward) {
// Test that back/forward preserves POST data and document state when navigating
// across frames (ie, from frame -> nonframe).
TEST_F(SessionHistoryTest, CrossFrameFormBackForward) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// about:blank should be loaded first.
ASSERT_FALSE(tab_->GoBack());
EXPECT_EQ(L"", GetTabTitle());
- GURL frames(server.TestServerPage("files/session_history/frames.html"));
+ GURL frames(server->TestServerPage("files/session_history/frames.html"));
ASSERT_TRUE(tab_->NavigateToURL(frames));
EXPECT_EQ(L"bot1", GetTabTitle());
@@ -337,16 +345,18 @@ TEST_F(SessionHistoryTest, CrossFrameFormBackForward) {
}
#endif
-// Test that back/forward entries are created for reference fragment navigations.
-// Bug 730379.
+// Test that back/forward entries are created for reference fragment
+// navigations. Bug 730379.
TEST_F(SessionHistoryTest, FragmentBackForward) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// about:blank should be loaded first.
ASSERT_FALSE(tab_->GoBack());
EXPECT_EQ(L"", GetTabTitle());
- GURL fragment(server.TestServerPage("files/session_history/fragment.html"));
+ GURL fragment(server->TestServerPage("files/session_history/fragment.html"));
ASSERT_TRUE(tab_->NavigateToURL(fragment));
EXPECT_EQ(L"fragment", GetTabTitle());
EXPECT_EQ(fragment, GetTabURL());
@@ -385,7 +395,7 @@ TEST_F(SessionHistoryTest, FragmentBackForward) {
ASSERT_TRUE(tab_->GoForward());
EXPECT_EQ(fragment_a, GetTabURL());
- GURL bot3(server.TestServerPage("files/session_history/bot3.html"));
+ GURL bot3(server->TestServerPage("files/session_history/bot3.html"));
ASSERT_TRUE(tab_->NavigateToURL(bot3));
EXPECT_EQ(L"bot3", GetTabTitle());
EXPECT_EQ(bot3, GetTabURL());
@@ -408,22 +418,24 @@ TEST_F(SessionHistoryTest, FragmentBackForward) {
// means the test will hang if it attempts to navigate too far forward or back,
// since we'll be waiting forever for a load stop event.
TEST_F(SessionHistoryTest, JavascriptHistory) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// about:blank should be loaded first.
ASSERT_FALSE(tab_->GoBack());
EXPECT_EQ(L"", GetTabTitle());
ASSERT_TRUE(tab_->NavigateToURL(
- server.TestServerPage("files/session_history/bot1.html")));
+ server->TestServerPage("files/session_history/bot1.html")));
EXPECT_EQ(L"bot1", GetTabTitle());
ASSERT_TRUE(tab_->NavigateToURL(
- server.TestServerPage("files/session_history/bot2.html")));
+ server->TestServerPage("files/session_history/bot2.html")));
EXPECT_EQ(L"bot2", GetTabTitle());
ASSERT_TRUE(tab_->NavigateToURL(
- server.TestServerPage("files/session_history/bot3.html")));
+ server->TestServerPage("files/session_history/bot3.html")));
EXPECT_EQ(L"bot3", GetTabTitle());
// history is [blank, bot1, bot2, *bot3]
@@ -455,7 +467,7 @@ TEST_F(SessionHistoryTest, JavascriptHistory) {
EXPECT_EQ(L"bot1", GetTabTitle());
ASSERT_TRUE(tab_->NavigateToURL(
- server.TestServerPage("files/session_history/bot3.html")));
+ server->TestServerPage("files/session_history/bot3.html")));
EXPECT_EQ(L"bot3", GetTabTitle());
// history is [blank, bot1, *bot3]
@@ -489,10 +501,12 @@ TEST_F(SessionHistoryTest, JavascriptHistory) {
TEST_F(SessionHistoryTest, LocationReplace) {
// Test that using location.replace doesn't leave the title of the old page
// visible.
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
- ASSERT_TRUE(tab_->NavigateToURL(
- server.TestServerPage("files/session_history/replace.html?no-title.html")));
+ ASSERT_TRUE(tab_->NavigateToURL(server->TestServerPage(
+ "files/session_history/replace.html?no-title.html")));
EXPECT_EQ(L"", GetTabTitle());
}
diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc
index 8843567..434f937 100644
--- a/chrome/browser/sessions/session_restore_uitest.cc
+++ b/chrome/browser/sessions/session_restore_uitest.cc
@@ -145,8 +145,10 @@ TEST_F(SessionRestoreUITest, RestoresForwardAndBackwardNavs) {
// cross-site page and then forward again works. (Bug 1204135)
TEST_F(SessionRestoreUITest, RestoresCrossSiteForwardAndBackwardNavs) {
const wchar_t kDocRoot[] = L"chrome/test/data";
- TestServer server(kDocRoot);
- GURL cross_site_url(server.TestServerPageW(L"files/title2.html"));
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+ GURL cross_site_url(server->TestServerPageW(L"files/title2.html"));
// Visit URLs on different sites.
NavigateToURL(url1);
diff --git a/chrome/browser/ssl_uitest.cc b/chrome/browser/ssl_uitest.cc
index ccef280..13a8759 100644
--- a/chrome/browser/ssl_uitest.cc
+++ b/chrome/browser/ssl_uitest.cc
@@ -41,17 +41,17 @@ class SSLUITest : public UITest {
EXPECT_TRUE(browser_proxy->AppendTab(url));
}
- TestServer* PlainServer() {
- return new TestServer(kDocRoot);
+ HTTPTestServer* PlainServer() {
+ return HTTPTestServer::CreateServer(kDocRoot);
}
HTTPSTestServer* GoodCertServer() {
- return new HTTPSTestServer(util_.kHostName, util_.kOKHTTPSPort,
+ return HTTPSTestServer::CreateServer(util_.kHostName, util_.kOKHTTPSPort,
kDocRoot, util_.GetOKCertPath().ToWStringHack());
}
HTTPSTestServer* BadCertServer() {
- return new HTTPSTestServer(util_.kHostName, util_.kBadHTTPSPort,
+ return HTTPSTestServer::CreateServer(util_.kHostName, util_.kBadHTTPSPort,
kDocRoot, util_.GetExpiredCertPath().ToWStringHack());
}
@@ -65,7 +65,7 @@ class SSLUITest : public UITest {
// Visits a regular page over http.
TEST_F(SSLUITest, TestHTTP) {
- scoped_ptr<TestServer> server(PlainServer());
+ scoped_ptr<HTTPTestServer> server(PlainServer());
scoped_ptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(), server->TestServerPageW(L"files/ssl/google.html"));
@@ -87,7 +87,7 @@ TEST_F(SSLUITest, TestHTTP) {
// Visits a page over http which includes broken https resources (status should
// be OK).
TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) {
- scoped_ptr<TestServer> http_server(PlainServer());
+ scoped_ptr<HTTPTestServer> http_server(PlainServer());
scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer());
scoped_ptr<TabProxy> tab(GetActiveTabProxy());
@@ -164,7 +164,7 @@ TEST_F(SSLUITest, TestHTTPSExpiredCert) {
// Visits a page with mixed content.
TEST_F(SSLUITest, TestMixedContents) {
scoped_ptr<HTTPSTestServer> https_server(GoodCertServer());
- scoped_ptr<TestServer> http_server(PlainServer());
+ scoped_ptr<HTTPTestServer> http_server(PlainServer());
// Load a page with mixed-content, the default behavior is to show the mixed
// content.
@@ -286,7 +286,7 @@ TEST_F(SSLUITest, TestUnsafeContents) {
// Visits a page with mixed content loaded by JS (after the initial page load).
TEST_F(SSLUITest, TestMixedContentsLoadedFromJS) {
scoped_ptr<HTTPSTestServer> https_server(GoodCertServer());
- scoped_ptr<TestServer> http_server(PlainServer());
+ scoped_ptr<HTTPTestServer> http_server(PlainServer());
scoped_ptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(), https_server->TestServerPageW(
@@ -325,7 +325,7 @@ TEST_F(SSLUITest, TestMixedContentsLoadedFromJS) {
// memory cache).
TEST_F(SSLUITest, TestCachedMixedContents) {
scoped_ptr<HTTPSTestServer> https_server(GoodCertServer());
- scoped_ptr<TestServer> http_server(PlainServer());
+ scoped_ptr<HTTPTestServer> http_server(PlainServer());
scoped_ptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(), http_server->TestServerPageW(
@@ -364,9 +364,10 @@ TEST_F(SSLUITest, TestCachedMixedContents) {
// TODO(jcampan): this test is flacky and fails sometimes (bug #1065095)
TEST_F(SSLUITest, DISABLED_TestCNInvalidStickiness) {
const std::string kLocalHost = "localhost";
- scoped_ptr<HTTPSTestServer> https_server(
- new HTTPSTestServer(kLocalHost, util_.kOKHTTPSPort,
- kDocRoot, util_.GetOKCertPath().ToWStringHack()));
+ scoped_refptr<HTTPSTestServer> https_server =
+ HTTPSTestServer::CreateServer(kLocalHost, util_.kOKHTTPSPort,
+ kDocRoot, util_.GetOKCertPath().ToWStringHack());
+ ASSERT_TRUE(NULL != https_server.get());
// First we hit the server with hostname, this generates an invalid policy
// error.
@@ -475,7 +476,7 @@ TEST_F(SSLUITest, TestRefNavigation) {
// (bug #1966).
// Disabled because flaky (bug #2136).
TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) {
- scoped_ptr<TestServer> http_server(PlainServer());
+ scoped_ptr<HTTPTestServer> http_server(PlainServer());
scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer());
scoped_ptr<TabProxy> tab(GetActiveTabProxy());
@@ -561,7 +562,7 @@ TEST_F(SSLUITest, TestRedirectGoodToBadHTTPS) {
// Visit a page over http that is a redirect to a page with https (good and
// bad).
TEST_F(SSLUITest, TestRedirectHTTPToHTTPS) {
- scoped_ptr<TestServer> http_server(PlainServer());
+ scoped_ptr<HTTPTestServer> http_server(PlainServer());
scoped_ptr<HTTPSTestServer> good_https_server(GoodCertServer());
scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer());
@@ -604,7 +605,7 @@ TEST_F(SSLUITest, TestRedirectHTTPToHTTPS) {
// Visit a page over https that is a redirect to a page with http (to make sure
// we don't keep the secure state).
TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) {
- scoped_ptr<TestServer> http_server(PlainServer());
+ scoped_ptr<HTTPTestServer> http_server(PlainServer());
scoped_ptr<HTTPSTestServer> https_server(GoodCertServer());
scoped_ptr<TabProxy> tab(GetActiveTabProxy());
@@ -660,7 +661,7 @@ TEST_F(SSLUITest, TestConnectToBadPort) {
// back
// - navigate to HTTP (expect mixed content), then back
TEST_F(SSLUITest, TestGoodFrameNavigation) {
- scoped_ptr<TestServer> http_server(PlainServer());
+ scoped_ptr<HTTPTestServer> http_server(PlainServer());
scoped_ptr<HTTPSTestServer> good_https_server(GoodCertServer());
scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer());
@@ -798,7 +799,7 @@ TEST_F(SSLUITest, TestBadFrameNavigation) {
// From an HTTP top frame, navigate to good and bad HTTPS (security state should
// stay unauthenticated).
TEST_F(SSLUITest, TestUnauthenticatedFrameNavigation) {
- scoped_ptr<TestServer> http_server(PlainServer());
+ scoped_ptr<HTTPTestServer> http_server(PlainServer());
scoped_ptr<HTTPSTestServer> good_https_server(GoodCertServer());
scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer());
diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc
index 0bf2dbe..facd015 100644
--- a/chrome/browser/tab_restore_uitest.cc
+++ b/chrome/browser/tab_restore_uitest.cc
@@ -133,9 +133,11 @@ TEST_F(TabRestoreUITest, RestoreToDifferentWindow) {
// to an existing SiteInstance. (Bug 1230446)
TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) {
const wchar_t kDocRoot[] = L"chrome/test/data";
- TestServer server(kDocRoot);
- GURL http_url1(server.TestServerPageW(L"files/title1.html"));
- GURL http_url2(server.TestServerPageW(L"files/title2.html"));
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+ GURL http_url1(server->TestServerPageW(L"files/title1.html"));
+ GURL http_url2(server->TestServerPageW(L"files/title2.html"));
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
int initial_tab_count;
@@ -176,9 +178,11 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) {
// already exists. (Bug 1204135)
TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) {
const wchar_t kDocRoot[] = L"chrome/test/data";
- TestServer server(kDocRoot);
- GURL http_url1(server.TestServerPageW(L"files/title1.html"));
- GURL http_url2(server.TestServerPageW(L"files/title2.html"));
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+ GURL http_url1(server->TestServerPageW(L"files/title1.html"));
+ GURL http_url2(server->TestServerPageW(L"files/title2.html"));
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
int initial_tab_count;
diff --git a/chrome/browser/url_fetcher_unittest.cc b/chrome/browser/url_fetcher_unittest.cc
index fe73d3f..308964b 100644
--- a/chrome/browser/url_fetcher_unittest.cc
+++ b/chrome/browser/url_fetcher_unittest.cc
@@ -338,15 +338,19 @@ TEST_F(URLFetcherTest, SameThreadsTest) {
// Create the fetcher on the main thread. Since IO will happen on the main
// thread, this will test URLFetcher's ability to do everything on one
// thread.
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
- CreateFetcher(GURL(server.TestServerPage("defaultresponse")));
+ CreateFetcher(GURL(server->TestServerPage("defaultresponse")));
MessageLoop::current()->Run();
}
TEST_F(URLFetcherTest, DifferentThreadsTest) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// Create a separate thread that will create the URLFetcher. The current
// (main) thread will do the IO, and when the fetch is complete it will
// terminate the main thread's message loop; then the other thread's
@@ -355,27 +359,33 @@ TEST_F(URLFetcherTest, DifferentThreadsTest) {
base::Thread t("URLFetcher test thread");
t.Start();
t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this,
- GURL(server.TestServerPage("defaultresponse"))));
+ GURL(server->TestServerPage("defaultresponse"))));
MessageLoop::current()->Run();
}
TEST_F(URLFetcherPostTest, Basic) {
- TestServer server(kDocRoot);
- CreateFetcher(GURL(server.TestServerPage("echo")));
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+ CreateFetcher(GURL(server->TestServerPage("echo")));
MessageLoop::current()->Run();
}
TEST_F(URLFetcherHeadersTest, Headers) {
- TestServer server(L"net/data/url_request_unittest");
- CreateFetcher(GURL(server.TestServerPage("files/with-headers.html")));
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"net/data/url_request_unittest");
+ ASSERT_TRUE(NULL != server.get());
+ CreateFetcher(GURL(server->TestServerPage("files/with-headers.html")));
MessageLoop::current()->Run();
// The actual tests are in the URLFetcherHeadersTest fixture.
}
TEST_F(URLFetcherProtectTest, Overload) {
- TestServer server(kDocRoot);
- GURL url = GURL(server.TestServerPage("defaultresponse"));
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+ GURL url = GURL(server->TestServerPage("defaultresponse"));
// Registers an entry for test url. It only allows 3 requests to be sent
// in 200 milliseconds.
@@ -390,8 +400,10 @@ TEST_F(URLFetcherProtectTest, Overload) {
}
TEST_F(URLFetcherProtectTest, ServerUnavailable) {
- TestServer server(L"chrome/test/data");
- GURL url = GURL(server.TestServerPage("files/server-unavailable.html"));
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
+ GURL url = GURL(server->TestServerPage("files/server-unavailable.html"));
// Registers an entry for test url. The backoff time is calculated by:
// new_backoff = 2.0 * old_backoff + 0
@@ -408,17 +420,21 @@ TEST_F(URLFetcherProtectTest, ServerUnavailable) {
}
TEST_F(URLFetcherBadHTTPSTest, BadHTTPSTest) {
- HTTPSTestServer server(util_.kHostName, util_.kBadHTTPSPort,
+ scoped_refptr<HTTPSTestServer> server =
+ HTTPSTestServer::CreateServer(util_.kHostName, util_.kBadHTTPSPort,
kDocRoot, util_.GetExpiredCertPath().ToWStringHack());
+ ASSERT_TRUE(NULL != server.get());
- CreateFetcher(GURL(server.TestServerPage("defaultresponse")));
+ CreateFetcher(GURL(server->TestServerPage("defaultresponse")));
MessageLoop::current()->Run();
}
TEST_F(URLFetcherCancelTest, ReleasesContext) {
- TestServer server(L"chrome/test/data");
- GURL url = GURL(server.TestServerPage("files/server-unavailable.html"));
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
+ GURL url = GURL(server->TestServerPage("files/server-unavailable.html"));
// Registers an entry for test url. The backoff time is calculated by:
// new_backoff = 2.0 * old_backoff + 0
diff --git a/chrome/browser/view_source_uitest.cc b/chrome/browser/view_source_uitest.cc
index 1aad505..73cc875 100644
--- a/chrome/browser/view_source_uitest.cc
+++ b/chrome/browser/view_source_uitest.cc
@@ -38,12 +38,14 @@ class ViewSourceTest : public UITest {
// set in the html was set successfully (it shouldn't because we rendered the
// page in view source)
TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
std::string cookie = "viewsource_cookie";
std::string cookie_data = "foo";
// First we navigate to our view-source test page
- GURL url = server.TestServerPageW(test_html_);
+ GURL url = server->TestServerPageW(test_html_);
url = GURL("view-source:" + url.spec());
scoped_ptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(url);
@@ -61,10 +63,12 @@ TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) {
// implementation of the view-source: prefix being consumed (removed from the
// URL) if the URL was not changed (apart from adding the view-source prefix)
TEST_F(ViewSourceTest, DoesBrowserConsumeViewSourcePrefix) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// First we navigate to google.html
- GURL url = server.TestServerPageW(test_html_);
+ GURL url = server->TestServerPageW(test_html_);
NavigateToURL(url);
// Then we navigate to the SAME url but with the view-source: prefix
@@ -78,10 +82,12 @@ TEST_F(ViewSourceTest, DoesBrowserConsumeViewSourcePrefix) {
// Make sure that when looking at the actual page, we can select
// "View Source" from the Page menu.
TEST_F(ViewSourceTest, ViewSourceInPageMenuEnabledOnANormalPage) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// First we navigate to google.html
- GURL url = server.TestServerPageW(test_html_);
+ GURL url = server->TestServerPageW(test_html_);
NavigateToURL(url);
EXPECT_TRUE(IsPageMenuCommandEnabled(IDC_VIEW_SOURCE));
@@ -90,10 +96,12 @@ TEST_F(ViewSourceTest, ViewSourceInPageMenuEnabledOnANormalPage) {
// Make sure that when looking at the page source, we can't select
// "View Source" from the Page menu.
TEST_F(ViewSourceTest, ViewSourceInPageMenuDisabledWhileViewingSource) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
// First we navigate to google.html
- GURL url = server.TestServerPageW(test_html_);
+ GURL url = server->TestServerPageW(test_html_);
GURL url_viewsource = GURL("view-source:" + url.spec());
NavigateToURL(url_viewsource);
diff --git a/chrome/browser/views/find_bar_win_interactive_uitest.cc b/chrome/browser/views/find_bar_win_interactive_uitest.cc
index 383a64a..c036b7c 100644
--- a/chrome/browser/views/find_bar_win_interactive_uitest.cc
+++ b/chrome/browser/views/find_bar_win_interactive_uitest.cc
@@ -52,7 +52,9 @@ bool ActivateTabByClick(AutomationProxy* automation,
} // namespace
TEST_F(FindInPageTest, CrashEscHandlers) {
- TestServer server(kDocRoot);
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow());
ASSERT_TRUE(browser.get() != NULL);
@@ -61,7 +63,7 @@ TEST_F(FindInPageTest, CrashEscHandlers) {
ASSERT_TRUE(window.get() != NULL);
// First we navigate to our test page (tab A).
- GURL url = server.TestServerPageW(kSimplePage);
+ GURL url = server->TestServerPageW(kSimplePage);
scoped_ptr<TabProxy> tabA(GetActiveTab());
EXPECT_NE(AUTOMATION_MSG_NAVIGATION_ERROR, tabA->NavigateToURL(url));
diff --git a/chrome/browser/views/find_bar_win_uitest.cc b/chrome/browser/views/find_bar_win_uitest.cc
index ac534b4..94906b8 100644
--- a/chrome/browser/views/find_bar_win_uitest.cc
+++ b/chrome/browser/views/find_bar_win_uitest.cc
@@ -25,10 +25,12 @@ const std::wstring kTooFewMatchesPage = L"files/find_in_page/bug_1155639.html";
// This test loads a page with frames and starts FindInPage requests
TEST_F(FindInPageControllerTest, FindInPageFrames) {
- TestServer server(L"chrome/test/data");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
// First we navigate to our frames page.
- GURL url = server.TestServerPageW(kFramePage);
+ GURL url = server->TestServerPageW(kFramePage);
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -76,10 +78,12 @@ TEST_F(FindInPageControllerTest, FindInPageFrames) {
// This test loads a single-frame page and makes sure the ordinal returned makes
// sense as we FindNext over all the items.
TEST_F(FindInPageControllerTest, FindInPageOrdinal) {
- TestServer server(L"chrome/test/data");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
// First we navigate to our frames page.
- GURL url = server.TestServerPageW(kFrameData);
+ GURL url = server->TestServerPageW(kFrameData);
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -112,10 +116,12 @@ TEST_F(FindInPageControllerTest, FindInPageOrdinal) {
// This test loads a page with frames and makes sure the ordinal returned makes
// sense.
TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) {
- TestServer server(L"chrome/test/data");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
// First we navigate to our frames page.
- GURL url = server.TestServerPageW(kFramePage);
+ GURL url = server->TestServerPageW(kFramePage);
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -156,10 +162,12 @@ TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) {
// We could get ordinals out of whack when restarting search in subframes.
// See http://crbug.com/5132
TEST_F(FindInPageControllerTest, FindInPage_Issue5132) {
- TestServer server(L"chrome/test/data");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
// First we navigate to our frames page.
- GURL url = server.TestServerPageW(kFramePage);
+ GURL url = server->TestServerPageW(kFramePage);
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -185,9 +193,11 @@ TEST_F(FindInPageControllerTest, FindInPage_Issue5132) {
// Load a page with no selectable text and make sure we don't crash.
TEST_F(FindInPageControllerTest, FindUnSelectableText) {
- TestServer server(L"chrome/test/data");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
- GURL url = server.TestServerPageW(kUserSelectPage);
+ GURL url = server->TestServerPageW(kUserSelectPage);
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -199,9 +209,11 @@ TEST_F(FindInPageControllerTest, FindUnSelectableText) {
// Try to reproduce the crash seen in issue 1341577.
TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) {
- TestServer server(L"chrome/test/data");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
- GURL url = server.TestServerPageW(kCrashPage);
+ GURL url = server->TestServerPageW(kCrashPage);
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -229,9 +241,11 @@ TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) {
// ms) to find one or more of those matches (so Find times out and has to try
// again from where it left off).
TEST_F(FindInPageControllerTest, FindEnoughMatches_Issue1155639) {
- TestServer server(L"chrome/test/data");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
- GURL url = server.TestServerPageW(kTooFewMatchesPage);
+ GURL url = server->TestServerPageW(kTooFewMatchesPage);
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -244,9 +258,11 @@ TEST_F(FindInPageControllerTest, FindEnoughMatches_Issue1155639) {
// The find window should not change its location just because we open and close
// a new tab.
TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) {
- TestServer server(L"chrome/test/data");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
- GURL url = server.TestServerPageW(kFramePage);
+ GURL url = server->TestServerPageW(kFramePage);
scoped_ptr<TabProxy> tabA(GetActiveTab());
ASSERT_TRUE(tabA->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -303,9 +319,11 @@ TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) {
// Make sure Find box disappears on Navigate but not on Refresh.
TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
- TestServer server(L"chrome/test/data");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
- GURL url = server.TestServerPageW(kUserSelectPage);
+ GURL url = server->TestServerPageW(kUserSelectPage);
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
diff --git a/chrome/common/chrome_plugin_unittest.cc b/chrome/common/chrome_plugin_unittest.cc
index 1465f1a..096989f 100644
--- a/chrome/common/chrome_plugin_unittest.cc
+++ b/chrome/common/chrome_plugin_unittest.cc
@@ -258,8 +258,11 @@ TEST_F(ChromePluginTest, CanMakeGETRequestAsync) {
// Tests that the plugin can issue a POST request.
TEST_F(ChromePluginTest, CanMakePOSTRequest) {
- TestServer server(kDocRoot);
- GURL url = server.TestServerPage("echo");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot);
+ ASSERT_TRUE(NULL != server.get());
+
+ GURL url = server->TestServerPage("echo");
EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request("POST", url));
diff --git a/chrome/common/net/cache_uitest.cc b/chrome/common/net/cache_uitest.cc
index 69b5892..19ecc01 100644
--- a/chrome/common/net/cache_uitest.cc
+++ b/chrome/common/net/cache_uitest.cc
@@ -54,8 +54,10 @@ class CacheTest : public UITest {
void CacheTest::RunCacheTest(const std::wstring &url,
bool expect_new_tab_cached,
bool expect_delayed_reload) {
- TestServer server(L"chrome/test/data");
- GURL test_page(server.TestServerPageW(url));
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
+ GURL test_page(server->TestServerPageW(url));
NavigateToURL(test_page);
std::wstring original_time = GetActiveTabTitle();
diff --git a/chrome/test/ui/inspector_controller_uitest.cc b/chrome/test/ui/inspector_controller_uitest.cc
index 885eb69..29b1489 100644
--- a/chrome/test/ui/inspector_controller_uitest.cc
+++ b/chrome/test/ui/inspector_controller_uitest.cc
@@ -37,14 +37,20 @@ TEST_F(InspectorControllerTest, DISABLED_InspectElement) {
if (CommandLine().HasSwitch(switches::kSingleProcess))
return;
- TestServer server(L"chrome/test/data");
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"chrome/test/data");
+ ASSERT_TRUE(NULL != server.get());
+
::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
// We don't track resources until we've opened the inspector.
- NavigateTab(tab.get(), server.TestServerPageW(L"files/inspector/test1.html"));
+ NavigateTab(tab.get(), server->TestServerPageW(
+ L"files/inspector/test1.html"));
tab->InspectElement(0, 0);
- NavigateTab(tab.get(), server.TestServerPageW(L"files/inspector/test1.html"));
+ NavigateTab(tab.get(), server->TestServerPageW(
+ L"files/inspector/test1.html"));
EXPECT_EQ(1, tab->InspectElement(0, 0));
- NavigateTab(tab.get(), server.TestServerPageW(L"files/inspector/test2.html"));
+ NavigateTab(tab.get(), server->TestServerPageW(
+ L"files/inspector/test2.html"));
EXPECT_EQ(2, tab->InspectElement(0, 0));
}