Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: content/browser/background_sync/background_sync_manager_unittest.cc

Issue 1536023002: [BackgroundSync] Add max sync event duration to BackgroundSyncParameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sync_time2
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 } 1744 }
1745 1745
1746 TEST_F(BackgroundSyncManagerTest, OverrideParameters) { 1746 TEST_F(BackgroundSyncManagerTest, OverrideParameters) {
1747 BackgroundSyncParameters* parameters = 1747 BackgroundSyncParameters* parameters =
1748 test_controller_->background_sync_parameters(); 1748 test_controller_->background_sync_parameters();
1749 parameters->disable = true; 1749 parameters->disable = true;
1750 parameters->max_sync_attempts = 100; 1750 parameters->max_sync_attempts = 100;
1751 parameters->initial_retry_delay = base::TimeDelta::FromMinutes(200); 1751 parameters->initial_retry_delay = base::TimeDelta::FromMinutes(200);
1752 parameters->retry_delay_factor = 300; 1752 parameters->retry_delay_factor = 300;
1753 parameters->min_sync_recovery_time = base::TimeDelta::FromMinutes(400); 1753 parameters->min_sync_recovery_time = base::TimeDelta::FromMinutes(400);
1754 parameters->max_sync_event_duration = base::TimeDelta::FromMinutes(500);
1754 1755
1755 // Restart the BackgroundSyncManager so that it updates its parameters. 1756 // Restart the BackgroundSyncManager so that it updates its parameters.
1756 SetupBackgroundSyncManager(); 1757 SetupBackgroundSyncManager();
1757 1758
1758 // Check that the manager is disabled 1759 // Check that the manager is disabled
1759 EXPECT_FALSE(Register(sync_options_1_)); 1760 EXPECT_FALSE(Register(sync_options_1_));
1760 EXPECT_EQ(BACKGROUND_SYNC_STATUS_STORAGE_ERROR, callback_status_); 1761 EXPECT_EQ(BACKGROUND_SYNC_STATUS_STORAGE_ERROR, callback_status_);
1761 1762
1762 const BackgroundSyncParameters* manager_parameters = 1763 const BackgroundSyncParameters* manager_parameters =
1763 test_background_sync_manager_->background_sync_parameters(); 1764 test_background_sync_manager_->background_sync_parameters();
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 // Run it again. 2025 // Run it again.
2025 test_clock_->Advance(test_background_sync_manager_->delayed_task_delta()); 2026 test_clock_->Advance(test_background_sync_manager_->delayed_task_delta());
2026 test_background_sync_manager_->delayed_task().Run(); 2027 test_background_sync_manager_->delayed_task().Run();
2027 base::RunLoop().RunUntilIdle(); 2028 base::RunLoop().RunUntilIdle();
2028 EXPECT_FALSE(GetRegistration(sync_options_1_)); 2029 EXPECT_FALSE(GetRegistration(sync_options_1_));
2029 EXPECT_EQ(BACKGROUND_SYNC_EVENT_LAST_CHANCE_IS_LAST_CHANCE, 2030 EXPECT_EQ(BACKGROUND_SYNC_EVENT_LAST_CHANCE_IS_LAST_CHANCE,
2030 test_background_sync_manager_->last_chance()); 2031 test_background_sync_manager_->last_chance());
2031 } 2032 }
2032 2033
2033 } // namespace content 2034 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698