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/memory/weak_ptr.h" | 6 #include "base/memory/weak_ptr.h" |
7 #include "content/browser/service_worker/service_worker_context_core.h" | 7 #include "content/browser/service_worker/service_worker_context_core.h" |
8 #include "content/browser/service_worker/service_worker_provider_host.h" | 8 #include "content/browser/service_worker/service_worker_provider_host.h" |
9 #include "content/browser/service_worker/service_worker_register_job.h" | 9 #include "content/browser/service_worker/service_worker_register_job.h" |
10 #include "content/browser/service_worker/service_worker_registration.h" | 10 #include "content/browser/service_worker/service_worker_registration.h" |
11 #include "content/browser/service_worker/service_worker_version.h" | 11 #include "content/browser/service_worker/service_worker_version.h" |
12 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 static const int kRenderProcessId = 33; // Dummy process ID for testing. | 17 static const int kRenderProcessId = 33; // Dummy process ID for testing. |
18 | 18 |
19 class ServiceWorkerProviderHostTest : public testing::Test { | 19 class ServiceWorkerProviderHostTest : public testing::Test { |
20 protected: | 20 protected: |
21 ServiceWorkerProviderHostTest() | 21 ServiceWorkerProviderHostTest() |
22 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} | 22 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} |
23 virtual ~ServiceWorkerProviderHostTest() {} | 23 virtual ~ServiceWorkerProviderHostTest() {} |
24 | 24 |
25 virtual void SetUp() OVERRIDE { | 25 virtual void SetUp() OVERRIDE { |
26 context_.reset(new ServiceWorkerContextCore(base::FilePath(), NULL, NULL)); | 26 context_.reset(new ServiceWorkerContextCore( |
| 27 base::FilePath(), |
| 28 NULL, |
| 29 NULL, |
| 30 scoped_ptr<ServiceWorkerProcessManager>())); |
27 | 31 |
28 scope_ = GURL("http://www.example.com/*"); | 32 scope_ = GURL("http://www.example.com/*"); |
29 script_url_ = GURL("http://www.example.com/service_worker.js"); | 33 script_url_ = GURL("http://www.example.com/service_worker.js"); |
30 registration_ = new ServiceWorkerRegistration( | 34 registration_ = new ServiceWorkerRegistration( |
31 scope_, script_url_, 1L, context_->AsWeakPtr()); | 35 scope_, script_url_, 1L, context_->AsWeakPtr()); |
32 version_ = new ServiceWorkerVersion( | 36 version_ = new ServiceWorkerVersion( |
33 registration_, | 37 registration_, |
34 1L, context_->AsWeakPtr()); | 38 1L, context_->AsWeakPtr()); |
35 | 39 |
36 // Prepare provider hosts (for the same process). | 40 // Prepare provider hosts (for the same process). |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 EXPECT_EQ(version_.get(), provider_host2_->pending_version()); | 183 EXPECT_EQ(version_.get(), provider_host2_->pending_version()); |
180 EXPECT_EQ(NULL, provider_host3_->pending_version()); | 184 EXPECT_EQ(NULL, provider_host3_->pending_version()); |
181 | 185 |
182 register_job_->AssociatePendingVersionToDocuments(NULL); | 186 register_job_->AssociatePendingVersionToDocuments(NULL); |
183 EXPECT_EQ(NULL, provider_host1_->pending_version()); | 187 EXPECT_EQ(NULL, provider_host1_->pending_version()); |
184 EXPECT_EQ(NULL, provider_host2_->pending_version()); | 188 EXPECT_EQ(NULL, provider_host2_->pending_version()); |
185 EXPECT_EQ(NULL, provider_host3_->pending_version()); | 189 EXPECT_EQ(NULL, provider_host3_->pending_version()); |
186 } | 190 } |
187 | 191 |
188 } // namespace content | 192 } // namespace content |
OLD | NEW |