Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: content/browser/service_worker/service_worker_cache_unittest.cc

Issue 545533002: Move ServiceWorkerCache backend creation to a lazy init function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_pointers_keys
Patch Set: Nits Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/service_worker/service_worker_cache_storage.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_cache_unittest.cc
diff --git a/content/browser/service_worker/service_worker_cache_unittest.cc b/content/browser/service_worker/service_worker_cache_unittest.cc
index 2fab1d8dc66d10c056b73b573a91de3dcb34fc6b..533116f309517f7958d07d11974ec16ac7d5d076 100644
--- a/content/browser/service_worker/service_worker_cache_unittest.cc
+++ b/content/browser/service_worker/service_worker_cache_unittest.cc
@@ -75,7 +75,6 @@ class ServiceWorkerCacheTest : public testing::Test {
url_request_context,
blob_storage_context->context()->AsWeakPtr());
}
- CreateBackend();
}
void CreateRequests(ChromeBlobStorageContext* blob_storage_context) {
@@ -112,15 +111,6 @@ class ServiceWorkerCacheTest : public testing::Test {
GURL("http://example.com/no_body.html"), 200, "OK", headers, "");
}
- void CreateBackend() {
- scoped_ptr<base::RunLoop> loop(new base::RunLoop());
- cache_->CreateBackend(base::Bind(&ServiceWorkerCacheTest::ErrorTypeCallback,
- base::Unretained(this),
- base::Unretained(loop.get())));
- loop->Run();
- EXPECT_EQ(ServiceWorkerCache::ErrorTypeOK, callback_error_);
- }
-
scoped_ptr<ServiceWorkerFetchRequest> CopyFetchRequest(
const ServiceWorkerFetchRequest& request) {
return make_scoped_ptr(new ServiceWorkerFetchRequest(request.url,
@@ -282,19 +272,20 @@ TEST_P(ServiceWorkerCacheTestP, PutBody) {
EXPECT_TRUE(Put(body_request_, body_response_));
}
-TEST_P(ServiceWorkerCacheTestP, PutBodyDropBlobRef) {
+TEST_F(ServiceWorkerCacheTest, PutBodyDropBlobRef) {
scoped_ptr<base::RunLoop> loop(new base::RunLoop());
cache_->Put(CopyFetchRequest(body_request_),
CopyFetchResponse(body_response_),
base::Bind(&ServiceWorkerCacheTestP::ErrorTypeCallback,
base::Unretained(this),
base::Unretained(loop.get())));
- // The handle should be held by the cache now so the deref here should be
- // okay.
+ // The BlobHandle needs to be held onto by the caller until either the
michaeln1 2014/09/05 23:28:49 That's too bad. Not suggesting this for this cl,
jkarlin 2014/09/09 19:14:34 Done.
+ // callback returns or the cache is deleted, otherwise Put() fails as shown
+ // here.
blob_handle_.reset();
loop->Run();
- EXPECT_EQ(ServiceWorkerCache::ErrorTypeOK, callback_error_);
+ EXPECT_EQ(ServiceWorkerCache::ErrorTypeStorage, callback_error_);
}
TEST_P(ServiceWorkerCacheTestP, MatchNoBody) {
« no previous file with comments | « content/browser/service_worker/service_worker_cache_storage.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698