diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-30 21:49:21 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-30 21:49:21 +0000 |
commit | baf9e25f103eb1138fcd41d917728faee80e62e2 (patch) | |
tree | 8d9b78fc3afb7e9c79570873b2c7d5529d1a02be /chrome/browser/renderer_host | |
parent | 1ea316d7174804dd49c43fe4abcb15620b248634 (diff) | |
download | chromium_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/renderer_host')
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc | 29 |
1 files changed, 19 insertions, 10 deletions
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)); |