| 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_registration.h" | 5 #include "content/browser/service_worker/service_worker_registration.h" |
| 6 | 6 |
| 7 | 7 |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "content/browser/browser_thread_impl.h" | 11 #include "content/browser/browser_thread_impl.h" |
| 12 #include "content/browser/service_worker/service_worker_context_core.h" | 12 #include "content/browser/service_worker/service_worker_context_core.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 class ServiceWorkerRegistrationTest : public testing::Test { | 18 class ServiceWorkerRegistrationTest : public testing::Test { |
| 19 public: | 19 public: |
| 20 ServiceWorkerRegistrationTest() | 20 ServiceWorkerRegistrationTest() |
| 21 : io_thread_(BrowserThread::IO, &message_loop_) {} | 21 : io_thread_(BrowserThread::IO, &message_loop_) {} |
| 22 | 22 |
| 23 virtual void SetUp() OVERRIDE { | 23 virtual void SetUp() OVERRIDE { |
| 24 context_.reset(new ServiceWorkerContextCore(base::FilePath(), NULL, NULL)); | 24 context_.reset(new ServiceWorkerContextCore( |
| 25 base::FilePath(), |
| 26 NULL, |
| 27 NULL, |
| 28 scoped_ptr<ServiceWorkerProcessManager>())); |
| 25 context_ptr_ = context_->AsWeakPtr(); | 29 context_ptr_ = context_->AsWeakPtr(); |
| 26 } | 30 } |
| 27 | 31 |
| 28 protected: | 32 protected: |
| 29 scoped_ptr<ServiceWorkerContextCore> context_; | 33 scoped_ptr<ServiceWorkerContextCore> context_; |
| 30 base::WeakPtr<ServiceWorkerContextCore> context_ptr_; | 34 base::WeakPtr<ServiceWorkerContextCore> context_ptr_; |
| 31 base::MessageLoopForIO message_loop_; | 35 base::MessageLoopForIO message_loop_; |
| 32 BrowserThreadImpl io_thread_; | 36 BrowserThreadImpl io_thread_; |
| 33 }; | 37 }; |
| 34 | 38 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 55 | 59 |
| 56 registration->ActivatePendingVersion(); | 60 registration->ActivatePendingVersion(); |
| 57 DCHECK_EQ(version_2, registration->active_version()); | 61 DCHECK_EQ(version_2, registration->active_version()); |
| 58 DCHECK(version_1->HasOneRef()); | 62 DCHECK(version_1->HasOneRef()); |
| 59 version_1 = NULL; | 63 version_1 = NULL; |
| 60 | 64 |
| 61 DCHECK(!version_2->HasOneRef()); | 65 DCHECK(!version_2->HasOneRef()); |
| 62 } | 66 } |
| 63 | 67 |
| 64 } // namespace content | 68 } // namespace content |
| OLD | NEW |