| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/background_sync/background_sync_service_impl.h" | 5 #include "content/browser/background_sync/background_sync_service_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/power_monitor/power_monitor.h" | 10 #include "base/power_monitor/power_monitor.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 CreateTestHelper(); | 99 CreateTestHelper(); |
| 100 CreateBackgroundSyncContext(); | 100 CreateBackgroundSyncContext(); |
| 101 CreateServiceWorkerRegistration(); | 101 CreateServiceWorkerRegistration(); |
| 102 CreateBackgroundSyncServiceImpl(); | 102 CreateBackgroundSyncServiceImpl(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void TearDown() override { | 105 void TearDown() override { |
| 106 // This must be explicitly destroyed here to ensure that destruction | 106 // This must be explicitly destroyed here to ensure that destruction |
| 107 // of both the BackgroundSyncContext and the BackgroundSyncManager occurs on | 107 // of both the BackgroundSyncContext and the BackgroundSyncManager occurs on |
| 108 // the correct thread. | 108 // the correct thread. |
| 109 background_sync_context_->Shutdown(); |
| 110 base::RunLoop().RunUntilIdle(); |
| 109 background_sync_context_ = nullptr; | 111 background_sync_context_ = nullptr; |
| 110 } | 112 } |
| 111 | 113 |
| 112 // SetUp helper methods | 114 // SetUp helper methods |
| 113 void CreateTestHelper() { | 115 void CreateTestHelper() { |
| 114 embedded_worker_helper_.reset( | 116 embedded_worker_helper_.reset( |
| 115 new EmbeddedWorkerTestHelper(base::FilePath(), kRenderProcessId)); | 117 new EmbeddedWorkerTestHelper(base::FilePath(), kRenderProcessId)); |
| 116 } | 118 } |
| 117 | 119 |
| 118 void CreateBackgroundSyncContext() { | 120 void CreateBackgroundSyncContext() { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 GetRegistrationsOneShot(base::Bind(&ErrorAndRegistrationListCallback, | 335 GetRegistrationsOneShot(base::Bind(&ErrorAndRegistrationListCallback, |
| 334 &getregistrations_called, | 336 &getregistrations_called, |
| 335 &getregistrations_error, &array_size)); | 337 &getregistrations_error, &array_size)); |
| 336 EXPECT_TRUE(getregistrations_called); | 338 EXPECT_TRUE(getregistrations_called); |
| 337 EXPECT_EQ(BackgroundSyncError::BACKGROUND_SYNC_ERROR_NONE, | 339 EXPECT_EQ(BackgroundSyncError::BACKGROUND_SYNC_ERROR_NONE, |
| 338 getregistrations_error); | 340 getregistrations_error); |
| 339 EXPECT_EQ(1UL, array_size); | 341 EXPECT_EQ(1UL, array_size); |
| 340 } | 342 } |
| 341 | 343 |
| 342 } // namespace content | 344 } // namespace content |
| OLD | NEW |