| 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_manager.h" | 5 #include "content/browser/background_sync/background_sync_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 new testing::NiceMock<MockPermissionManager>()); | 129 new testing::NiceMock<MockPermissionManager>()); |
| 130 ON_CALL(*mock_permission_manager, | 130 ON_CALL(*mock_permission_manager, |
| 131 GetPermissionStatus(PermissionType::BACKGROUND_SYNC, _, _)) | 131 GetPermissionStatus(PermissionType::BACKGROUND_SYNC, _, _)) |
| 132 .WillByDefault(Return(blink::mojom::PermissionStatus::GRANTED)); | 132 .WillByDefault(Return(blink::mojom::PermissionStatus::GRANTED)); |
| 133 helper_->browser_context()->SetPermissionManager( | 133 helper_->browser_context()->SetPermissionManager( |
| 134 std::move(mock_permission_manager)); | 134 std::move(mock_permission_manager)); |
| 135 | 135 |
| 136 // Create a StoragePartition with the correct BrowserContext so that the | 136 // Create a StoragePartition with the correct BrowserContext so that the |
| 137 // BackgroundSyncManager can find the BrowserContext through it. | 137 // BackgroundSyncManager can find the BrowserContext through it. |
| 138 storage_partition_impl_.reset(new StoragePartitionImpl( | 138 storage_partition_impl_.reset(new StoragePartitionImpl( |
| 139 helper_->browser_context(), base::FilePath(), nullptr, nullptr, nullptr, | 139 helper_->browser_context(), base::FilePath(), nullptr)); |
| 140 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, | |
| 141 nullptr, nullptr)); | |
| 142 helper_->context_wrapper()->set_storage_partition( | 140 helper_->context_wrapper()->set_storage_partition( |
| 143 storage_partition_impl_.get()); | 141 storage_partition_impl_.get()); |
| 144 | 142 |
| 145 SetMaxSyncAttemptsAndRestartManager(1); | 143 SetMaxSyncAttemptsAndRestartManager(1); |
| 146 | 144 |
| 147 // Wait for storage to finish initializing before registering service | 145 // Wait for storage to finish initializing before registering service |
| 148 // workers. | 146 // workers. |
| 149 base::RunLoop().RunUntilIdle(); | 147 base::RunLoop().RunUntilIdle(); |
| 150 RegisterServiceWorkers(); | 148 RegisterServiceWorkers(); |
| 151 } | 149 } |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 // Run it again. | 1312 // Run it again. |
| 1315 test_clock_->Advance(test_background_sync_manager_->delayed_task_delta()); | 1313 test_clock_->Advance(test_background_sync_manager_->delayed_task_delta()); |
| 1316 test_background_sync_manager_->delayed_task().Run(); | 1314 test_background_sync_manager_->delayed_task().Run(); |
| 1317 base::RunLoop().RunUntilIdle(); | 1315 base::RunLoop().RunUntilIdle(); |
| 1318 EXPECT_FALSE(GetRegistration(sync_options_1_)); | 1316 EXPECT_FALSE(GetRegistration(sync_options_1_)); |
| 1319 EXPECT_EQ(blink::mojom::BackgroundSyncEventLastChance::IS_LAST_CHANCE, | 1317 EXPECT_EQ(blink::mojom::BackgroundSyncEventLastChance::IS_LAST_CHANCE, |
| 1320 test_background_sync_manager_->last_chance()); | 1318 test_background_sync_manager_->last_chance()); |
| 1321 } | 1319 } |
| 1322 | 1320 |
| 1323 } // namespace content | 1321 } // namespace content |
| OLD | NEW |