| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/service_worker/service_worker_dispatcher_host.h" | 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 void SetUpRegistration(const GURL& scope, const GURL& script_url) { | 126 void SetUpRegistration(const GURL& scope, const GURL& script_url) { |
| 127 registration_ = new ServiceWorkerRegistration( | 127 registration_ = new ServiceWorkerRegistration( |
| 128 scope, 1L, helper_->context()->AsWeakPtr()); | 128 scope, 1L, helper_->context()->AsWeakPtr()); |
| 129 version_ = new ServiceWorkerVersion(registration_.get(), script_url, 1L, | 129 version_ = new ServiceWorkerVersion(registration_.get(), script_url, 1L, |
| 130 helper_->context()->AsWeakPtr()); | 130 helper_->context()->AsWeakPtr()); |
| 131 std::vector<ServiceWorkerDatabase::ResourceRecord> records; | 131 std::vector<ServiceWorkerDatabase::ResourceRecord> records; |
| 132 records.push_back( | 132 records.push_back( |
| 133 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); | 133 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); |
| 134 version_->script_cache_map()->SetResources(records); | 134 version_->script_cache_map()->SetResources(records); |
| 135 version_->SetMainScriptHttpResponseInfo( |
| 136 EmbeddedWorkerTestHelper::CreateHttpResponseInfo()); |
| 135 version_->set_fetch_handler_existence( | 137 version_->set_fetch_handler_existence( |
| 136 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); | 138 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); |
| 137 version_->SetStatus(ServiceWorkerVersion::INSTALLING); | 139 version_->SetStatus(ServiceWorkerVersion::INSTALLING); |
| 138 | 140 |
| 139 // Make the registration findable via storage functions. | 141 // Make the registration findable via storage functions. |
| 140 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); | 142 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); |
| 141 base::RunLoop().RunUntilIdle(); | 143 base::RunLoop().RunUntilIdle(); |
| 142 bool called = false; | 144 bool called = false; |
| 143 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_MAX_VALUE; | 145 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_MAX_VALUE; |
| 144 helper_->context()->storage()->StoreRegistration( | 146 helper_->context()->storage()->StoreRegistration( |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 | 854 |
| 853 base::RunLoop().RunUntilIdle(); | 855 base::RunLoop().RunUntilIdle(); |
| 854 EXPECT_EQ(0, dispatcher_host_->bad_messages_received_count_); | 856 EXPECT_EQ(0, dispatcher_host_->bad_messages_received_count_); |
| 855 } | 857 } |
| 856 | 858 |
| 857 INSTANTIATE_TEST_CASE_P(ServiceWorkerDispatcherHostTest, | 859 INSTANTIATE_TEST_CASE_P(ServiceWorkerDispatcherHostTest, |
| 858 ServiceWorkerDispatcherHostTestP, | 860 ServiceWorkerDispatcherHostTestP, |
| 859 testing::Bool()); | 861 testing::Bool()); |
| 860 | 862 |
| 861 } // namespace content | 863 } // namespace content |
| OLD | NEW |