summaryrefslogtreecommitdiffstats
path: root/webkit/appcache
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-07 19:15:20 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-07 19:15:20 +0000
commitb0332ca417b9890ec9fb1c415613dee4029ec205 (patch)
treee650a954388e1844541b1402471968a84028c14f /webkit/appcache
parent9c32098368e6df8b1c80c5da20131db25b422d40 (diff)
downloadchromium_src-b0332ca417b9890ec9fb1c415613dee4029ec205.zip
chromium_src-b0332ca417b9890ec9fb1c415613dee4029ec205.tar.gz
chromium_src-b0332ca417b9890ec9fb1c415613dee4029ec205.tar.bz2
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 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r--webkit/appcache/appcache_update_job_unittest.cc351
-rw-r--r--webkit/appcache/data/appcache_unittest/bad-manifest2
-rw-r--r--webkit/appcache/data/appcache_unittest/bad-manifest.mock-http-headers2
-rw-r--r--webkit/appcache/data/appcache_unittest/empty-file-manifest3
-rw-r--r--webkit/appcache/data/appcache_unittest/empty-file-manifest.mock-http-headers2
-rw-r--r--webkit/appcache/data/appcache_unittest/empty-manifest1
-rw-r--r--webkit/appcache/data/appcache_unittest/empty-manifest.mock-http-headers2
-rw-r--r--webkit/appcache/data/appcache_unittest/empty10
-rw-r--r--webkit/appcache/data/appcache_unittest/explicit11
-rw-r--r--webkit/appcache/data/appcache_unittest/explicit21
-rw-r--r--webkit/appcache/data/appcache_unittest/fallback1a1
-rw-r--r--webkit/appcache/data/appcache_unittest/gone1
-rw-r--r--webkit/appcache/data/appcache_unittest/gone.mock-http-headers1
-rw-r--r--webkit/appcache/data/appcache_unittest/manifest-fb-4047
-rw-r--r--webkit/appcache/data/appcache_unittest/manifest-fb-404.mock-http-headers2
-rw-r--r--webkit/appcache/data/appcache_unittest/manifest-merged-types9
-rw-r--r--webkit/appcache/data/appcache_unittest/manifest-merged-types.mock-http-headers2
-rw-r--r--webkit/appcache/data/appcache_unittest/manifest-with-4049
-rw-r--r--webkit/appcache/data/appcache_unittest/manifest-with-404.mock-http-headers2
-rw-r--r--webkit/appcache/data/appcache_unittest/manifest16
-rw-r--r--webkit/appcache/data/appcache_unittest/manifest1.mock-http-headers2
-rw-r--r--webkit/appcache/data/appcache_unittest/notmodified1
-rw-r--r--webkit/appcache/data/appcache_unittest/notmodified.mock-http-headers1
-rw-r--r--webkit/appcache/data/appcache_unittest/servererror1
-rw-r--r--webkit/appcache/data/appcache_unittest/servererror.mock-http-headers1
25 files changed, 232 insertions, 179 deletions
diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc
index a10f53f..085d2f9 100644
--- a/webkit/appcache/appcache_update_job_unittest.cc
+++ b/webkit/appcache/appcache_update_job_unittest.cc
@@ -8,6 +8,7 @@
#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"
@@ -20,7 +21,136 @@
namespace appcache {
class AppCacheUpdateJobTest;
-const wchar_t kDocRoot[] = L"webkit/appcache/data/appcache_unittest";
+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) = "";
+ }
+ }
+};
class MockFrontend : public AppCacheFrontend {
public:
@@ -290,7 +420,7 @@ class HttpHeadersRequestTestJob : public URLRequestTestJob {
net::HttpRequestHeaders::kIfNoneMatch, &header_value) &&
header_value == expect_if_none_match_;
}
- return NULL;
+ return MockHttpServer::JobFactory(request, scheme);
}
private:
@@ -308,11 +438,10 @@ 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:
- IOThread(const char* name) : base::Thread(name) {
+ explicit IOThread(const char* name)
+ : base::Thread(name), old_factory_(NULL) {
}
~IOThread() {
@@ -326,13 +455,17 @@ 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_;
};
@@ -391,20 +524,12 @@ 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();
}
@@ -422,10 +547,6 @@ 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));
@@ -675,7 +796,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("defaultresponse"),
+ service_.get(), MockHttpServer::GetMockUrl("files/wrong-mime-manifest"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -700,7 +821,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/nosuchfile"),
+ service_.get(), MockHttpServer::GetMockUrl("files/nosuchfile"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -736,7 +857,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/gone"),
+ service_.get(), MockHttpServer::GetMockUrl("files/gone"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -761,7 +882,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/notmodified"),
+ service_.get(), MockHttpServer::GetMockUrl("files/notmodified"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -786,7 +907,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/notmodified"),
+ service_.get(), MockHttpServer::GetMockUrl("files/notmodified"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -822,7 +943,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"),
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -852,13 +973,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend2->AddExpectedEvent(ids2, NO_UPDATE_EVENT);
// Seed storage with expected manifest data.
- const std::string seed_data(
- "CACHE MANIFEST\n"
- "explicit1\n"
- "FALLBACK:\n"
- "fallback1 fallback1a\n"
- "NETWORK:\n"
- "*\n");
+ const std::string seed_data(kManifest1Contents);
scoped_refptr<net::StringIOBuffer> io_buffer =
new net::StringIOBuffer(seed_data);
write_callback_.reset(
@@ -885,7 +1000,7 @@ class AppCacheUpdateJobTest : public testing::Test,
void BasicCacheAttemptSuccessTest() {
ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
- GURL manifest_url = http_server_->TestServerPage("files/manifest1");
+ GURL manifest_url = MockHttpServer::GetMockUrl("files/manifest1");
// We also test the async AppCachePolicy return path in this test case.
policy_.return_immediately_ = false;
@@ -919,7 +1034,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"),
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -978,7 +1093,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"),
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -991,7 +1106,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(http_server_->TestServerPage("files/explicit1"),
+ cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"),
AppCacheEntry(AppCacheEntry::EXPLICIT,
response_writer_->response_id()));
@@ -1002,7 +1117,7 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_old_cache_ = cache;
expect_response_ids_.insert(
std::map<GURL, int64>::value_type(
- http_server_->TestServerPage("files/explicit1"),
+ MockHttpServer::GetMockUrl("files/explicit1"),
response_writer_->response_id()));
tested_manifest_ = MANIFEST1;
MockFrontend::HostIds ids(1, host->host_id());
@@ -1039,7 +1154,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"),
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1052,7 +1167,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(http_server_->TestServerPage("files/explicit1"),
+ cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"),
AppCacheEntry(AppCacheEntry::EXPLICIT,
response_writer_->response_id()));
@@ -1097,7 +1212,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"),
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1110,7 +1225,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(http_server_->TestServerPage("files/explicit1"),
+ cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"),
AppCacheEntry(AppCacheEntry::EXPLICIT,
response_writer_->response_id()));
@@ -1155,7 +1270,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- http_server_->TestServerPage("files/manifest-merged-types"),
+ MockHttpServer::GetMockUrl("files/manifest-merged-types"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1170,7 +1285,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(http_server_->TestServerPage("files/explicit1"),
+ cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"),
AppCacheEntry(AppCacheEntry::MASTER, 111));
update->StartUpdate(NULL, GURL());
@@ -1205,7 +1320,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- http_server_->TestServerPage("files/manifest-with-404"),
+ MockHttpServer::GetMockUrl("files/manifest-with-404"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1230,7 +1345,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- http_server_->TestServerPage("files/manifest-fb-404"),
+ MockHttpServer::GetMockUrl("files/manifest-fb-404"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1270,7 +1385,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"),
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1285,13 +1400,13 @@ class AppCacheUpdateJobTest : public testing::Test,
// Give the newest cache some master entries; one will fail with a 404.
cache->AddEntry(
- http_server_->TestServerPage("files/notfound"),
+ MockHttpServer::GetMockUrl("files/notfound"),
AppCacheEntry(AppCacheEntry::MASTER, 222));
cache->AddEntry(
- http_server_->TestServerPage("files/explicit2"),
+ MockHttpServer::GetMockUrl("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER | AppCacheEntry::FOREIGN, 333));
cache->AddEntry(
- http_server_->TestServerPage("files/servererror"),
+ MockHttpServer::GetMockUrl("files/servererror"),
AppCacheEntry(AppCacheEntry::MASTER, 444));
update->StartUpdate(NULL, GURL());
@@ -1304,13 +1419,13 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_old_cache_ = cache;
tested_manifest_ = MANIFEST1;
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- http_server_->TestServerPage("files/explicit2"),
+ MockHttpServer::GetMockUrl("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER))); // foreign flag is dropped
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- http_server_->TestServerPage("files/servererror"),
+ MockHttpServer::GetMockUrl("files/servererror"),
AppCacheEntry(AppCacheEntry::MASTER)));
expect_response_ids_.insert(std::map<GURL, int64>::value_type(
- http_server_->TestServerPage("files/servererror"), 444)); // copied
+ MockHttpServer::GetMockUrl("files/servererror"), 444)); // copied
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
@@ -1340,7 +1455,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/empty-manifest"),
+ service_.get(), MockHttpServer::GetMockUrl("files/empty-manifest"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1383,7 +1498,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- http_server_->TestServerPage("files/empty-file-manifest"),
+ MockHttpServer::GetMockUrl("files/empty-file-manifest"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1577,7 +1692,7 @@ class AppCacheUpdateJobTest : public testing::Test,
storage->SimulateStoreGroupAndNewestCacheFailure();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"),
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1605,7 +1720,7 @@ class AppCacheUpdateJobTest : public testing::Test,
storage->SimulateStoreGroupAndNewestCacheFailure();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"),
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1650,7 +1765,7 @@ class AppCacheUpdateJobTest : public testing::Test,
storage->SimulateMakeGroupObsoleteFailure();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/gone"),
+ service_.get(), MockHttpServer::GetMockUrl("files/gone"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1679,7 +1794,7 @@ class AppCacheUpdateJobTest : public testing::Test,
storage->SimulateMakeGroupObsoleteFailure();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/nosuchfile"),
+ service_.get(), MockHttpServer::GetMockUrl("files/nosuchfile"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1742,13 +1857,13 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- http_server_->TestServerPage("files/bad-manifest"), 111);
+ MockHttpServer::GetMockUrl("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_ = http_server_->TestServerPage("files/blah");
+ host->new_master_entry_url_ = MockHttpServer::GetMockUrl("files/blah");
update->StartUpdate(host, host->new_master_entry_url_);
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -1768,13 +1883,13 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/nosuchfile"), 111);
+ service_.get(), MockHttpServer::GetMockUrl("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_ = http_server_->TestServerPage("files/blah");
+ host->new_master_entry_url_ = MockHttpServer::GetMockUrl("files/blah");
update->StartUpdate(host, host->new_master_entry_url_);
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -1795,7 +1910,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- http_server_->TestServerPage("files/manifest-fb-404"), 111);
+ MockHttpServer::GetMockUrl("files/manifest-fb-404"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1803,7 +1918,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend->SetIgnoreProgressEvents(true);
AppCacheHost* host = MakeHost(1, frontend);
host->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit1");
+ MockHttpServer::GetMockUrl("files/explicit1");
update->StartUpdate(host, host->new_master_entry_url_);
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -1825,7 +1940,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1833,14 +1948,14 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend1->SetIgnoreProgressEvents(true);
AppCacheHost* host1 = MakeHost(1, frontend1);
host1->new_master_entry_url_ =
- http_server_->TestServerPage("files/nosuchfile");
+ MockHttpServer::GetMockUrl("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_ =
- http_server_->TestServerPage("files/servererror");
+ MockHttpServer::GetMockUrl("files/servererror");
update->StartUpdate(host2, host2->new_master_entry_url_);
// Set up checks for when update job finishes.
@@ -1864,7 +1979,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1877,14 +1992,14 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- http_server_->TestServerPage("files/nosuchfile");
+ MockHttpServer::GetMockUrl("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_ =
- http_server_->TestServerPage("files/servererror");
+ MockHttpServer::GetMockUrl("files/servererror");
update->StartUpdate(host3, host3->new_master_entry_url_);
// Set up checks for when update job finishes.
@@ -1916,7 +2031,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1924,13 +2039,13 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend1->SetIgnoreProgressEvents(true);
AppCacheHost* host1 = MakeHost(1, frontend1);
host1->new_master_entry_url_ =
- http_server_->TestServerPage("files/nosuchfile");
+ MockHttpServer::GetMockUrl("files/nosuchfile");
update->StartUpdate(host1, host1->new_master_entry_url_);
MockFrontend* frontend2 = MakeMockFrontend();
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit2");
+ MockHttpServer::GetMockUrl("files/explicit2");
update->StartUpdate(host2, host2->new_master_entry_url_);
// Set up checks for when update job finishes.
@@ -1939,7 +2054,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(
- http_server_->TestServerPage("files/explicit2"),
+ MockHttpServer::GetMockUrl("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER)));
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
@@ -1961,7 +2076,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -1974,13 +2089,13 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- http_server_->TestServerPage("files/nosuchfile");
+ MockHttpServer::GetMockUrl("files/nosuchfile");
update->StartUpdate(host2, host2->new_master_entry_url_);
MockFrontend* frontend3 = MakeMockFrontend();
AppCacheHost* host3 = MakeHost(3, frontend3);
host3->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit2");
+ MockHttpServer::GetMockUrl("files/explicit2");
update->StartUpdate(host3, host3->new_master_entry_url_);
// Set up checks for when update job finishes.
@@ -1990,7 +2105,7 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_old_cache_ = cache;
tested_manifest_ = MANIFEST1;
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- http_server_->TestServerPage("files/explicit2"),
+ MockHttpServer::GetMockUrl("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER)));
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
@@ -2018,7 +2133,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(service_.get(),
- http_server_->TestServerPage("files/notmodified"), 111);
+ MockHttpServer::GetMockUrl("files/notmodified"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2028,7 +2143,7 @@ class AppCacheUpdateJobTest : public testing::Test,
host1->AssociateCache(cache);
// Give cache an existing entry that can also be fetched.
- cache->AddEntry(http_server_->TestServerPage("files/explicit2"),
+ cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit2"),
AppCacheEntry(AppCacheEntry::EXPLICIT, 222));
// Reset the update time to null so we can verify it gets
@@ -2038,12 +2153,12 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend2 = MakeMockFrontend();
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit1");
+ MockHttpServer::GetMockUrl("files/explicit1");
update->StartUpdate(host2, host2->new_master_entry_url_);
AppCacheHost* host3 = MakeHost(3, frontend2); // same frontend as host2
host3->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit2");
+ MockHttpServer::GetMockUrl("files/explicit2");
update->StartUpdate(host3, host3->new_master_entry_url_);
// Set up checks for when update job finishes.
@@ -2071,7 +2186,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"),
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2079,7 +2194,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend1 = MakeMockFrontend();
AppCacheHost* host1 = MakeHost(1, frontend1);
host1->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit2");
+ MockHttpServer::GetMockUrl("files/explicit2");
update->StartUpdate(host1, host1->new_master_entry_url_);
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -2088,17 +2203,17 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- http_server_->TestServerPage("files/nosuchfile");
+ MockHttpServer::GetMockUrl("files/nosuchfile");
MockFrontend* frontend3 = MakeMockFrontend();
AppCacheHost* host3 = MakeHost(3, frontend3);
host3->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit1");
+ MockHttpServer::GetMockUrl("files/explicit1");
MockFrontend* frontend4 = MakeMockFrontend();
AppCacheHost* host4 = MakeHost(4, frontend4);
host4->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit2");
+ MockHttpServer::GetMockUrl("files/explicit2");
MockFrontend* frontend5 = MakeMockFrontend();
AppCacheHost* host5 = MakeHost(5, frontend5); // no master entry url
@@ -2116,7 +2231,7 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_group_has_cache_ = true;
tested_manifest_ = MANIFEST1;
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- http_server_->TestServerPage("files/explicit2"),
+ MockHttpServer::GetMockUrl("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER)));
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
@@ -2157,7 +2272,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/notmodified"),
+ service_.get(), MockHttpServer::GetMockUrl("files/notmodified"),
service_->storage()->NewGroupId());
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2168,7 +2283,7 @@ class AppCacheUpdateJobTest : public testing::Test,
host1->AssociateCache(cache);
// Give cache an existing entry.
- cache->AddEntry(http_server_->TestServerPage("files/explicit2"),
+ cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit2"),
AppCacheEntry(AppCacheEntry::EXPLICIT, 222));
// Start update with a pending master entry that will fail to give us an
@@ -2176,7 +2291,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend2 = MakeMockFrontend();
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- http_server_->TestServerPage("files/nosuchfile");
+ MockHttpServer::GetMockUrl("files/nosuchfile");
update->StartUpdate(host2, host2->new_master_entry_url_);
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -2184,7 +2299,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend3 = MakeMockFrontend();
AppCacheHost* host3 = MakeHost(3, frontend3);
host3->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit1");
+ MockHttpServer::GetMockUrl("files/explicit1");
MockFrontend* frontend4 = MakeMockFrontend();
AppCacheHost* host4 = MakeHost(4, frontend4); // no master entry url
@@ -2192,12 +2307,12 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend5 = MakeMockFrontend();
AppCacheHost* host5 = MakeHost(5, frontend5);
host5->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit2"); // existing entry
+ MockHttpServer::GetMockUrl("files/explicit2"); // existing entry
MockFrontend* frontend6 = MakeMockFrontend();
AppCacheHost* host6 = MakeHost(6, frontend6);
host6->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit1");
+ MockHttpServer::GetMockUrl("files/explicit1");
frontend2->TriggerAdditionalUpdates(ERROR_EVENT, update);
frontend2->AdditionalUpdateHost(host3);
@@ -2237,7 +2352,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2252,12 +2367,12 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend2 = MakeMockFrontend();
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit1");
+ MockHttpServer::GetMockUrl("files/explicit1");
MockFrontend* frontend3 = MakeMockFrontend();
AppCacheHost* host3 = MakeHost(3, frontend3);
host3->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit2");
+ MockHttpServer::GetMockUrl("files/explicit2");
MockFrontend* frontend4 = MakeMockFrontend();
AppCacheHost* host4 = MakeHost(4, frontend4); // no master entry url
@@ -2265,7 +2380,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend5 = MakeMockFrontend();
AppCacheHost* host5 = MakeHost(5, frontend5);
host5->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit2");
+ MockHttpServer::GetMockUrl("files/explicit2");
frontend1->TriggerAdditionalUpdates(PROGRESS_EVENT, update);
frontend1->AdditionalUpdateHost(host2); // same as entry in manifest
@@ -2280,7 +2395,7 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_group_has_cache_ = true;
tested_manifest_ = MANIFEST1;
expect_extra_entries_.insert(AppCache::EntryMap::value_type(
- http_server_->TestServerPage("files/explicit2"),
+ MockHttpServer::GetMockUrl("files/explicit2"),
AppCacheEntry(AppCacheEntry::MASTER)));
MockFrontend::HostIds ids1(1, host1->host_id()); // prior associated host
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
@@ -2319,7 +2434,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2332,7 +2447,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend = MakeMockFrontend();
AppCacheHost* host = MakeHost(1, frontend);
host->new_master_entry_url_ =
- http_server_->TestServerPage("files/explicit2");
+ MockHttpServer::GetMockUrl("files/explicit2");
update->StartUpdate(host, host->new_master_entry_url_);
EXPECT_TRUE(update->pending_master_entries_.empty());
EXPECT_FALSE(group_->queued_updates_.empty());
@@ -2436,7 +2551,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2494,7 +2609,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MakeService();
group_ = new AppCacheGroup(
- service_.get(), http_server_->TestServerPage("files/manifest1"), 111);
+ service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
group_->update_job_ = update;
@@ -2802,14 +2917,14 @@ class AppCacheUpdateJobTest : public testing::Test,
size_t expected = 3 + expect_extra_entries_.size();
EXPECT_EQ(expected, cache->entries().size());
AppCacheEntry* entry =
- cache->GetEntry(http_server_->TestServerPage("files/manifest1"));
+ cache->GetEntry(MockHttpServer::GetMockUrl("files/manifest1"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MANIFEST, entry->types());
- entry = cache->GetEntry(http_server_->TestServerPage("files/explicit1"));
+ entry = cache->GetEntry(MockHttpServer::GetMockUrl("files/explicit1"));
ASSERT_TRUE(entry);
EXPECT_TRUE(entry->IsExplicit());
entry = cache->GetEntry(
- http_server_->TestServerPage("files/fallback1a"));
+ MockHttpServer::GetMockUrl("files/fallback1a"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::FALLBACK, entry->types());
@@ -2826,8 +2941,8 @@ class AppCacheUpdateJobTest : public testing::Test,
std::find(cache->fallback_namespaces_.begin(),
cache->fallback_namespaces_.end(),
FallbackNamespace(
- http_server_->TestServerPage("files/fallback1"),
- http_server_->TestServerPage("files/fallback1a"))));
+ MockHttpServer::GetMockUrl("files/fallback1"),
+ MockHttpServer::GetMockUrl("files/fallback1a"))));
EXPECT_TRUE(cache->online_whitelist_namespaces_.empty());
EXPECT_TRUE(cache->online_whitelist_all_);
@@ -2839,11 +2954,11 @@ class AppCacheUpdateJobTest : public testing::Test,
size_t expected = 2;
EXPECT_EQ(expected, cache->entries().size());
AppCacheEntry* entry = cache->GetEntry(
- http_server_->TestServerPage("files/manifest-merged-types"));
+ MockHttpServer::GetMockUrl("files/manifest-merged-types"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::EXPLICIT | AppCacheEntry::MANIFEST,
entry->types());
- entry = cache->GetEntry(http_server_->TestServerPage("files/explicit1"));
+ entry = cache->GetEntry(MockHttpServer::GetMockUrl("files/explicit1"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::EXPLICIT | AppCacheEntry::FALLBACK |
AppCacheEntry::MASTER, entry->types());
@@ -2854,14 +2969,14 @@ class AppCacheUpdateJobTest : public testing::Test,
std::find(cache->fallback_namespaces_.begin(),
cache->fallback_namespaces_.end(),
FallbackNamespace(
- http_server_->TestServerPage("files/fallback1"),
- http_server_->TestServerPage("files/explicit1"))));
+ MockHttpServer::GetMockUrl("files/fallback1"),
+ MockHttpServer::GetMockUrl("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(),
- http_server_->TestServerPage("files/online1")));
+ MockHttpServer::GetMockUrl("files/online1")));
EXPECT_FALSE(cache->online_whitelist_all_);
EXPECT_TRUE(cache->update_time_ > base::Time());
@@ -2871,7 +2986,7 @@ class AppCacheUpdateJobTest : public testing::Test,
size_t expected = 1;
EXPECT_EQ(expected, cache->entries().size());
AppCacheEntry* entry = cache->GetEntry(
- http_server_->TestServerPage("files/empty-manifest"));
+ MockHttpServer::GetMockUrl("files/empty-manifest"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MANIFEST, entry->types());
@@ -2885,12 +3000,12 @@ class AppCacheUpdateJobTest : public testing::Test,
void VerifyEmptyFileManifest(AppCache* cache) {
EXPECT_EQ(size_t(2), cache->entries().size());
AppCacheEntry* entry = cache->GetEntry(
- http_server_->TestServerPage("files/empty-file-manifest"));
+ MockHttpServer::GetMockUrl("files/empty-file-manifest"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MANIFEST, entry->types());
entry = cache->GetEntry(
- http_server_->TestServerPage("files/empty1"));
+ MockHttpServer::GetMockUrl("files/empty1"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::EXPLICIT, entry->types());
EXPECT_TRUE(entry->has_response_id());
@@ -2905,18 +3020,18 @@ class AppCacheUpdateJobTest : public testing::Test,
void VerifyMasterEntryNoUpdate(AppCache* cache) {
EXPECT_EQ(size_t(3), cache->entries().size());
AppCacheEntry* entry = cache->GetEntry(
- http_server_->TestServerPage("files/notmodified"));
+ MockHttpServer::GetMockUrl("files/notmodified"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MANIFEST, entry->types());
entry = cache->GetEntry(
- http_server_->TestServerPage("files/explicit1"));
+ MockHttpServer::GetMockUrl("files/explicit1"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MASTER, entry->types());
EXPECT_TRUE(entry->has_response_id());
entry = cache->GetEntry(
- http_server_->TestServerPage("files/explicit2"));
+ MockHttpServer::GetMockUrl("files/explicit2"));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::EXPLICIT | AppCacheEntry::MASTER, entry->types());
EXPECT_TRUE(entry->has_response_id());
@@ -2940,7 +3055,6 @@ class AppCacheUpdateJobTest : public testing::Test,
};
static IOThread* io_thread_;
- static HTTPTestServer* http_server_;
scoped_ptr<MockAppCacheService> service_;
scoped_refptr<AppCacheGroup> group_;
@@ -2974,7 +3088,6 @@ class AppCacheUpdateJobTest : public testing::Test,
// static
IOThread* AppCacheUpdateJobTest::io_thread_ = NULL;
-HTTPTestServer* AppCacheUpdateJobTest::http_server_ = NULL;
base::WaitableEvent* AppCacheUpdateJobTest::io_thread_shutdown_event_ = NULL;
diff --git a/webkit/appcache/data/appcache_unittest/bad-manifest b/webkit/appcache/data/appcache_unittest/bad-manifest
deleted file mode 100644
index 6a7d6e2..0000000
--- a/webkit/appcache/data/appcache_unittest/bad-manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-BAD CACHE MANIFEST
-
diff --git a/webkit/appcache/data/appcache_unittest/bad-manifest.mock-http-headers b/webkit/appcache/data/appcache_unittest/bad-manifest.mock-http-headers
deleted file mode 100644
index 6e904b9..0000000
--- a/webkit/appcache/data/appcache_unittest/bad-manifest.mock-http-headers
+++ /dev/null
@@ -1,2 +0,0 @@
-HTTP/1.1 200 OK
-Content-type: text/cache-manifest
diff --git a/webkit/appcache/data/appcache_unittest/empty-file-manifest b/webkit/appcache/data/appcache_unittest/empty-file-manifest
deleted file mode 100644
index e58b0c0..0000000
--- a/webkit/appcache/data/appcache_unittest/empty-file-manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-CACHE MANIFEST
-empty1
-
diff --git a/webkit/appcache/data/appcache_unittest/empty-file-manifest.mock-http-headers b/webkit/appcache/data/appcache_unittest/empty-file-manifest.mock-http-headers
deleted file mode 100644
index 6e904b9..0000000
--- a/webkit/appcache/data/appcache_unittest/empty-file-manifest.mock-http-headers
+++ /dev/null
@@ -1,2 +0,0 @@
-HTTP/1.1 200 OK
-Content-type: text/cache-manifest
diff --git a/webkit/appcache/data/appcache_unittest/empty-manifest b/webkit/appcache/data/appcache_unittest/empty-manifest
deleted file mode 100644
index af16a0e..0000000
--- a/webkit/appcache/data/appcache_unittest/empty-manifest
+++ /dev/null
@@ -1 +0,0 @@
-CACHE MANIFEST
diff --git a/webkit/appcache/data/appcache_unittest/empty-manifest.mock-http-headers b/webkit/appcache/data/appcache_unittest/empty-manifest.mock-http-headers
deleted file mode 100644
index 6e904b9..0000000
--- a/webkit/appcache/data/appcache_unittest/empty-manifest.mock-http-headers
+++ /dev/null
@@ -1,2 +0,0 @@
-HTTP/1.1 200 OK
-Content-type: text/cache-manifest
diff --git a/webkit/appcache/data/appcache_unittest/empty1 b/webkit/appcache/data/appcache_unittest/empty1
deleted file mode 100644
index e69de29..0000000
--- a/webkit/appcache/data/appcache_unittest/empty1
+++ /dev/null
diff --git a/webkit/appcache/data/appcache_unittest/explicit1 b/webkit/appcache/data/appcache_unittest/explicit1
deleted file mode 100644
index 33e739e..0000000
--- a/webkit/appcache/data/appcache_unittest/explicit1
+++ /dev/null
@@ -1 +0,0 @@
-explicit1
diff --git a/webkit/appcache/data/appcache_unittest/explicit2 b/webkit/appcache/data/appcache_unittest/explicit2
deleted file mode 100644
index 2128ad6..0000000
--- a/webkit/appcache/data/appcache_unittest/explicit2
+++ /dev/null
@@ -1 +0,0 @@
-explicit2
diff --git a/webkit/appcache/data/appcache_unittest/fallback1a b/webkit/appcache/data/appcache_unittest/fallback1a
deleted file mode 100644
index 62cd309..0000000
--- a/webkit/appcache/data/appcache_unittest/fallback1a
+++ /dev/null
@@ -1 +0,0 @@
-fallback1a
diff --git a/webkit/appcache/data/appcache_unittest/gone b/webkit/appcache/data/appcache_unittest/gone
deleted file mode 100644
index 97896a0..0000000
--- a/webkit/appcache/data/appcache_unittest/gone
+++ /dev/null
@@ -1 +0,0 @@
-nothing \ No newline at end of file
diff --git a/webkit/appcache/data/appcache_unittest/gone.mock-http-headers b/webkit/appcache/data/appcache_unittest/gone.mock-http-headers
deleted file mode 100644
index 2817c70..0000000
--- a/webkit/appcache/data/appcache_unittest/gone.mock-http-headers
+++ /dev/null
@@ -1 +0,0 @@
-HTTP/1.1 410 GONE
diff --git a/webkit/appcache/data/appcache_unittest/manifest-fb-404 b/webkit/appcache/data/appcache_unittest/manifest-fb-404
deleted file mode 100644
index 47a49a9..0000000
--- a/webkit/appcache/data/appcache_unittest/manifest-fb-404
+++ /dev/null
@@ -1,7 +0,0 @@
-CACHE MANIFEST
-explicit1
-FALLBACK:
-fallback1 fallback1a
-fallback404 fallback-404
-NETWORK:
-online1
diff --git a/webkit/appcache/data/appcache_unittest/manifest-fb-404.mock-http-headers b/webkit/appcache/data/appcache_unittest/manifest-fb-404.mock-http-headers
deleted file mode 100644
index 6e904b9..0000000
--- a/webkit/appcache/data/appcache_unittest/manifest-fb-404.mock-http-headers
+++ /dev/null
@@ -1,2 +0,0 @@
-HTTP/1.1 200 OK
-Content-type: text/cache-manifest
diff --git a/webkit/appcache/data/appcache_unittest/manifest-merged-types b/webkit/appcache/data/appcache_unittest/manifest-merged-types
deleted file mode 100644
index 5c6589b..0000000
--- a/webkit/appcache/data/appcache_unittest/manifest-merged-types
+++ /dev/null
@@ -1,9 +0,0 @@
-CACHE MANIFEST
-explicit1
-# manifest is also an explicit entry
-manifest-merged-types
-FALLBACK:
-# fallback is also explicit entry
-fallback1 explicit1
-NETWORK:
-online1
diff --git a/webkit/appcache/data/appcache_unittest/manifest-merged-types.mock-http-headers b/webkit/appcache/data/appcache_unittest/manifest-merged-types.mock-http-headers
deleted file mode 100644
index 6e904b9..0000000
--- a/webkit/appcache/data/appcache_unittest/manifest-merged-types.mock-http-headers
+++ /dev/null
@@ -1,2 +0,0 @@
-HTTP/1.1 200 OK
-Content-type: text/cache-manifest
diff --git a/webkit/appcache/data/appcache_unittest/manifest-with-404 b/webkit/appcache/data/appcache_unittest/manifest-with-404
deleted file mode 100644
index 353fad7..0000000
--- a/webkit/appcache/data/appcache_unittest/manifest-with-404
+++ /dev/null
@@ -1,9 +0,0 @@
-CACHE MANIFEST
-explicit-404
-explicit1
-explicit2
-explicit3
-FALLBACK:
-fallback1 fallback1a
-NETWORK:
-online1
diff --git a/webkit/appcache/data/appcache_unittest/manifest-with-404.mock-http-headers b/webkit/appcache/data/appcache_unittest/manifest-with-404.mock-http-headers
deleted file mode 100644
index 6e904b9..0000000
--- a/webkit/appcache/data/appcache_unittest/manifest-with-404.mock-http-headers
+++ /dev/null
@@ -1,2 +0,0 @@
-HTTP/1.1 200 OK
-Content-type: text/cache-manifest
diff --git a/webkit/appcache/data/appcache_unittest/manifest1 b/webkit/appcache/data/appcache_unittest/manifest1
deleted file mode 100644
index b33fad5..0000000
--- a/webkit/appcache/data/appcache_unittest/manifest1
+++ /dev/null
@@ -1,6 +0,0 @@
-CACHE MANIFEST
-explicit1
-FALLBACK:
-fallback1 fallback1a
-NETWORK:
-*
diff --git a/webkit/appcache/data/appcache_unittest/manifest1.mock-http-headers b/webkit/appcache/data/appcache_unittest/manifest1.mock-http-headers
deleted file mode 100644
index 6e904b9..0000000
--- a/webkit/appcache/data/appcache_unittest/manifest1.mock-http-headers
+++ /dev/null
@@ -1,2 +0,0 @@
-HTTP/1.1 200 OK
-Content-type: text/cache-manifest
diff --git a/webkit/appcache/data/appcache_unittest/notmodified b/webkit/appcache/data/appcache_unittest/notmodified
deleted file mode 100644
index b3f1762..0000000
--- a/webkit/appcache/data/appcache_unittest/notmodified
+++ /dev/null
@@ -1 +0,0 @@
-nochange \ No newline at end of file
diff --git a/webkit/appcache/data/appcache_unittest/notmodified.mock-http-headers b/webkit/appcache/data/appcache_unittest/notmodified.mock-http-headers
deleted file mode 100644
index b86db0d..0000000
--- a/webkit/appcache/data/appcache_unittest/notmodified.mock-http-headers
+++ /dev/null
@@ -1 +0,0 @@
-HTTP/1.1 304 NOT MODIFIED
diff --git a/webkit/appcache/data/appcache_unittest/servererror b/webkit/appcache/data/appcache_unittest/servererror
deleted file mode 100644
index 760589c..0000000
--- a/webkit/appcache/data/appcache_unittest/servererror
+++ /dev/null
@@ -1 +0,0 @@
-error \ No newline at end of file
diff --git a/webkit/appcache/data/appcache_unittest/servererror.mock-http-headers b/webkit/appcache/data/appcache_unittest/servererror.mock-http-headers
deleted file mode 100644
index 472aa4b..0000000
--- a/webkit/appcache/data/appcache_unittest/servererror.mock-http-headers
+++ /dev/null
@@ -1 +0,0 @@
-HTTP/1.1 500 INTERNAL SERVER ERROR