diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 20:07:11 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 20:07:11 +0000 |
commit | 95409e1020037b0bbfbce17f861d3de090d10186 (patch) | |
tree | 90a893af1247b1d4a3767c5ab14aae797f467946 /webkit/glue/resource_fetcher_unittest.cc | |
parent | 701e869b30deffda579c5c413cf1d73defee34fa (diff) | |
download | chromium_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 'webkit/glue/resource_fetcher_unittest.cc')
-rw-r--r-- | webkit/glue/resource_fetcher_unittest.cc | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/webkit/glue/resource_fetcher_unittest.cc b/webkit/glue/resource_fetcher_unittest.cc index b3f4427..70c316b 100644 --- a/webkit/glue/resource_fetcher_unittest.cc +++ b/webkit/glue/resource_fetcher_unittest.cc @@ -25,13 +25,8 @@ using webkit_glue::ResourceFetcherWithTimeout; namespace { class ResourceFetcherTests : public TestShellTest { - public: - void SetUp() { - TestShellTest::SetUp(); - } - void TearDown() { - TestShellTest::TearDown(); - } + protected: + UnittestTestServer test_server_; }; static const int kMaxWaitTimeMs = 5000; @@ -155,13 +150,11 @@ FetcherDelegate* FetcherDelegate::instance_ = NULL; // Test a fetch from the test server. TEST_F(ResourceFetcherTests, ResourceFetcherDownload) { - scoped_refptr<UnittestTestServer> server = - UnittestTestServer::CreateServer(); - ASSERT_TRUE(NULL != server.get()); + ASSERT_TRUE(test_server_.Start()); WebFrame* frame = test_shell_->webView()->mainFrame(); - GURL url = server->TestServerPage("files/test_shell/index.html"); + GURL url(test_server_.GetURL("files/test_shell/index.html")); scoped_ptr<FetcherDelegate> delegate(new FetcherDelegate); scoped_ptr<ResourceFetcher> fetcher(new ResourceFetcher( url, frame, delegate->NewCallback())); @@ -174,7 +167,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 = test_server_.GetURL("files/thisfiledoesntexist.html"); delegate.reset(new FetcherDelegate); fetcher.reset(new ResourceFetcher(url, frame, delegate->NewCallback())); @@ -186,9 +179,7 @@ TEST_F(ResourceFetcherTests, ResourceFetcherDownload) { } TEST_F(ResourceFetcherTests, ResourceFetcherDidFail) { - scoped_refptr<UnittestTestServer> server = - UnittestTestServer::CreateServer(); - ASSERT_TRUE(NULL != server.get()); + ASSERT_TRUE(test_server_.Start()); WebFrame* frame = test_shell_->webView()->mainFrame(); @@ -209,15 +200,13 @@ TEST_F(ResourceFetcherTests, ResourceFetcherDidFail) { } TEST_F(ResourceFetcherTests, ResourceFetcherTimeout) { - scoped_refptr<UnittestTestServer> server = - UnittestTestServer::CreateServer(); - ASSERT_TRUE(NULL != server.get()); + ASSERT_TRUE(test_server_.Start()); WebFrame* frame = test_shell_->webView()->mainFrame(); // 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(test_server_.GetURL("slow?1")); scoped_ptr<FetcherDelegate> delegate(new FetcherDelegate); scoped_ptr<ResourceFetcher> fetcher(new ResourceFetcherWithTimeout( url, frame, 0, delegate->NewCallback())); |