| 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_context.h" | 5 #include "content/browser/service_worker/service_worker_context.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 "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
| 11 #include "content/browser/service_worker/service_worker_context_core.h" | 11 #include "content/browser/service_worker/service_worker_context_core.h" |
| 12 #include "content/browser/service_worker/service_worker_registration.h" | 12 #include "content/browser/service_worker/service_worker_registration.h" |
| 13 #include "content/public/test/test_browser_thread_bundle.h" | 13 #include "content/public/test/test_browser_thread_bundle.h" |
| 14 #include "content/public/test/test_utils.h" | 14 #include "content/public/test/test_utils.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 void SaveResponseCallback(bool* called, | 21 void SaveResponseCallback(bool* called, |
| 22 int64* store_result, | 22 int64* store_result, |
| 23 ServiceWorkerRegistrationStatus status, | 23 ServiceWorkerStatusCode status, |
| 24 int64 result) { | 24 int64 result) { |
| 25 *called = true; | 25 *called = true; |
| 26 *store_result = result; | 26 *store_result = result; |
| 27 } | 27 } |
| 28 | 28 |
| 29 ServiceWorkerContextCore::RegistrationCallback MakeRegisteredCallback( | 29 ServiceWorkerContextCore::RegistrationCallback MakeRegisteredCallback( |
| 30 bool* called, | 30 bool* called, |
| 31 int64* store_result) { | 31 int64* store_result) { |
| 32 return base::Bind(&SaveResponseCallback, called, store_result); | 32 return base::Bind(&SaveResponseCallback, called, store_result); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void CallCompletedCallback(bool* called, ServiceWorkerRegistrationStatus) { | 35 void CallCompletedCallback(bool* called, ServiceWorkerStatusCode) { |
| 36 *called = true; | 36 *called = true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 ServiceWorkerContextCore::UnregistrationCallback MakeUnregisteredCallback( | 39 ServiceWorkerContextCore::UnregistrationCallback MakeUnregisteredCallback( |
| 40 bool* called) { | 40 bool* called) { |
| 41 return base::Bind(&CallCompletedCallback, called); | 41 return base::Bind(&CallCompletedCallback, called); |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace | 44 } // namespace |
| 45 | 45 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 MakeRegisteredCallback(&called, &new_registration_id)); | 159 MakeRegisteredCallback(&called, &new_registration_id)); |
| 160 | 160 |
| 161 ASSERT_FALSE(called); | 161 ASSERT_FALSE(called); |
| 162 base::RunLoop().RunUntilIdle(); | 162 base::RunLoop().RunUntilIdle(); |
| 163 ASSERT_TRUE(called); | 163 ASSERT_TRUE(called); |
| 164 | 164 |
| 165 ASSERT_EQ(old_registration_id, new_registration_id); | 165 ASSERT_EQ(old_registration_id, new_registration_id); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace content | 168 } // namespace content |
| OLD | NEW |