summaryrefslogtreecommitdiffstats
path: root/webkit/glue/resource_fetcher_unittest.cc
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-08 20:45:27 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-08 20:45:27 +0000
commitdd26501ef315e241911a31a8a98027c9bbb65560 (patch)
tree1c02dfce0035199f0c073ebf793607d6e7934be5 /webkit/glue/resource_fetcher_unittest.cc
parent7ecec17feb965bab7cd348ab16a9da8d772f70dc (diff)
downloadchromium_src-dd26501ef315e241911a31a8a98027c9bbb65560.zip
chromium_src-dd26501ef315e241911a31a8a98027c9bbb65560.tar.gz
chromium_src-dd26501ef315e241911a31a8a98027c9bbb65560.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) (take 2) Review URL: http://codereview.chromium.org/17040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7755 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/resource_fetcher_unittest.cc')
-rw-r--r--webkit/glue/resource_fetcher_unittest.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/webkit/glue/resource_fetcher_unittest.cc b/webkit/glue/resource_fetcher_unittest.cc
index d996f3b..81d9646 100644
--- a/webkit/glue/resource_fetcher_unittest.cc
+++ b/webkit/glue/resource_fetcher_unittest.cc
@@ -153,14 +153,16 @@ FetcherDelegate* FetcherDelegate::instance_ = NULL;
// Test a fetch from the test server.
TEST_F(ResourceFetcherTests, ResourceFetcherDownload) {
- UnittestTestServer server;
+ scoped_refptr<UnittestTestServer> server =
+ UnittestTestServer::CreateServer();
+ ASSERT_TRUE(NULL != server.get());
WebFrame* web_frame = test_shell_->webView()->GetMainFrame();
// Not safe, but this is a unittest, so whatever.
WebFrameImpl* web_frame_impl = reinterpret_cast<WebFrameImpl*>(web_frame);
WebCore::Frame* frame = web_frame_impl->frame();
- GURL url = server.TestServerPage("files/test_shell/index.html");
+ GURL url = server->TestServerPage("files/test_shell/index.html");
scoped_ptr<FetcherDelegate> delegate(new FetcherDelegate);
scoped_ptr<ResourceFetcher> fetcher(new ResourceFetcher(
url, frame, delegate.get()));
@@ -173,7 +175,7 @@ TEST_F(ResourceFetcherTests, ResourceFetcherDownload) {
EXPECT_TRUE(text.find("What is this page?") != std::string::npos);
// Test 404 response.
- url = server.TestServerPage("files/thisfiledoesntexist.html");
+ url = server->TestServerPage("files/thisfiledoesntexist.html");
delegate.reset(new FetcherDelegate);
fetcher.reset(new ResourceFetcher(url, frame, delegate.get()));
@@ -185,7 +187,10 @@ TEST_F(ResourceFetcherTests, ResourceFetcherDownload) {
}
TEST_F(ResourceFetcherTests, ResourceFetcherDidFail) {
- UnittestTestServer server;
+ scoped_refptr<UnittestTestServer> server =
+ UnittestTestServer::CreateServer();
+ ASSERT_TRUE(NULL != server.get());
+
WebFrame* web_frame = test_shell_->webView()->GetMainFrame();
// Not safe, but this is a unittest, so whatever.
WebFrameImpl* web_frame_impl = reinterpret_cast<WebFrameImpl*>(web_frame);
@@ -208,7 +213,9 @@ TEST_F(ResourceFetcherTests, ResourceFetcherDidFail) {
}
TEST_F(ResourceFetcherTests, ResourceFetcherTimeout) {
- UnittestTestServer server;
+ scoped_refptr<UnittestTestServer> server =
+ UnittestTestServer::CreateServer();
+ ASSERT_TRUE(NULL != server.get());
WebFrame* web_frame = test_shell_->webView()->GetMainFrame();
// Not safe, but this is a unittest, so whatever.
@@ -217,7 +224,7 @@ TEST_F(ResourceFetcherTests, ResourceFetcherTimeout) {
// Grab a page that takes at least 1 sec to respond, but set the fetcher to
// timeout in 0 sec.
- GURL url = server.TestServerPage("slow?1");
+ GURL url = server->TestServerPage("slow?1");
scoped_ptr<FetcherDelegate> delegate(new FetcherDelegate);
scoped_ptr<ResourceFetcher> fetcher(new ResourceFetcherWithTimeout(
url, frame, 0, delegate.get()));