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

Unified Diff: chrome/browser/component_updater/test/chrome_component_updater_configurator_unittest.cc

Issue 1013003003: Add tests for Component Updater command line arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sorin@ comments Created 5 years, 9 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 | « AUTHORS ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/component_updater/test/chrome_component_updater_configurator_unittest.cc
diff --git a/chrome/browser/component_updater/test/chrome_component_updater_configurator_unittest.cc b/chrome/browser/component_updater/test/chrome_component_updater_configurator_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..14bd64e36fb8adb70a082a14b55a856b6c3c2486
--- /dev/null
+++ b/chrome/browser/component_updater/test/chrome_component_updater_configurator_unittest.cc
@@ -0,0 +1,63 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/command_line.h"
+#include "chrome/browser/component_updater/chrome_component_updater_configurator.h"
+#include "components/component_updater/component_updater_switches.h"
+#include "components/update_client/configurator.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
+
+namespace component_updater {
+
+TEST(ChromeComponentUpdaterConfiguratorTest, TestDisablePings) {
+ base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
+ cmdline->AppendSwitchASCII(switches::kComponentUpdater, "disable-pings");
+
+ const update_client::Configurator* config =
+ MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
+
+ std::vector<GURL> pingUrls = config->PingUrl();
Sorin Jianu 2015/03/24 23:05:32 Small deal, we could use a const declaration for t
+ EXPECT_TRUE(pingUrls.empty());
+}
+
+TEST(ChromeComponentUpdaterConfiguratorTest, TestFastUpdate) {
+ base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
+ cmdline->AppendSwitchASCII(switches::kComponentUpdater, "fast-update");
+
+ const update_client::Configurator* config =
+ MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
+
+ ASSERT_EQ(1, config->InitialDelay());
+}
+
+TEST(ChromeComponentUpdaterConfiguratorTest, TestOverrideUrl) {
+ const char overrideUrl[] = "http://0.0.0.0/";
+
+ base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
+ std::string val = "url-source";
+ val.append("=");
+ val.append(overrideUrl);
+ cmdline->AppendSwitchASCII(switches::kComponentUpdater, val.c_str());
+
+ const update_client::Configurator* config =
+ MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
+
+ std::vector<GURL> urls = config->UpdateUrl();
+
+ ASSERT_EQ(1U, urls.size());
+ ASSERT_EQ(overrideUrl, urls.at(0).possibly_invalid_spec());
Sorin Jianu 2015/03/24 23:05:32 Can we test that the actual URL is the same as the
Sorin Jianu 2015/03/25 19:25:13 I apologize, I misread the code. Is there a reason
+}
+
+TEST(ChromeComponentUpdaterConfiguratorTest, TestSwitchRequestParam) {
+ base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
+ cmdline->AppendSwitchASCII(switches::kComponentUpdater, "test-request");
+
+ const update_client::Configurator* config =
+ MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
+
+ EXPECT_FALSE(config->ExtraRequestParams().empty());
+}
+
+} // namespace component_updater
« no previous file with comments | « AUTHORS ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698