summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_update_job_unittest.cc
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-07 19:26:48 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-07 19:26:48 +0000
commitb0110e822ac2b2db56d1b1542aad06da573cd544 (patch)
treed0bc73467f595a6c5833c93d9c55ac4466314201 /webkit/appcache/appcache_update_job_unittest.cc
parent82efd8e5f5e2f489119f920f3e974caa745dc553 (diff)
downloadchromium_src-b0110e822ac2b2db56d1b1542aad06da573cd544.zip
chromium_src-b0110e822ac2b2db56d1b1542aad06da573cd544.tar.gz
chromium_src-b0110e822ac2b2db56d1b1542aad06da573cd544.tar.bz2
Revert 49081 - AppCache: Use a MockHttpServer instead of starting a seperate http server for update job unittests. This should reduce flakiness and timing variance and the total time it takes to conduct these tests.
BUG=45664 TEST=yes Review URL: http://codereview.chromium.org/2624003 TBR=michaeln@chromium.org Review URL: http://codereview.chromium.org/2669003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49084 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_update_job_unittest.cc')
-rw-r--r--webkit/appcache/appcache_update_job_unittest.cc351
1 files changed, 119 insertions, 232 deletions
diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc
index 085d2f9..a10f53f 100644
--- a/webkit/appcache/appcache_update_job_unittest.cc
+++ b/webkit/appcache/appcache_update_job_unittest.cc
@@ -8,7 +8,6 @@
#include "base/thread.h"
#include "base/waitable_event.h"
#include "net/base/net_errors.h"
-#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_test_job.h"
#include "net/url_request/url_request_unittest.h"
#include "webkit/appcache/appcache_group.h"
@@ -21,136 +20,7 @@
namespace appcache {
class AppCacheUpdateJobTest;
-namespace {
-
-const char kManifest1Contents[] =
- "CACHE MANIFEST\n"
- "explicit1\n"
- "FALLBACK:\n"
- "fallback1 fallback1a\n"
- "NETWORK:\n"
- "*\n";
-
-// There are a handful of http accessible resources that we need to conduct
-// these tests. Instead of running a seperate server to host these resources,
-// we mock them up.
-class MockHttpServer {
- public:
- static GURL GetMockUrl(const std::string& path) {
- return GURL("http://mockhost/" + path);
- }
-
- static URLRequestJob* JobFactory(URLRequest* request,
- const std::string& scheme) {
- if (request->url().host() != "mockhost")
- return new URLRequestErrorJob(request, -1);
-
- std::string headers, body;
- GetMockResponse(request->url().path(), &headers, &body);
- return new URLRequestTestJob(request, headers, body, true);
- }
-
- private:
- static void GetMockResponse(const std::string& path,
- std::string* headers,
- std::string* body) {
- const char ok_headers[] =
- "HTTP/1.1 200 OK\0"
- "\0";
- const char error_headers[] =
- "HTTP/1.1 500 BOO HOO\0"
- "\0";
- const char manifest_headers[] =
- "HTTP/1.1 200 OK\0"
- "Content-type: text/cache-manifest\0"
- "\0";
- const char not_modified_headers[] =
- "HTTP/1.1 304 NOT MODIFIED\0"
- "\0";
- const char gone_headers[] =
- "HTTP/1.1 410 GONE\0"
- "\0";
- const char not_found_headers[] =
- "HTTP/1.1 404 NOT FOUND\0"
- "\0";
-
- if (path == "/files/wrong-mime-manifest") {
- (*headers) = std::string(ok_headers, arraysize(ok_headers));
- (*body) = "CACHE MANIFEST\n";
- } else if (path == "/files/bad-manifest") {
- (*headers) = std::string(manifest_headers, arraysize(manifest_headers));
- (*body) = "BAD CACHE MANIFEST";
- } else if (path == "/files/empty1") {
- (*headers) = std::string(ok_headers, arraysize(ok_headers));
- (*body) = "";
- } else if (path == "/files/empty-file-manifest") {
- (*headers) = std::string(manifest_headers, arraysize(manifest_headers));
- (*body) = "CACHE MANIFEST\n"
- "empty1\n";
- } else if (path == "/files/empty-manifest") {
- (*headers) = std::string(manifest_headers, arraysize(manifest_headers));
- (*body) = "CACHE MANIFEST\n";
- } else if (path == "/files/explicit1") {
- (*headers) = std::string(ok_headers, arraysize(ok_headers));
- (*body) = "explicit1";
- } else if (path == "/files/explicit2") {
- (*headers) = std::string(ok_headers, arraysize(ok_headers));
- (*body) = "explicit2";
- } else if (path == "/files/fallback1a") {
- (*headers) = std::string(ok_headers, arraysize(ok_headers));
- (*body) = "fallback1a";
- } else if (path == "/files/gone") {
- (*headers) = std::string(gone_headers, arraysize(gone_headers));
- (*body) = "";
- } else if (path == "/files/manifest1") {
- (*headers) = std::string(manifest_headers, arraysize(manifest_headers));
- (*body) = kManifest1Contents;
- } else if (path == "/files/manifest-fb-404") {
- (*headers) = std::string(manifest_headers, arraysize(manifest_headers));
- (*body) = "CACHE MANIFEST\n"
- "explicit1\n"
- "FALLBACK:\n"
- "fallback1 fallback1a\n"
- "fallback404 fallback-404\n"
- "NETWORK:\n"
- "online1\n";
- } else if (path == "/files/manifest-merged-types") {
- (*headers) = std::string(manifest_headers, arraysize(manifest_headers));
- (*body) = "CACHE MANIFEST\n"
- "explicit1\n"
- "# manifest is also an explicit entry\n"
- "manifest-merged-types\n"
- "FALLBACK:\n"
- "# fallback is also explicit entry\n"
- "fallback1 explicit1\n"
- "NETWORK:\n"
- "online1\n";
- } else if (path == "/files/manifest-with-404") {
- (*headers) = std::string(manifest_headers, arraysize(manifest_headers));
- (*body) = "CACHE MANIFEST\n"
- "explicit-404\n"
- "explicit1\n"
- "explicit2\n"
- "explicit3\n"
- "FALLBACK:\n"
- "fallback1 fallback1a\n"
- "NETWORK:\n"
- "online1\n";
- } else if (path == "/files/notmodified") {
- (*headers) = std::string(not_modified_headers,
- arraysize(not_modified_headers));
- (*body) = "";
- } else if (path == "/files/servererror") {
- (*headers) = std::string(error_headers,
- arraysize(error_headers));
- (*body) = "error";
- } else {
- (*headers) = std::string(not_found_headers,
- arraysize(not_found_headers));
- (*body) = "";
- }
- }
-};
+const wchar_t kDocRoot[] = L"webkit/appcache/data/appcache_unittest";
class MockFrontend : public AppCacheFrontend {
public:
@@ -420,7 +290,7 @@ class HttpHeadersRequestTestJob : public URLRequestTestJob {
net::HttpRequestHeaders::kIfNoneMatch, &header_value) &&
header_value == expect_if_none_match_;
}
- return MockHttpServer::JobFactory(request, scheme);
+ return NULL;
}
private:
@@ -438,10 +308,11 @@ std::string HttpHeadersRequestTestJob::expect_if_none_match_;
bool HttpHeadersRequestTestJob::saw_if_none_match_ = false;
bool HttpHeadersRequestTestJob::already_checked_ = false;
+namespace {
+
class IOThread : public base::Thread {
public:
- explicit IOThread(const char* name)
- : base::Thread(name), old_factory_(NULL) {
+ IOThread(const char* name) : base::Thread(name) {
}
~IOThread() {
@@ -455,17 +326,13 @@ class IOThread : public base::Thread {
}
virtual void Init() {
- old_factory_ = URLRequest::RegisterProtocolFactory(
- "http", MockHttpServer::JobFactory);
request_context_ = new TestURLRequestContext();
}
virtual void CleanUp() {
- URLRequest::RegisterProtocolFactory("http", old_factory_);
request_context_ = NULL;
}
- URLRequest::ProtocolFactory* old_factory_;
scoped_refptr<URLRequestContext> request_context_;
};
@@ -524,12 +391,20 @@ class AppCacheUpdateJobTest : public testing::Test,
io_thread_ = new IOThread("AppCacheUpdateJob IO test thread");
base::Thread::Options options(MessageLoop::TYPE_IO, 0);
io_thread_->StartWithOptions(options);
+
+ http_server_ = HTTPTestServer::CreateServer(
+ kDocRoot, io_thread_->message_loop()).release();
+ ASSERT_TRUE(http_server_);
}
static base::WaitableEvent* io_thread_shutdown_event_;
// Cleanup function; must be called on the IO Thread.
static void CleanupIOThread() {
+ if (http_server_) {
+ http_server_->Release();
+ http_server_ = NULL;
+ }
io_thread_shutdown_event_->Signal();
}
@@ -547,6 +422,10 @@ class AppCacheUpdateJobTest : public testing::Test,
// when it goes out of scope.
template <class Method>
void RunTestOnIOThread(Method method) {
+ EXPECT_TRUE(http_server_);
+ if (!http_server_)
+ return; // Don't even try to run any of these tests w/o the server.
+
event_.reset(new base::WaitableEvent(false, false));
io_thread_->message_loop()->PostTask(
FROM_HERE, NewRunnableMethod(this, method));
@@ -796,7 +675,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/wrong-mime-manifest"),
+ service_.get(), http_server_->TestServerPage("defaultresponse"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -821,7 +700,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/nosuchfile"),
+ service_.get(), http_server_->TestServerPage("files/nosuchfile"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -857,7 +736,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/gone"),
+ service_.get(), http_server_->TestServerPage("files/gone"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -882,7 +761,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/notmodified"),
+ service_.get(), http_server_->TestServerPage("files/notmodified"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -907,7 +786,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/notmodified"),
+ service_.get(), http_server_->TestServerPage("files/notmodified"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -943,7 +822,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
+ service_.get(), http_server_->TestServerPage("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -973,7 +852,13 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend2->AddExpectedEvent(ids2, NO_UPDATE_EVENT);
// Seed storage with expected manifest data.
- const std::string seed_data(kManifest1Contents);
+ const std::string seed_data(
+ "CACHE MANIFEST\n"
+ "explicit1\n"
+ "FALLBACK:\n"
+ "fallback1 fallback1a\n"
+ "NETWORK:\n"
+ "*\n");
scoped_refptr<net::StringIOBuffer> io_buffer =
new net::StringIOBuffer(seed_data);
write_callback_.reset(
@@ -1000,7 +885,7 @@ class AppCacheUpdateJobTest : public testing::Test,
void BasicCacheAttemptSuccessTest() {
ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
- GURL manifest_url = MockHttpServer::GetMockUrl("files/manifest1");
+ GURL manifest_url = http_server_->TestServerPage("files/manifest1");
// We also test the async AppCachePolicy return path in this test case.
policy_.return_immediately_ = false;
@@ -1034,7 +919,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
+ service_.get(), http_server_->TestServerPage("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1093,7 +978,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
+ service_.get(), http_server_->TestServerPage("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1106,7 +991,7 @@ class AppCacheUpdateJobTest : public testing::Test,
// Give the newest cache an entry that is in storage.
response_writer_.reset(
service_->storage()->CreateResponseWriter(group_->manifest_url()));
- cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"),
+ cache->AddEntry(http_server_->TestServerPage("files/explicit1"),
AppCacheEntry(AppCacheEntry::EXPLICIT,
response_writer_->response_id()));
@@ -1117,7 +1002,7 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_old_cache_ = cache;
expect_response_ids_.insert(
std::map<GURL, int64>::value_type(
- MockHttpServer::GetMockUrl("files/explicit1"),
+ http_server_->TestServerPage("files/explicit1"),
response_writer_->response_id()));
tested_manifest_ = MANIFEST1;
MockFrontend::HostIds ids(1, host->host_id());
@@ -1154,7 +1039,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
+ service_.get(), http_server_->TestServerPage("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1167,7 +1052,7 @@ class AppCacheUpdateJobTest : public testing::Test,
// Give the newest cache an entry that is in storage.
response_writer_.reset(
service_->storage()->CreateResponseWriter(group_->manifest_url()));
- cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"),
+ cache->AddEntry(http_server_->TestServerPage("files/explicit1"),
AppCacheEntry(AppCacheEntry::EXPLICIT,
response_writer_->response_id()));
@@ -1212,7 +1097,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
+ service_.get(), http_server_->TestServerPage("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1225,7 +1110,7 @@ class AppCacheUpdateJobTest : public testing::Test,
// Give the newest cache an entry that is in storage.
response_writer_.reset(
service_->storage()->CreateResponseWriter(group_->manifest_url()));
- cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"),
+ cache->AddEntry(http_server_->TestServerPage("files/explicit1"),
AppCacheEntry(AppCacheEntry::EXPLICIT,
response_writer_->response_id()));
@@ -1270,7 +1155,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- MockHttpServer::GetMockUrl("files/manifest-merged-types"),
+ http_server_->TestServerPage("files/manifest-merged-types"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1285,7 +1170,7 @@ class AppCacheUpdateJobTest : public testing::Test,
// Give the newest cache a master entry that is also one of the explicit
// entries in the manifest.
- cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"),
+ cache->AddEntry(http_server_->TestServerPage("files/explicit1"),
AppCacheEntry(AppCacheEntry::MASTER, 111));
update->StartUpdate(NULL, GURL());
@@ -1320,7 +1205,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- MockHttpServer::GetMockUrl("files/manifest-with-404"),
+ http_server_->TestServerPage("files/manifest-with-404"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1345,7 +1230,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- MockHttpServer::GetMockUrl("files/manifest-fb-404"),
+ http_server_->TestServerPage("files/manifest-fb-404"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1385,7 +1270,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
+ service_.get(), http_server_->TestServerPage("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1400,13 +1285,13 @@ class AppCacheUpdateJobTest : public testing::Test,
// Give the newest cache some master entries; one will fail with a 404.
cache->AddEntry(
- MockHttpServer::GetMockUrl("files/notfound"),
+ http_server_->TestServerPage("files/notfound"),
AppCacheEntry(AppCacheEntry::MASTER, 222));
cache->AddEntry(
- MockHttpServer::GetMockUrl("files/explicit2"),
+ http_server_->TestServerPage("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER | AppCacheEntry::FOREIGN, 333));
cache->AddEntry(
- MockHttpServer::GetMockUrl("files/servererror"),
+ http_server_->TestServerPage("files/servererror"),
AppCacheEntry(AppCacheEntry::MASTER, 444));
update->StartUpdate(NULL, GURL());
@@ -1419,13 +1304,13 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_old_cache_ = cache;
tested_manifest_ = MANIFEST1;
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- MockHttpServer::GetMockUrl("files/explicit2"),
+ http_server_->TestServerPage("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER))); // foreign flag is dropped
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- MockHttpServer::GetMockUrl("files/servererror"),
+ http_server_->TestServerPage("files/servererror"),
AppCacheEntry(AppCacheEntry::MASTER)));
expect_response_ids_.insert(std::map<GURL, int64>::value_type(
- MockHttpServer::GetMockUrl("files/servererror"), 444)); // copied
+ http_server_->TestServerPage("files/servererror"), 444)); // copied
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
@@ -1455,7 +1340,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/empty-manifest"),
+ service_.get(), http_server_->TestServerPage("files/empty-manifest"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1498,7 +1383,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- MockHttpServer::GetMockUrl("files/empty-file-manifest"),
+ http_server_->TestServerPage("files/empty-file-manifest"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1692,7 +1577,7 @@ class AppCacheUpdateJobTest : public testing::Test,
storage->SimulateStoreGroupAndNewestCacheFailure();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
+ service_.get(), http_server_->TestServerPage("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1720,7 +1605,7 @@ class AppCacheUpdateJobTest : public testing::Test,
storage->SimulateStoreGroupAndNewestCacheFailure();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
+ service_.get(), http_server_->TestServerPage("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1765,7 +1650,7 @@ class AppCacheUpdateJobTest : public testing::Test,
storage->SimulateMakeGroupObsoleteFailure();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/gone"),
+ service_.get(), http_server_->TestServerPage("files/gone"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1794,7 +1679,7 @@ class AppCacheUpdateJobTest : public testing::Test,
storage->SimulateMakeGroupObsoleteFailure();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/nosuchfile"),
+ service_.get(), http_server_->TestServerPage("files/nosuchfile"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1857,13 +1742,13 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- MockHttpServer::GetMockUrl("files/bad-manifest"), 111);
+ http_server_->TestServerPage("files/bad-manifest"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
MockFrontend* frontend = MakeMockFrontend();
AppCacheHost* host = MakeHost(1, frontend);
- host->new_master_entry_url_ = MockHttpServer::GetMockUrl("files/blah");
+ host->new_master_entry_url_ = http_server_->TestServerPage("files/blah");
update->StartUpdate(host, host->new_master_entry_url_);
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -1883,13 +1768,13 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/nosuchfile"), 111);
+ service_.get(), http_server_->TestServerPage("files/nosuchfile"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
MockFrontend* frontend = MakeMockFrontend();
AppCacheHost* host = MakeHost(1, frontend);
- host->new_master_entry_url_ = MockHttpServer::GetMockUrl("files/blah");
+ host->new_master_entry_url_ = http_server_->TestServerPage("files/blah");
update->StartUpdate(host, host->new_master_entry_url_);
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -1910,7 +1795,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- MockHttpServer::GetMockUrl("files/manifest-fb-404"), 111);
+ http_server_->TestServerPage("files/manifest-fb-404"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1918,7 +1803,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend->SetIgnoreProgressEvents(true);
AppCacheHost* host = MakeHost(1, frontend);
host->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit1");
+ http_server_->TestServerPage("files/explicit1");
update->StartUpdate(host, host->new_master_entry_url_);
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -1940,7 +1825,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
+ service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1948,14 +1833,14 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend1->SetIgnoreProgressEvents(true);
AppCacheHost* host1 = MakeHost(1, frontend1);
host1->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/nosuchfile");
+ http_server_->TestServerPage("files/nosuchfile");
update->StartUpdate(host1, host1->new_master_entry_url_);
MockFrontend* frontend2 = MakeMockFrontend();
frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/servererror");
+ http_server_->TestServerPage("files/servererror");
update->StartUpdate(host2, host2->new_master_entry_url_);
// Set up checks for when update job finishes.
@@ -1979,7 +1864,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
+ service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1992,14 +1877,14 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/nosuchfile");
+ http_server_->TestServerPage("files/nosuchfile");
update->StartUpdate(host2, host2->new_master_entry_url_);
MockFrontend* frontend3 = MakeMockFrontend();
frontend3->SetIgnoreProgressEvents(true);
AppCacheHost* host3 = MakeHost(3, frontend3);
host3->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/servererror");
+ http_server_->TestServerPage("files/servererror");
update->StartUpdate(host3, host3->new_master_entry_url_);
// Set up checks for when update job finishes.
@@ -2031,7 +1916,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
+ service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2039,13 +1924,13 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend1->SetIgnoreProgressEvents(true);
AppCacheHost* host1 = MakeHost(1, frontend1);
host1->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/nosuchfile");
+ http_server_->TestServerPage("files/nosuchfile");
update->StartUpdate(host1, host1->new_master_entry_url_);
MockFrontend* frontend2 = MakeMockFrontend();
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit2");
+ http_server_->TestServerPage("files/explicit2");
update->StartUpdate(host2, host2->new_master_entry_url_);
// Set up checks for when update job finishes.
@@ -2054,7 +1939,7 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_group_has_cache_ = true; // as long as one pending master succeeds
tested_manifest_ = MANIFEST1;
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- MockHttpServer::GetMockUrl("files/explicit2"),
+ http_server_->TestServerPage("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER)));
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
@@ -2076,7 +1961,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
+ service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2089,13 +1974,13 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/nosuchfile");
+ http_server_->TestServerPage("files/nosuchfile");
update->StartUpdate(host2, host2->new_master_entry_url_);
MockFrontend* frontend3 = MakeMockFrontend();
AppCacheHost* host3 = MakeHost(3, frontend3);
host3->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit2");
+ http_server_->TestServerPage("files/explicit2");
update->StartUpdate(host3, host3->new_master_entry_url_);
// Set up checks for when update job finishes.
@@ -2105,7 +1990,7 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_old_cache_ = cache;
tested_manifest_ = MANIFEST1;
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- MockHttpServer::GetMockUrl("files/explicit2"),
+ http_server_->TestServerPage("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER)));
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
@@ -2133,7 +2018,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- MockHttpServer::GetMockUrl("files/notmodified"), 111);
+ http_server_->TestServerPage("files/notmodified"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2143,7 +2028,7 @@ class AppCacheUpdateJobTest : public testing::Test,
host1->AssociateCache(cache);
// Give cache an existing entry that can also be fetched.
- cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit2"),
+ cache->AddEntry(http_server_->TestServerPage("files/explicit2"),
AppCacheEntry(AppCacheEntry::EXPLICIT, 222));
// Reset the update time to null so we can verify it gets
@@ -2153,12 +2038,12 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend2 = MakeMockFrontend();
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit1");
+ http_server_->TestServerPage("files/explicit1");
update->StartUpdate(host2, host2->new_master_entry_url_);
AppCacheHost* host3 = MakeHost(3, frontend2); // same frontend as host2
host3->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit2");
+ http_server_->TestServerPage("files/explicit2");
update->StartUpdate(host3, host3->new_master_entry_url_);
// Set up checks for when update job finishes.
@@ -2186,7 +2071,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
+ service_.get(), http_server_->TestServerPage("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2194,7 +2079,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend1 = MakeMockFrontend();
AppCacheHost* host1 = MakeHost(1, frontend1);
host1->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit2");
+ http_server_->TestServerPage("files/explicit2");
update->StartUpdate(host1, host1->new_master_entry_url_);
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -2203,17 +2088,17 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/nosuchfile");
+ http_server_->TestServerPage("files/nosuchfile");
MockFrontend* frontend3 = MakeMockFrontend();
AppCacheHost* host3 = MakeHost(3, frontend3);
host3->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit1");
+ http_server_->TestServerPage("files/explicit1");
MockFrontend* frontend4 = MakeMockFrontend();
AppCacheHost* host4 = MakeHost(4, frontend4);
host4->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit2");
+ http_server_->TestServerPage("files/explicit2");
MockFrontend* frontend5 = MakeMockFrontend();
AppCacheHost* host5 = MakeHost(5, frontend5); // no master entry url
@@ -2231,7 +2116,7 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_group_has_cache_ = true;
tested_manifest_ = MANIFEST1;
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- MockHttpServer::GetMockUrl("files/explicit2"),
+ http_server_->TestServerPage("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER)));
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
@@ -2272,7 +2157,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/notmodified"),
+ service_.get(), http_server_->TestServerPage("files/notmodified"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2283,7 +2168,7 @@ class AppCacheUpdateJobTest : public testing::Test,
host1->AssociateCache(cache);
// Give cache an existing entry.
- cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit2"),
+ cache->AddEntry(http_server_->TestServerPage("files/explicit2"),
AppCacheEntry(AppCacheEntry::EXPLICIT, 222));
// Start update with a pending master entry that will fail to give us an
@@ -2291,7 +2176,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend2 = MakeMockFrontend();
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/nosuchfile");
+ http_server_->TestServerPage("files/nosuchfile");
update->StartUpdate(host2, host2->new_master_entry_url_);
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -2299,7 +2184,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend3 = MakeMockFrontend();
AppCacheHost* host3 = MakeHost(3, frontend3);
host3->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit1");
+ http_server_->TestServerPage("files/explicit1");
MockFrontend* frontend4 = MakeMockFrontend();
AppCacheHost* host4 = MakeHost(4, frontend4); // no master entry url
@@ -2307,12 +2192,12 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend5 = MakeMockFrontend();
AppCacheHost* host5 = MakeHost(5, frontend5);
host5->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit2"); // existing entry
+ http_server_->TestServerPage("files/explicit2"); // existing entry
MockFrontend* frontend6 = MakeMockFrontend();
AppCacheHost* host6 = MakeHost(6, frontend6);
host6->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit1");
+ http_server_->TestServerPage("files/explicit1");
frontend2->TriggerAdditionalUpdates(ERROR_EVENT, update);
frontend2->AdditionalUpdateHost(host3);
@@ -2352,7 +2237,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
+ service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2367,12 +2252,12 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend2 = MakeMockFrontend();
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit1");
+ http_server_->TestServerPage("files/explicit1");
MockFrontend* frontend3 = MakeMockFrontend();
AppCacheHost* host3 = MakeHost(3, frontend3);
host3->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit2");
+ http_server_->TestServerPage("files/explicit2");
MockFrontend* frontend4 = MakeMockFrontend();
AppCacheHost* host4 = MakeHost(4, frontend4); // no master entry url
@@ -2380,7 +2265,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend5 = MakeMockFrontend();
AppCacheHost* host5 = MakeHost(5, frontend5);
host5->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit2");
+ http_server_->TestServerPage("files/explicit2");
frontend1->TriggerAdditionalUpdates(PROGRESS_EVENT, update);
frontend1->AdditionalUpdateHost(host2); // same as entry in manifest
@@ -2395,7 +2280,7 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_group_has_cache_ = true;
tested_manifest_ = MANIFEST1;
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- MockHttpServer::GetMockUrl("files/explicit2"),
+ http_server_->TestServerPage("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER)));
MockFrontend::HostIds ids1(1, host1->host_id()); // prior associated host
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
@@ -2434,7 +2319,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
+ service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2447,7 +2332,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend = MakeMockFrontend();
AppCacheHost* host = MakeHost(1, frontend);
host->new_master_entry_url_ =
- MockHttpServer::GetMockUrl("files/explicit2");
+ http_server_->TestServerPage("files/explicit2");
update->StartUpdate(host, host->new_master_entry_url_);
EXPECT_TRUE(update->pending_master_entries_.empty());
EXPECT_FALSE(group_->queued_updates_.empty());
@@ -2551,7 +2436,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
+ service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2609,7 +2494,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
+ service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2917,14 +2802,14 @@ class AppCacheUpdateJobTest : public testing::Test,
size_t expected = 3 + expect_extra_entries_.size();
EXPECT_EQ(expected, cache->entries().size());
AppCacheEntry* entry =
- cache->GetEntry(MockHttpServer::GetMockUrl("files/manifest1"));
+ cache->GetEntry(http_server_->TestServerPage("files/manifest1"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MANIFEST, entry->types());
- entry = cache->GetEntry(MockHttpServer::GetMockUrl("files/explicit1"));
+ entry = cache->GetEntry(http_server_->TestServerPage("files/explicit1"));
ASSERT_TRUE(entry);
EXPECT_TRUE(entry->IsExplicit());
entry = cache->GetEntry(
- MockHttpServer::GetMockUrl("files/fallback1a"));
+ http_server_->TestServerPage("files/fallback1a"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::FALLBACK, entry->types());
@@ -2941,8 +2826,8 @@ class AppCacheUpdateJobTest : public testing::Test,
std::find(cache->fallback_namespaces_.begin(),
cache->fallback_namespaces_.end(),
FallbackNamespace(
- MockHttpServer::GetMockUrl("files/fallback1"),
- MockHttpServer::GetMockUrl("files/fallback1a"))));
+ http_server_->TestServerPage("files/fallback1"),
+ http_server_->TestServerPage("files/fallback1a"))));
EXPECT_TRUE(cache->online_whitelist_namespaces_.empty());
EXPECT_TRUE(cache->online_whitelist_all_);
@@ -2954,11 +2839,11 @@ class AppCacheUpdateJobTest : public testing::Test,
size_t expected = 2;
EXPECT_EQ(expected, cache->entries().size());
AppCacheEntry* entry = cache->GetEntry(
- MockHttpServer::GetMockUrl("files/manifest-merged-types"));
+ http_server_->TestServerPage("files/manifest-merged-types"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::EXPLICIT | AppCacheEntry::MANIFEST,
entry->types());
- entry = cache->GetEntry(MockHttpServer::GetMockUrl("files/explicit1"));
+ entry = cache->GetEntry(http_server_->TestServerPage("files/explicit1"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::EXPLICIT | AppCacheEntry::FALLBACK |
AppCacheEntry::MASTER, entry->types());
@@ -2969,14 +2854,14 @@ class AppCacheUpdateJobTest : public testing::Test,
std::find(cache->fallback_namespaces_.begin(),
cache->fallback_namespaces_.end(),
FallbackNamespace(
- MockHttpServer::GetMockUrl("files/fallback1"),
- MockHttpServer::GetMockUrl("files/explicit1"))));
+ http_server_->TestServerPage("files/fallback1"),
+ http_server_->TestServerPage("files/explicit1"))));
EXPECT_EQ(expected, cache->online_whitelist_namespaces_.size());
EXPECT_TRUE(cache->online_whitelist_namespaces_.end() !=
std::find(cache->online_whitelist_namespaces_.begin(),
cache->online_whitelist_namespaces_.end(),
- MockHttpServer::GetMockUrl("files/online1")));
+ http_server_->TestServerPage("files/online1")));
EXPECT_FALSE(cache->online_whitelist_all_);
EXPECT_TRUE(cache->update_time_ > base::Time());
@@ -2986,7 +2871,7 @@ class AppCacheUpdateJobTest : public testing::Test,
size_t expected = 1;
EXPECT_EQ(expected, cache->entries().size());
AppCacheEntry* entry = cache->GetEntry(
- MockHttpServer::GetMockUrl("files/empty-manifest"));
+ http_server_->TestServerPage("files/empty-manifest"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MANIFEST, entry->types());
@@ -3000,12 +2885,12 @@ class AppCacheUpdateJobTest : public testing::Test,
void VerifyEmptyFileManifest(AppCache* cache) {
EXPECT_EQ(size_t(2), cache->entries().size());
AppCacheEntry* entry = cache->GetEntry(
- MockHttpServer::GetMockUrl("files/empty-file-manifest"));
+ http_server_->TestServerPage("files/empty-file-manifest"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MANIFEST, entry->types());
entry = cache->GetEntry(
- MockHttpServer::GetMockUrl("files/empty1"));
+ http_server_->TestServerPage("files/empty1"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::EXPLICIT, entry->types());
EXPECT_TRUE(entry->has_response_id());
@@ -3020,18 +2905,18 @@ class AppCacheUpdateJobTest : public testing::Test,
void VerifyMasterEntryNoUpdate(AppCache* cache) {
EXPECT_EQ(size_t(3), cache->entries().size());
AppCacheEntry* entry = cache->GetEntry(
- MockHttpServer::GetMockUrl("files/notmodified"));
+ http_server_->TestServerPage("files/notmodified"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MANIFEST, entry->types());
entry = cache->GetEntry(
- MockHttpServer::GetMockUrl("files/explicit1"));
+ http_server_->TestServerPage("files/explicit1"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MASTER, entry->types());
EXPECT_TRUE(entry->has_response_id());
entry = cache->GetEntry(
- MockHttpServer::GetMockUrl("files/explicit2"));
+ http_server_->TestServerPage("files/explicit2"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::EXPLICIT | AppCacheEntry::MASTER, entry->types());
EXPECT_TRUE(entry->has_response_id());
@@ -3055,6 +2940,7 @@ class AppCacheUpdateJobTest : public testing::Test,
};
static IOThread* io_thread_;
+ static HTTPTestServer* http_server_;
scoped_ptr<MockAppCacheService> service_;
scoped_refptr<AppCacheGroup> group_;
@@ -3088,6 +2974,7 @@ class AppCacheUpdateJobTest : public testing::Test,
// static
IOThread* AppCacheUpdateJobTest::io_thread_ = NULL;
+HTTPTestServer* AppCacheUpdateJobTest::http_server_ = NULL;
base::WaitableEvent* AppCacheUpdateJobTest::io_thread_shutdown_event_ = NULL;