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

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

Issue 608593003: Have ServiceWorkerCache::Put return a Response when completed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@put_context
Patch Set: Rebase 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_manager_unittest.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 b4dcc3a1f2cb23d421ac09e7d0c8310880dd0edb..d0077abe7e7d94bae287a5164205035fbb8a2f7a 100644
--- a/content/browser/service_worker/service_worker_cache_unittest.cc
+++ b/content/browser/service_worker/service_worker_cache_unittest.cc
@@ -146,7 +146,7 @@ class ServiceWorkerCacheTest : public testing::Test {
cache_->Put(CopyFetchRequest(request),
CopyFetchResponse(response),
- base::Bind(&ServiceWorkerCacheTest::ErrorTypeCallback,
+ base::Bind(&ServiceWorkerCacheTest::ResponseAndErrorCallback,
base::Unretained(this),
base::Unretained(loop.get())));
// TODO(jkarlin): These functions should use base::RunLoop().RunUntilIdle()
@@ -277,17 +277,28 @@ class ServiceWorkerCacheTestP : public ServiceWorkerCacheTest,
TEST_P(ServiceWorkerCacheTestP, PutNoBody) {
EXPECT_TRUE(Put(no_body_request_, no_body_response_));
+ EXPECT_TRUE(callback_response_);
+ EXPECT_STREQ(no_body_response_.url.spec().c_str(),
+ callback_response_->url.spec().c_str());
+ EXPECT_FALSE(callback_response_data_);
}
TEST_P(ServiceWorkerCacheTestP, PutBody) {
EXPECT_TRUE(Put(body_request_, body_response_));
+ EXPECT_TRUE(callback_response_);
+ EXPECT_STREQ(body_response_.url.spec().c_str(),
+ callback_response_->url.spec().c_str());
+ EXPECT_TRUE(callback_response_data_);
+ std::string response_body;
+ CopyBody(callback_response_data_.get(), &response_body);
+ EXPECT_STREQ(expected_blob_data_.c_str(), response_body.c_str());
}
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::Bind(&ServiceWorkerCacheTestP::ResponseAndErrorCallback,
base::Unretained(this),
base::Unretained(loop.get())));
// The handle should be held by the cache now so the deref here should be
« no previous file with comments | « content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698