Chromium Code Reviews| Index: content/browser/service_worker/service_worker_browsertest.cc |
| diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc |
| index d07d19683c5d582b33b62827e41539a74b4245f9..f3e77c1f5f692c3cc92b703498da86d7913b7f9b 100644 |
| --- a/content/browser/service_worker/service_worker_browsertest.cc |
| +++ b/content/browser/service_worker/service_worker_browsertest.cc |
| @@ -39,6 +39,7 @@ struct FetchResult { |
| ServiceWorkerStatusCode status; |
| ServiceWorkerFetchEventResult result; |
| ServiceWorkerResponse response; |
| + scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle; |
| }; |
| void RunAndQuit(const base::Closure& closure, |
| @@ -76,6 +77,7 @@ void RunOnIOThread( |
| // to pass to DispatchFetchEvent. |
| void ReceiveFetchResult(BrowserThread::ID run_quit_thread, |
| const base::Closure& quit, |
| + ChromeBlobStorageContext* blob_context, |
| FetchResult* out_result, |
| ServiceWorkerStatusCode actual_status, |
| ServiceWorkerFetchEventResult actual_result, |
| @@ -83,6 +85,11 @@ void ReceiveFetchResult(BrowserThread::ID run_quit_thread, |
| out_result->status = actual_status; |
| out_result->result = actual_result; |
| out_result->response = actual_response; |
| + if (!actual_response.blob_uuid.empty()) { |
| + out_result->blob_data_handle = |
| + blob_context->context()->GetBlobDataFromUUID( |
| + actual_response.blob_uuid); |
| + } |
| if (!quit.is_null()) |
| BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, quit); |
| } |
| @@ -90,8 +97,10 @@ void ReceiveFetchResult(BrowserThread::ID run_quit_thread, |
| ServiceWorkerVersion::FetchCallback CreateResponseReceiver( |
| BrowserThread::ID run_quit_thread, |
| const base::Closure& quit, |
| + ChromeBlobStorageContext* blob_context, |
| FetchResult* result) { |
| - return base::Bind(&ReceiveFetchResult, run_quit_thread, quit, result); |
| + return base::Bind(&ReceiveFetchResult, run_quit_thread, quit, |
| + blob_context, result); |
| } |
| void ReadResponseBody(std::string* body, |
| @@ -302,6 +311,8 @@ class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest { |
| void FetchOnRegisteredWorker(ServiceWorkerFetchEventResult* result, |
| ServiceWorkerResponse* response) { |
| + blob_context_ = ChromeBlobStorageContext::GetFor( |
| + shell()->web_contents()->GetBrowserContext()); |
| FetchResult fetch_result; |
|
michaeln
2014/06/06 22:59:24
ooops, this isn't right yet
|
| fetch_result.status = SERVICE_WORKER_ERROR_FAILED; |
| base::RunLoop fetch_run_loop; |
| @@ -322,7 +333,6 @@ class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest { |
| ServiceWorkerResponse* response) { |
| RunOnIOThread( |
| base::Bind(&self::SetUpRegistrationOnIOThread, this, worker_url)); |
| - |
| FetchOnRegisteredWorker(result, response); |
| } |
| @@ -368,7 +378,8 @@ class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest { |
| std::map<std::string, std::string>()); |
| version_->SetStatus(ServiceWorkerVersion::ACTIVE); |
| version_->DispatchFetchEvent( |
| - request, CreateResponseReceiver(BrowserThread::UI, done, result)); |
| + request, CreateResponseReceiver(BrowserThread::UI, done, |
| + blob_context_, result)); |
| } |
| void StopOnIOThread(const base::Closure& done, |
| @@ -388,6 +399,7 @@ class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest { |
| protected: |
| scoped_refptr<ServiceWorkerRegistration> registration_; |
| scoped_refptr<ServiceWorkerVersion> version_; |
| + scoped_refptr<ChromeBlobStorageContext> blob_context_; |
| }; |
| IN_PROC_BROWSER_TEST_F(EmbeddedWorkerBrowserTest, StartAndStop) { |