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

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

Issue 810403004: [Storage] Blob Storage Refactoring pt 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed copyright Created 5 years, 11 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/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/fileapi/chrome_blob_storage_context.h" 10 #include "content/browser/fileapi/chrome_blob_storage_context.h"
(...skipping 19 matching lines...) Expand all
30 #include "content/public/test/content_browser_test_utils.h" 30 #include "content/public/test/content_browser_test_utils.h"
31 #include "content/shell/browser/shell.h" 31 #include "content/shell/browser/shell.h"
32 #include "content/shell/browser/shell_content_browser_client.h" 32 #include "content/shell/browser/shell_content_browser_client.h"
33 #include "net/test/embedded_test_server/embedded_test_server.h" 33 #include "net/test/embedded_test_server/embedded_test_server.h"
34 #include "net/test/embedded_test_server/http_request.h" 34 #include "net/test/embedded_test_server/http_request.h"
35 #include "net/test/embedded_test_server/http_response.h" 35 #include "net/test/embedded_test_server/http_response.h"
36 #include "net/url_request/url_request_filter.h" 36 #include "net/url_request/url_request_filter.h"
37 #include "net/url_request/url_request_interceptor.h" 37 #include "net/url_request/url_request_interceptor.h"
38 #include "net/url_request/url_request_test_job.h" 38 #include "net/url_request/url_request_test_job.h"
39 #include "storage/browser/blob/blob_data_handle.h" 39 #include "storage/browser/blob/blob_data_handle.h"
40 #include "storage/browser/blob/blob_data_snapshot.h"
40 #include "storage/browser/blob/blob_storage_context.h" 41 #include "storage/browser/blob/blob_storage_context.h"
41 #include "storage/common/blob/blob_data.h"
42 42
43 namespace content { 43 namespace content {
44 44
45 namespace { 45 namespace {
46 46
47 struct FetchResult { 47 struct FetchResult {
48 ServiceWorkerStatusCode status; 48 ServiceWorkerStatusCode status;
49 ServiceWorkerFetchEventResult result; 49 ServiceWorkerFetchEventResult result;
50 ServiceWorkerResponse response; 50 ServiceWorkerResponse response;
51 scoped_ptr<storage::BlobDataHandle> blob_data_handle; 51 scoped_ptr<storage::BlobDataHandle> blob_data_handle;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 ChromeBlobStorageContext* blob_context, 117 ChromeBlobStorageContext* blob_context,
118 FetchResult* result) { 118 FetchResult* result) {
119 return base::Bind(&ReceiveFetchResult, run_quit_thread, quit, 119 return base::Bind(&ReceiveFetchResult, run_quit_thread, quit,
120 make_scoped_refptr<ChromeBlobStorageContext>(blob_context), 120 make_scoped_refptr<ChromeBlobStorageContext>(blob_context),
121 result); 121 result);
122 } 122 }
123 123
124 void ReadResponseBody(std::string* body, 124 void ReadResponseBody(std::string* body,
125 storage::BlobDataHandle* blob_data_handle) { 125 storage::BlobDataHandle* blob_data_handle) {
126 ASSERT_TRUE(blob_data_handle); 126 ASSERT_TRUE(blob_data_handle);
127 ASSERT_EQ(1U, blob_data_handle->data()->items().size()); 127 scoped_ptr<storage::BlobDataSnapshot> data =
128 *body = std::string(blob_data_handle->data()->items()[0].bytes(), 128 blob_data_handle->CreateSnapshot();
129 blob_data_handle->data()->items()[0].length()); 129 ASSERT_EQ(1U, data->items().size());
130 *body = std::string(data->items()[0]->bytes(), data->items()[0]->length());
130 } 131 }
131 132
132 void ExpectResultAndRun(bool expected, 133 void ExpectResultAndRun(bool expected,
133 const base::Closure& continuation, 134 const base::Closure& continuation,
134 bool actual) { 135 bool actual) {
135 EXPECT_EQ(expected, actual); 136 EXPECT_EQ(expected, actual);
136 continuation.Run(); 137 continuation.Run();
137 } 138 }
138 139
139 class WorkerActivatedObserver 140 class WorkerActivatedObserver
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 const base::string16 kOKTitle2(base::ASCIIToUTF16("OK_2")); 970 const base::string16 kOKTitle2(base::ASCIIToUTF16("OK_2"));
970 const base::string16 kFailTitle2(base::ASCIIToUTF16("FAIL_2")); 971 const base::string16 kFailTitle2(base::ASCIIToUTF16("FAIL_2"));
971 content::TitleWatcher title_watcher2(shell()->web_contents(), kOKTitle2); 972 content::TitleWatcher title_watcher2(shell()->web_contents(), kOKTitle2);
972 title_watcher2.AlsoWaitForTitle(kFailTitle2); 973 title_watcher2.AlsoWaitForTitle(kFailTitle2);
973 974
974 NavigateToURL(shell(), embedded_test_server()->GetURL(kConfirmPageUrl)); 975 NavigateToURL(shell(), embedded_test_server()->GetURL(kConfirmPageUrl));
975 EXPECT_EQ(kOKTitle2, title_watcher2.WaitAndGetTitle()); 976 EXPECT_EQ(kOKTitle2, title_watcher2.WaitAndGetTitle());
976 } 977 }
977 978
978 } // namespace content 979 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698