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( | 24 context_.reset(new ServiceWorkerContextCore( |
25 base::FilePath(), | 25 base::FilePath(), |
| 26 base::MessageLoopProxy::current(), |
26 NULL, | 27 NULL, |
27 NULL, | 28 NULL, |
28 scoped_ptr<ServiceWorkerProcessManager>())); | 29 scoped_ptr<ServiceWorkerProcessManager>())); |
29 context_ptr_ = context_->AsWeakPtr(); | 30 context_ptr_ = context_->AsWeakPtr(); |
30 } | 31 } |
31 | 32 |
32 protected: | 33 protected: |
33 scoped_ptr<ServiceWorkerContextCore> context_; | 34 scoped_ptr<ServiceWorkerContextCore> context_; |
34 base::WeakPtr<ServiceWorkerContextCore> context_ptr_; | 35 base::WeakPtr<ServiceWorkerContextCore> context_ptr_; |
35 base::MessageLoopForIO message_loop_; | 36 base::MessageLoopForIO message_loop_; |
(...skipping 23 matching lines...) Expand all Loading... |
59 | 60 |
60 registration->ActivatePendingVersion(); | 61 registration->ActivatePendingVersion(); |
61 DCHECK_EQ(version_2, registration->active_version()); | 62 DCHECK_EQ(version_2, registration->active_version()); |
62 DCHECK(version_1->HasOneRef()); | 63 DCHECK(version_1->HasOneRef()); |
63 version_1 = NULL; | 64 version_1 = NULL; |
64 | 65 |
65 DCHECK(!version_2->HasOneRef()); | 66 DCHECK(!version_2->HasOneRef()); |
66 } | 67 } |
67 | 68 |
68 } // namespace content | 69 } // namespace content |
OLD | NEW |