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 "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/power_monitor/power_monitor.h" | 10 #include "base/power_monitor/power_monitor.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 continuation_ = | 176 continuation_ = |
177 base::Bind(&TestBackgroundSyncManager::GetDataFromBackendContinue, | 177 base::Bind(&TestBackgroundSyncManager::GetDataFromBackendContinue, |
178 base::Unretained(this), key, callback); | 178 base::Unretained(this), key, callback); |
179 if (delay_backend_) | 179 if (delay_backend_) |
180 return; | 180 return; |
181 | 181 |
182 Continue(); | 182 Continue(); |
183 } | 183 } |
184 | 184 |
185 void FireOneShotSync( | 185 void FireOneShotSync( |
| 186 const BackgroundSyncRegistration& registration, |
186 const scoped_refptr<ServiceWorkerVersion>& active_version, | 187 const scoped_refptr<ServiceWorkerVersion>& active_version, |
187 const ServiceWorkerVersion::StatusCallback& callback) override { | 188 const ServiceWorkerVersion::StatusCallback& callback) override { |
188 if (one_shot_callback_.is_null()) { | 189 if (one_shot_callback_.is_null()) { |
189 BackgroundSyncManager::FireOneShotSync(active_version, callback); | 190 BackgroundSyncManager::FireOneShotSync(registration, active_version, |
| 191 callback); |
190 } else { | 192 } else { |
191 one_shot_callback_.Run(active_version, callback); | 193 one_shot_callback_.Run(active_version, callback); |
192 } | 194 } |
193 } | 195 } |
194 | 196 |
195 private: | 197 private: |
196 bool corrupt_backend_ = false; | 198 bool corrupt_backend_ = false; |
197 bool delay_backend_ = false; | 199 bool delay_backend_ = false; |
198 base::Closure continuation_; | 200 base::Closure continuation_; |
199 OneShotCallback one_shot_callback_; | 201 OneShotCallback one_shot_callback_; |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 RegisterAndVerifySyncEventDelayed(sync_options_1_); | 1232 RegisterAndVerifySyncEventDelayed(sync_options_1_); |
1231 | 1233 |
1232 // Create a new manager which should fire the sync again on init. | 1234 // Create a new manager which should fire the sync again on init. |
1233 SetupBackgroundSyncManager(); | 1235 SetupBackgroundSyncManager(); |
1234 InitSyncEventTest(); | 1236 InitSyncEventTest(); |
1235 EXPECT_FALSE(GetRegistration(sync_options_1_)); | 1237 EXPECT_FALSE(GetRegistration(sync_options_1_)); |
1236 EXPECT_EQ(2, sync_events_called_); | 1238 EXPECT_EQ(2, sync_events_called_); |
1237 } | 1239 } |
1238 | 1240 |
1239 } // namespace content | 1241 } // namespace content |
OLD | NEW |