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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, nullptr, nullptr, |
140 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, | 140 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, |
141 nullptr, nullptr)); | 141 nullptr, nullptr, nullptr)); |
142 helper_->context_wrapper()->set_storage_partition( | 142 helper_->context_wrapper()->set_storage_partition( |
143 storage_partition_impl_.get()); | 143 storage_partition_impl_.get()); |
144 | 144 |
145 SetMaxSyncAttemptsAndRestartManager(1); | 145 SetMaxSyncAttemptsAndRestartManager(1); |
146 | 146 |
147 // Wait for storage to finish initializing before registering service | 147 // Wait for storage to finish initializing before registering service |
148 // workers. | 148 // workers. |
149 base::RunLoop().RunUntilIdle(); | 149 base::RunLoop().RunUntilIdle(); |
150 RegisterServiceWorkers(); | 150 RegisterServiceWorkers(); |
151 } | 151 } |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 // Run it again. | 1314 // Run it again. |
1315 test_clock_->Advance(test_background_sync_manager_->delayed_task_delta()); | 1315 test_clock_->Advance(test_background_sync_manager_->delayed_task_delta()); |
1316 test_background_sync_manager_->delayed_task().Run(); | 1316 test_background_sync_manager_->delayed_task().Run(); |
1317 base::RunLoop().RunUntilIdle(); | 1317 base::RunLoop().RunUntilIdle(); |
1318 EXPECT_FALSE(GetRegistration(sync_options_1_)); | 1318 EXPECT_FALSE(GetRegistration(sync_options_1_)); |
1319 EXPECT_EQ(blink::mojom::BackgroundSyncEventLastChance::IS_LAST_CHANCE, | 1319 EXPECT_EQ(blink::mojom::BackgroundSyncEventLastChance::IS_LAST_CHANCE, |
1320 test_background_sync_manager_->last_chance()); | 1320 test_background_sync_manager_->last_chance()); |
1321 } | 1321 } |
1322 | 1322 |
1323 } // namespace content | 1323 } // namespace content |
OLD | NEW |