| 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 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 scoped_ptr<ServiceWorkerContextCore> context_; | 66 scoped_ptr<ServiceWorkerContextCore> context_; |
| 67 base::WeakPtr<ServiceWorkerContextCore> context_ptr_; | 67 base::WeakPtr<ServiceWorkerContextCore> context_ptr_; |
| 68 base::MessageLoopForIO message_loop_; | 68 base::MessageLoopForIO message_loop_; |
| 69 BrowserThreadImpl io_thread_; | 69 BrowserThreadImpl io_thread_; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 TEST_F(ServiceWorkerRegistrationTest, SetAndUnsetVersions) { | 72 TEST_F(ServiceWorkerRegistrationTest, SetAndUnsetVersions) { |
| 73 const GURL kScope("http://www.example.not/*"); | 73 const GURL kScope("http://www.example.not/"); |
| 74 const GURL kScript("http://www.example.not/service_worker.js"); | 74 const GURL kScript("http://www.example.not/service_worker.js"); |
| 75 int64 kRegistrationId = 1L; | 75 int64 kRegistrationId = 1L; |
| 76 scoped_refptr<ServiceWorkerRegistration> registration = | 76 scoped_refptr<ServiceWorkerRegistration> registration = |
| 77 new ServiceWorkerRegistration( | 77 new ServiceWorkerRegistration( |
| 78 kScope, | 78 kScope, |
| 79 kScript, | 79 kScript, |
| 80 kRegistrationId, | 80 kRegistrationId, |
| 81 context_ptr_); | 81 context_ptr_); |
| 82 | 82 |
| 83 const int64 version_1_id = 1L; | 83 const int64 version_1_id = 1L; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 EXPECT_FALSE(registration->waiting_version()); | 132 EXPECT_FALSE(registration->waiting_version()); |
| 133 EXPECT_EQ(ChangedVersionAttributesMask::WAITING_VERSION, | 133 EXPECT_EQ(ChangedVersionAttributesMask::WAITING_VERSION, |
| 134 listener.observed_changed_mask_.changed()); | 134 listener.observed_changed_mask_.changed()); |
| 135 EXPECT_EQ(version_1_id, listener.observed_info_.active_version.version_id); | 135 EXPECT_EQ(version_1_id, listener.observed_info_.active_version.version_id); |
| 136 EXPECT_TRUE(listener.observed_info_.waiting_version.is_null); | 136 EXPECT_TRUE(listener.observed_info_.waiting_version.is_null); |
| 137 EXPECT_TRUE(listener.observed_info_.installing_version.is_null); | 137 EXPECT_TRUE(listener.observed_info_.installing_version.is_null); |
| 138 EXPECT_TRUE(listener.observed_info_.controlling_version.is_null); | 138 EXPECT_TRUE(listener.observed_info_.controlling_version.is_null); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace content | 141 } // namespace content |
| OLD | NEW |