| Index: components/safe_browsing_db/v4_update_protocol_manager_unittest.cc
|
| diff --git a/components/safe_browsing_db/v4_update_protocol_manager_unittest.cc b/components/safe_browsing_db/v4_update_protocol_manager_unittest.cc
|
| index e8596e68e89a7a73dd7045b9084d580214dd311d..faf6dad0db2b0f84168f2c7510f2b802c415c2dc 100644
|
| --- a/components/safe_browsing_db/v4_update_protocol_manager_unittest.cc
|
| +++ b/components/safe_browsing_db/v4_update_protocol_manager_unittest.cc
|
| @@ -65,19 +65,20 @@ class V4UpdateProtocolManagerTest : public PlatformTest {
|
| }
|
| }
|
|
|
| - V4ProtocolConfig GetProtocolConfig() {
|
| + V4ProtocolConfig GetProtocolConfig(bool disable_auto_update) {
|
| V4ProtocolConfig config;
|
| config.client_name = kClient;
|
| config.version = kAppVer;
|
| config.key_param = kKeyParam;
|
| - config.disable_auto_update = false;
|
| + config.disable_auto_update = disable_auto_update;
|
| return config;
|
| }
|
|
|
| std::unique_ptr<V4UpdateProtocolManager> CreateProtocolManager(
|
| - const std::vector<ListUpdateResponse>& expected_lurs) {
|
| + const std::vector<ListUpdateResponse>& expected_lurs,
|
| + bool disable_auto_update = false) {
|
| return V4UpdateProtocolManager::Create(
|
| - NULL, GetProtocolConfig(),
|
| + NULL, GetProtocolConfig(disable_auto_update),
|
| base::Bind(&V4UpdateProtocolManagerTest::ValidateGetUpdatesResults,
|
| base::Unretained(this), expected_lurs));
|
| }
|
| @@ -320,4 +321,23 @@ TEST_F(V4UpdateProtocolManagerTest, TestBase64EncodingUsesUrlEncoding) {
|
| // the '-' case is sufficient to prove that we are using URL encoding.
|
| }
|
|
|
| +TEST_F(V4UpdateProtocolManagerTest, TestDisableAutoUpdates) {
|
| + scoped_refptr<base::TestSimpleTaskRunner> runner(
|
| + new base::TestSimpleTaskRunner());
|
| + base::ThreadTaskRunnerHandle runner_handler(runner);
|
| + net::TestURLFetcherFactory factory;
|
| + std::unique_ptr<V4UpdateProtocolManager> pm(CreateProtocolManager(
|
| + std::vector<ListUpdateResponse>(), true /* disable_auto_update */));
|
| +
|
| + // Initial state. No errors.
|
| + pm->ScheduleNextUpdate(std::move(store_state_map_));
|
| + EXPECT_FALSE(pm->IsUpdateScheduled());
|
| +
|
| + runner->RunPendingTasks();
|
| + EXPECT_FALSE(pm->IsUpdateScheduled());
|
| +
|
| + net::TestURLFetcher* fetcher = factory.GetFetcherByID(0);
|
| + DCHECK(!fetcher);
|
| +}
|
| +
|
| } // namespace safe_browsing
|
|
|