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/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "content/browser/service_worker/embedded_worker_registry.h" | 7 #include "content/browser/service_worker/embedded_worker_registry.h" |
8 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 8 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
10 #include "content/browser/service_worker/service_worker_registration.h" | 10 #include "content/browser/service_worker/service_worker_registration.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 virtual void SetUp() OVERRIDE { | 119 virtual void SetUp() OVERRIDE { |
120 helper_.reset(new MessageReceiver()); | 120 helper_.reset(new MessageReceiver()); |
121 | 121 |
122 registration_ = new ServiceWorkerRegistration( | 122 registration_ = new ServiceWorkerRegistration( |
123 GURL("http://www.example.com/"), | 123 GURL("http://www.example.com/"), |
124 GURL("http://www.example.com/service_worker.js"), | 124 GURL("http://www.example.com/service_worker.js"), |
125 1L, | 125 1L, |
126 helper_->context()->AsWeakPtr()); | 126 helper_->context()->AsWeakPtr()); |
127 version_ = new ServiceWorkerVersion( | 127 version_ = new ServiceWorkerVersion( |
128 registration_, 1L, helper_->context()->AsWeakPtr()); | 128 registration_.get(), 1L, helper_->context()->AsWeakPtr()); |
129 | 129 |
130 // Simulate adding one process to the worker. | 130 // Simulate adding one process to the worker. |
131 int embedded_worker_id = version_->embedded_worker()->embedded_worker_id(); | 131 int embedded_worker_id = version_->embedded_worker()->embedded_worker_id(); |
132 helper_->SimulateAddProcessToWorker(embedded_worker_id, kRenderProcessId); | 132 helper_->SimulateAddProcessToWorker(embedded_worker_id, kRenderProcessId); |
133 ASSERT_TRUE(version_->HasProcessToRun()); | 133 ASSERT_TRUE(version_->HasProcessToRun()); |
134 } | 134 } |
135 | 135 |
136 virtual void TearDown() OVERRIDE { | 136 virtual void TearDown() OVERRIDE { |
137 version_ = 0; | 137 version_ = 0; |
138 registration_ = 0; | 138 registration_ = 0; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 NULL)); | 381 NULL)); |
382 version_->AddControllee(host.get()); | 382 version_->AddControllee(host.get()); |
383 EXPECT_FALSE(version_->stop_worker_timer_.IsRunning()); | 383 EXPECT_FALSE(version_->stop_worker_timer_.IsRunning()); |
384 | 384 |
385 // The timer should be running if the controllee is removed. | 385 // The timer should be running if the controllee is removed. |
386 version_->RemoveControllee(host.get()); | 386 version_->RemoveControllee(host.get()); |
387 EXPECT_TRUE(version_->stop_worker_timer_.IsRunning()); | 387 EXPECT_TRUE(version_->stop_worker_timer_.IsRunning()); |
388 } | 388 } |
389 | 389 |
390 } // namespace content | 390 } // namespace content |
OLD | NEW |