| Index: content/browser/background_sync/background_sync_manager_unittest.cc
|
| diff --git a/content/browser/background_sync/background_sync_manager_unittest.cc b/content/browser/background_sync/background_sync_manager_unittest.cc
|
| index e80881c12ee41f3cca8082c5e93781397412db4b..b6b73fd40748abd9d60f44281c04676f1c286375 100644
|
| --- a/content/browser/background_sync/background_sync_manager_unittest.cc
|
| +++ b/content/browser/background_sync/background_sync_manager_unittest.cc
|
| @@ -374,7 +374,20 @@ class BackgroundSyncManagerTest : public testing::Test {
|
| const BackgroundSyncRegistrationOptions& options) {
|
| bool was_called = false;
|
| background_sync_manager_->Register(
|
| - sw_registration_id, options,
|
| + sw_registration_id, options, true /* requested_from_service_worker */,
|
| + base::Bind(&BackgroundSyncManagerTest::StatusAndRegistrationCallback,
|
| + base::Unretained(this), &was_called));
|
| + base::RunLoop().RunUntilIdle();
|
| + EXPECT_TRUE(was_called);
|
| + return callback_status_ == BACKGROUND_SYNC_STATUS_OK;
|
| + }
|
| +
|
| + bool RegisterFromDocumentWithServiceWorkerId(
|
| + int64 sw_registration_id,
|
| + const BackgroundSyncRegistrationOptions& options) {
|
| + bool was_called = false;
|
| + background_sync_manager_->Register(
|
| + sw_registration_id, options, false /* requested_from_service_worker */,
|
| base::Bind(&BackgroundSyncManagerTest::StatusAndRegistrationCallback,
|
| base::Unretained(this), &was_called));
|
| base::RunLoop().RunUntilIdle();
|
| @@ -782,6 +795,7 @@ TEST_F(BackgroundSyncManagerTest, SequentialOperations) {
|
| bool get_registration_called = false;
|
| test_background_sync_manager_->Register(
|
| sw_registration_id_1_, sync_options_1_,
|
| + true /* requested_from_service_worker */,
|
| base::Bind(&BackgroundSyncManagerTest::StatusAndRegistrationCallback,
|
| base::Unretained(this), ®ister_called));
|
| test_background_sync_manager_->Unregister(
|
| @@ -839,6 +853,7 @@ TEST_F(BackgroundSyncManagerTest,
|
| bool callback_called = false;
|
| test_background_sync_manager_->Register(
|
| sw_registration_id_1_, sync_options_2_,
|
| + true /* requested_from_service_worker */,
|
| base::Bind(&BackgroundSyncManagerTest::StatusAndRegistrationCallback,
|
| base::Unretained(this), &callback_called));
|
|
|
| @@ -1269,6 +1284,12 @@ TEST_F(BackgroundSyncManagerTest, RegisterExistingFailsWithoutWindow) {
|
| EXPECT_FALSE(Register(sync_options_1_));
|
| }
|
|
|
| +TEST_F(BackgroundSyncManagerTest, RegisterSucceedsFromUncontrolledWindow) {
|
| + RemoveWindowClients();
|
| + EXPECT_TRUE(RegisterFromDocumentWithServiceWorkerId(sw_registration_id_1_,
|
| + sync_options_1_));
|
| +}
|
| +
|
| TEST_F(BackgroundSyncManagerTest, UnregisterSucceedsWithoutWindow) {
|
| EXPECT_TRUE(Register(sync_options_1_));
|
| RemoveWindowClients();
|
|
|