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) { |