| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 const GURL pattern = embedded_test_server()->GetURL("/service_worker/"); | 517 const GURL pattern = embedded_test_server()->GetURL("/service_worker/"); |
| 518 registration_ = new ServiceWorkerRegistration( | 518 registration_ = new ServiceWorkerRegistration( |
| 519 pattern, | 519 pattern, |
| 520 wrapper()->context()->storage()->NewRegistrationId(), | 520 wrapper()->context()->storage()->NewRegistrationId(), |
| 521 wrapper()->context()->AsWeakPtr()); | 521 wrapper()->context()->AsWeakPtr()); |
| 522 version_ = new ServiceWorkerVersion( | 522 version_ = new ServiceWorkerVersion( |
| 523 registration_.get(), | 523 registration_.get(), |
| 524 embedded_test_server()->GetURL(worker_url), | 524 embedded_test_server()->GetURL(worker_url), |
| 525 wrapper()->context()->storage()->NewVersionId(), | 525 wrapper()->context()->storage()->NewVersionId(), |
| 526 wrapper()->context()->AsWeakPtr()); | 526 wrapper()->context()->AsWeakPtr()); |
| 527 |
| 528 // Make the registration findable via storage functions. |
| 529 wrapper()->context()->storage()->NotifyInstallingRegistration( |
| 530 registration_.get()); |
| 531 |
| 527 AssociateRendererProcessToPattern(pattern); | 532 AssociateRendererProcessToPattern(pattern); |
| 528 } | 533 } |
| 529 | 534 |
| 530 void TimeoutWorkerOnIOThread() { | 535 void TimeoutWorkerOnIOThread() { |
| 531 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 536 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 532 version_->PingWorker(); | 537 version_->PingWorker(); |
| 533 version_->OnPingTimeout(); | 538 version_->OnPingTimeout(); |
| 534 } | 539 } |
| 535 | 540 |
| 536 void StartWorker(ServiceWorkerStatusCode expected_status) { | 541 void StartWorker(ServiceWorkerStatusCode expected_status) { |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 ASSERT_EQ(SERVICE_WORKER_OK, status); | 1203 ASSERT_EQ(SERVICE_WORKER_OK, status); |
| 1199 // Stop the worker. | 1204 // Stop the worker. |
| 1200 StopWorker(SERVICE_WORKER_OK); | 1205 StopWorker(SERVICE_WORKER_OK); |
| 1201 // Restart the worker. | 1206 // Restart the worker. |
| 1202 StartWorker(SERVICE_WORKER_OK); | 1207 StartWorker(SERVICE_WORKER_OK); |
| 1203 // Stop the worker. | 1208 // Stop the worker. |
| 1204 StopWorker(SERVICE_WORKER_OK); | 1209 StopWorker(SERVICE_WORKER_OK); |
| 1205 } | 1210 } |
| 1206 | 1211 |
| 1207 } // namespace content | 1212 } // namespace content |
| OLD | NEW |