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

Unified Diff: components/safe_browsing_db/v4_update_protocol_manager_unittest.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « components/safe_browsing_db/v4_update_protocol_manager.cc ('k') | components/strings/components_strings_am.xtb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698