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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 virtual void TearDown() OVERRIDE { | 136 virtual void TearDown() OVERRIDE { |
137 version_ = 0; | 137 version_ = 0; |
138 registration_ = 0; | 138 registration_ = 0; |
139 helper_.reset(); | 139 helper_.reset(); |
140 } | 140 } |
141 | 141 |
142 TestBrowserThreadBundle thread_bundle_; | 142 TestBrowserThreadBundle thread_bundle_; |
143 scoped_ptr<MessageReceiver> helper_; | 143 scoped_ptr<MessageReceiver> helper_; |
144 scoped_refptr<ServiceWorkerRegistration> registration_; | 144 scoped_refptr<ServiceWorkerRegistration> registration_; |
145 scoped_refptr<ServiceWorkerVersion> version_; | 145 scoped_refptr<ServiceWorkerVersion> version_; |
| 146 |
| 147 private: |
146 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersionTest); | 148 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersionTest); |
147 }; | 149 }; |
148 | 150 |
149 TEST_F(ServiceWorkerVersionTest, ConcurrentStartAndStop) { | 151 TEST_F(ServiceWorkerVersionTest, ConcurrentStartAndStop) { |
150 // Call StartWorker() multiple times. | 152 // Call StartWorker() multiple times. |
151 ServiceWorkerStatusCode status1 = SERVICE_WORKER_ERROR_FAILED; | 153 ServiceWorkerStatusCode status1 = SERVICE_WORKER_ERROR_FAILED; |
152 ServiceWorkerStatusCode status2 = SERVICE_WORKER_ERROR_FAILED; | 154 ServiceWorkerStatusCode status2 = SERVICE_WORKER_ERROR_FAILED; |
153 ServiceWorkerStatusCode status3 = SERVICE_WORKER_ERROR_FAILED; | 155 ServiceWorkerStatusCode status3 = SERVICE_WORKER_ERROR_FAILED; |
154 version_->StartWorker(CreateReceiverOnCurrentThread(&status1)); | 156 version_->StartWorker(CreateReceiverOnCurrentThread(&status1)); |
155 version_->StartWorker(CreateReceiverOnCurrentThread(&status2)); | 157 version_->StartWorker(CreateReceiverOnCurrentThread(&status2)); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // multiple times should be handled correctly. | 341 // multiple times should be handled correctly. |
340 ASSERT_TRUE(version_->HasProcessToRun()); | 342 ASSERT_TRUE(version_->HasProcessToRun()); |
341 | 343 |
342 // Removing the process again (so that # of AddProcess == # of RemoveProcess | 344 // Removing the process again (so that # of AddProcess == # of RemoveProcess |
343 // for the process) should remove all process references. | 345 // for the process) should remove all process references. |
344 version_->RemoveProcessFromWorker(another_process_id); | 346 version_->RemoveProcessFromWorker(another_process_id); |
345 ASSERT_FALSE(version_->HasProcessToRun()); | 347 ASSERT_FALSE(version_->HasProcessToRun()); |
346 } | 348 } |
347 | 349 |
348 } // namespace content | 350 } // namespace content |
OLD | NEW |