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

Unified Diff: chrome/browser/component_updater/chrome_component_updater_configurator_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
Index: chrome/browser/component_updater/chrome_component_updater_configurator_unittest.cc
diff --git a/chrome/browser/component_updater/chrome_component_updater_configurator_unittest.cc b/chrome/browser/component_updater/chrome_component_updater_configurator_unittest.cc
index 996fd0daec5138aa6cb2e1abb7c7d1da294adecb..dcd57143b343edf607c84f582876f8cc523f796f 100644
--- a/chrome/browser/component_updater/chrome_component_updater_configurator_unittest.cc
+++ b/chrome/browser/component_updater/chrome_component_updater_configurator_unittest.cc
@@ -9,6 +9,8 @@
#include "base/memory/ref_counted.h"
#include "chrome/browser/component_updater/chrome_component_updater_configurator.h"
#include "components/component_updater/component_updater_switches.h"
+#include "components/component_updater/component_updater_url_constants.h"
+#include "components/component_updater/configurator_impl.h"
#include "components/update_client/configurator.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -67,7 +69,7 @@ TEST(ChromeComponentUpdaterConfiguratorTest, TestUpdaterDefaultUrl) {
const auto urls = config->UpdateUrl();
// Expect the default url to be cryptographically secure.
- EXPECT_GE(urls.size(), 1ul);
+ EXPECT_GE(urls.size(), 1u);
EXPECT_TRUE(urls.front().SchemeIsCryptographic());
}
@@ -78,4 +80,35 @@ TEST(ChromeComponentUpdaterConfiguratorTest, TestUseCupSigning) {
EXPECT_TRUE(config->UseCupSigning());
}
+TEST(ChromeComponentUpdaterConfiguratorTest, TestUseEncryption) {
+ base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
+ const auto config(MakeChromeComponentUpdaterConfigurator(cmdline, nullptr));
+
+ const auto urls = config->UpdateUrl();
+ ASSERT_EQ(2u, urls.size());
+ ASSERT_STREQ(kUpdaterDefaultUrl, urls[0].spec().c_str());
+ ASSERT_STREQ(kUpdaterFallbackUrl, urls[1].spec().c_str());
+
+ ASSERT_EQ(config->UpdateUrl(), config->PingUrl());
+
+ // Use the configurator implementation to test the filtering of
+ // unencrypted URLs.
+ {
+ const ConfiguratorImpl config(cmdline, nullptr, true);
+ const auto urls = config.UpdateUrl();
+ ASSERT_EQ(1u, urls.size());
+ ASSERT_STREQ(kUpdaterDefaultUrl, urls[0].spec().c_str());
+ ASSERT_EQ(config.UpdateUrl(), config.PingUrl());
+ }
+
+ {
+ const ConfiguratorImpl config(cmdline, nullptr, false);
+ const auto urls = config.UpdateUrl();
+ ASSERT_EQ(2u, urls.size());
+ ASSERT_STREQ(kUpdaterDefaultUrl, urls[0].spec().c_str());
+ ASSERT_STREQ(kUpdaterFallbackUrl, urls[1].spec().c_str());
+ ASSERT_EQ(config.UpdateUrl(), config.PingUrl());
+ }
+}
+
} // namespace component_updater

Powered by Google App Engine
This is Rietveld 408576698