OLD | NEW |
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 "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return new net::URLRequestTestJob(request, network_delegate, | 78 return new net::URLRequestTestJob(request, network_delegate, |
79 net::URLRequestTestJob::test_headers(), | 79 net::URLRequestTestJob::test_headers(), |
80 "PASS", true); | 80 "PASS", true); |
81 } | 81 } |
82 | 82 |
83 job_ = new ServiceWorkerURLRequestJob( | 83 job_ = new ServiceWorkerURLRequestJob( |
84 request, network_delegate, provider_host_, blob_storage_context_, | 84 request, network_delegate, provider_host_, blob_storage_context_, |
85 resource_context_, FETCH_REQUEST_MODE_NO_CORS, | 85 resource_context_, FETCH_REQUEST_MODE_NO_CORS, |
86 FETCH_CREDENTIALS_MODE_OMIT, true /* is_main_resource_load */, | 86 FETCH_CREDENTIALS_MODE_OMIT, true /* is_main_resource_load */, |
87 REQUEST_CONTEXT_TYPE_HYPERLINK, REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, | 87 REQUEST_CONTEXT_TYPE_HYPERLINK, REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, |
88 scoped_refptr<ResourceRequestBody>()); | 88 ServiceWorkerClientInfo(), scoped_refptr<ResourceRequestBody>()); |
89 job_->ForwardToServiceWorker(); | 89 job_->ForwardToServiceWorker(); |
90 return job_; | 90 return job_; |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; | 94 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; |
95 const ResourceContext* resource_context_; | 95 const ResourceContext* resource_context_; |
96 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 96 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
97 mutable ServiceWorkerURLRequestJob* job_; | 97 mutable ServiceWorkerURLRequestJob* job_; |
98 }; | 98 }; |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 base::RunLoop().RunUntilIdle(); | 639 base::RunLoop().RunUntilIdle(); |
640 EXPECT_TRUE(request_->status().is_success()); | 640 EXPECT_TRUE(request_->status().is_success()); |
641 EXPECT_EQ(200, request_->GetResponseCode()); | 641 EXPECT_EQ(200, request_->GetResponseCode()); |
642 EXPECT_EQ("", url_request_delegate_.response_data()); | 642 EXPECT_EQ("", url_request_delegate_.response_data()); |
643 } | 643 } |
644 | 644 |
645 // TODO(kinuko): Add more tests with different response data and also for | 645 // TODO(kinuko): Add more tests with different response data and also for |
646 // FallbackToNetwork case. | 646 // FallbackToNetwork case. |
647 | 647 |
648 } // namespace content | 648 } // namespace content |
OLD | NEW |