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

Unified Diff: components/update_client/update_checker_unittest.cc

Issue 1740333002: Allow fallback from https to http for component update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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
« no previous file with comments | « components/update_client/update_checker.cc ('k') | components/update_client/update_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/update_checker_unittest.cc
diff --git a/components/update_client/update_checker_unittest.cc b/components/update_client/update_checker_unittest.cc
index 26873c7a1118e3277d76f938caebf596a160d2b3..334899611f8323b22e910f0645b5037572e22c1b 100644
--- a/components/update_client/update_checker_unittest.cc
+++ b/components/update_client/update_checker_unittest.cc
@@ -47,7 +47,9 @@ class UpdateCheckerTest : public testing::Test {
void SetUp() override;
void TearDown() override;
- void UpdateCheckComplete(int error, const UpdateResponse::Results& results);
+ void UpdateCheckComplete(int error,
+ const UpdateResponse::Results& results,
+ int retry_after_sec);
protected:
void Quit();
@@ -129,7 +131,8 @@ void UpdateCheckerTest::Quit() {
void UpdateCheckerTest::UpdateCheckComplete(
int error,
- const UpdateResponse::Results& results) {
+ const UpdateResponse::Results& results,
+ int retry_after_sec) {
error_ = error;
results_ = results;
Quit();
@@ -308,4 +311,25 @@ TEST_F(UpdateCheckerTest, UpdateCheckCupError) {
EXPECT_EQ(0ul, results_.list.size());
}
+// Tests that the UpdateCheckers will not make an update check for a
+// component that requires encryption when the update check URL is unsecure.
+TEST_F(UpdateCheckerTest, UpdateCheckRequiresEncryptionError) {
+ config_->SetUpdateCheckUrl(GURL("http:\\foo\bar"));
+
+ update_checker_ = UpdateChecker::Create(config_);
+
+ CrxUpdateItem item(BuildCrxUpdateItem());
+ item.component.requires_network_encryption = true;
+ std::vector<CrxUpdateItem*> items_to_check;
+ items_to_check.push_back(&item);
+
+ update_checker_->CheckForUpdates(
+ items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete,
+ base::Unretained(this)));
+ RunThreads();
+
+ EXPECT_EQ(-1, error_);
+ EXPECT_EQ(0u, results_.list.size());
+}
+
} // namespace update_client
« no previous file with comments | « components/update_client/update_checker.cc ('k') | components/update_client/update_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698