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

Side by Side Diff: content/browser/service_worker/service_worker_url_request_job_unittest.cc

Issue 895933007: [Storage] Blob items are now shared between blobs. Ready for disk swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/browser/fileapi/chrome_blob_storage_context.h" 10 #include "content/browser/fileapi/chrome_blob_storage_context.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 TEST_F(ServiceWorkerURLRequestJobTest, BlobResponse) { 248 TEST_F(ServiceWorkerURLRequestJobTest, BlobResponse) {
249 ChromeBlobStorageContext* blob_storage_context = 249 ChromeBlobStorageContext* blob_storage_context =
250 ChromeBlobStorageContext::GetFor(browser_context_.get()); 250 ChromeBlobStorageContext::GetFor(browser_context_.get());
251 std::string expected_response; 251 std::string expected_response;
252 expected_response.reserve((sizeof(kTestData) - 1) * 1024); 252 expected_response.reserve((sizeof(kTestData) - 1) * 1024);
253 for (int i = 0; i < 1024; ++i) { 253 for (int i = 0; i < 1024; ++i) {
254 blob_data_->AppendData(kTestData); 254 blob_data_->AppendData(kTestData);
255 expected_response += kTestData; 255 expected_response += kTestData;
256 } 256 }
257 scoped_ptr<storage::BlobDataHandle> blob_handle = 257 scoped_ptr<storage::BlobDataHandle> blob_handle =
258 blob_storage_context->context()->AddFinishedBlob(*blob_data_.get()); 258 blob_storage_context->context()->AddFinishedBlob(blob_data_.get());
259 SetUpWithHelper(new BlobResponder( 259 SetUpWithHelper(new BlobResponder(
260 kProcessID, blob_handle->uuid(), expected_response.size())); 260 kProcessID, blob_handle->uuid(), expected_response.size()));
261 261
262 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); 262 version_->SetStatus(ServiceWorkerVersion::ACTIVATED);
263 TestRequest(200, "OK", expected_response); 263 TestRequest(200, "OK", expected_response);
264 } 264 }
265 265
266 TEST_F(ServiceWorkerURLRequestJobTest, NonExistentBlobUUIDResponse) { 266 TEST_F(ServiceWorkerURLRequestJobTest, NonExistentBlobUUIDResponse) {
267 SetUpWithHelper(new BlobResponder(kProcessID, "blob-id:nothing-is-here", 0)); 267 SetUpWithHelper(new BlobResponder(kProcessID, "blob-id:nothing-is-here", 0));
268 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); 268 version_->SetStatus(ServiceWorkerVersion::ACTIVATED);
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 stream->Finalize(); 528 stream->Finalize();
529 529
530 base::RunLoop().RunUntilIdle(); 530 base::RunLoop().RunUntilIdle();
531 EXPECT_FALSE(request_->status().is_success()); 531 EXPECT_FALSE(request_->status().is_success());
532 } 532 }
533 533
534 // TODO(kinuko): Add more tests with different response data and also for 534 // TODO(kinuko): Add more tests with different response data and also for
535 // FallbackToNetwork case. 535 // FallbackToNetwork case.
536 536
537 } // namespace content 537 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698