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 "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "content/browser/browser_thread_impl.h" | 12 #include "content/browser/browser_thread_impl.h" |
13 #include "content/browser/service_worker/service_worker_context_core.h" | 13 #include "content/browser/service_worker/service_worker_context_core.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class ServiceWorkerRegistrationTest : public testing::Test { | 19 class ServiceWorkerRegistrationTest : public testing::Test { |
20 public: | 20 public: |
21 ServiceWorkerRegistrationTest() | 21 ServiceWorkerRegistrationTest() |
22 : io_thread_(BrowserThread::IO, &message_loop_) {} | 22 : io_thread_(BrowserThread::IO, &message_loop_) {} |
23 | 23 |
24 virtual void SetUp() OVERRIDE { | 24 virtual void SetUp() OVERRIDE { |
25 context_.reset(new ServiceWorkerContextCore( | 25 context_.reset( |
26 base::FilePath(), | 26 new ServiceWorkerContextCore(base::FilePath(), |
27 base::MessageLoopProxy::current(), | 27 base::MessageLoopProxy::current(), |
28 base::MessageLoopProxy::current(), | 28 base::MessageLoopProxy::current(), |
29 NULL, | 29 NULL, |
30 NULL, | 30 NULL, |
31 scoped_ptr<ServiceWorkerProcessManager>())); | 31 NULL)); |
32 context_ptr_ = context_->AsWeakPtr(); | 32 context_ptr_ = context_->AsWeakPtr(); |
33 } | 33 } |
34 | 34 |
35 virtual void TearDown() OVERRIDE { | 35 virtual void TearDown() OVERRIDE { |
36 context_.reset(); | 36 context_.reset(); |
37 base::RunLoop().RunUntilIdle(); | 37 base::RunLoop().RunUntilIdle(); |
38 } | 38 } |
39 | 39 |
40 protected: | 40 protected: |
41 scoped_ptr<ServiceWorkerContextCore> context_; | 41 scoped_ptr<ServiceWorkerContextCore> context_; |
(...skipping 25 matching lines...) Expand all Loading... |
67 | 67 |
68 registration->ActivatePendingVersion(); | 68 registration->ActivatePendingVersion(); |
69 DCHECK_EQ(version_2, registration->active_version()); | 69 DCHECK_EQ(version_2, registration->active_version()); |
70 DCHECK(version_1->HasOneRef()); | 70 DCHECK(version_1->HasOneRef()); |
71 version_1 = NULL; | 71 version_1 = NULL; |
72 | 72 |
73 DCHECK(!version_2->HasOneRef()); | 73 DCHECK(!version_2->HasOneRef()); |
74 } | 74 } |
75 | 75 |
76 } // namespace content | 76 } // namespace content |
OLD | NEW |