Give names to all utility processes.
[chromium-blink-merge.git] / chrome / browser / component_updater / test / chrome_component_updater_configurator_unittest.cc
blob9e97aaa5a33a35b88271cc58ce2a972cf5bd85ec
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/command_line.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "chrome/browser/component_updater/chrome_component_updater_configurator.h"
8 #include "components/component_updater/component_updater_switches.h"
9 #include "components/update_client/configurator.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "url/gurl.h"
13 namespace component_updater {
15 TEST(ChromeComponentUpdaterConfiguratorTest, TestDisablePings) {
16 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
17 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "disable-pings");
19 scoped_ptr<update_client::Configurator> config(
20 MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
22 const std::vector<GURL> pingUrls = config->PingUrl();
23 EXPECT_TRUE(pingUrls.empty());
26 TEST(ChromeComponentUpdaterConfiguratorTest, TestFastUpdate) {
27 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
28 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "fast-update");
30 scoped_ptr<update_client::Configurator> config(
31 MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
33 ASSERT_EQ(1, config->InitialDelay());
36 TEST(ChromeComponentUpdaterConfiguratorTest, TestOverrideUrl) {
37 const char overrideUrl[] = "http://0.0.0.0/";
39 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
40 std::string val = "url-source";
41 val.append("=");
42 val.append(overrideUrl);
43 cmdline->AppendSwitchASCII(switches::kComponentUpdater, val.c_str());
45 scoped_ptr<update_client::Configurator> config(
46 MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
48 const std::vector<GURL> urls = config->UpdateUrl();
50 ASSERT_EQ(1U, urls.size());
51 ASSERT_EQ(overrideUrl, urls.at(0).possibly_invalid_spec());
54 TEST(ChromeComponentUpdaterConfiguratorTest, TestSwitchRequestParam) {
55 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
56 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "test-request");
58 scoped_ptr<update_client::Configurator> config(
59 MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
61 EXPECT_FALSE(config->ExtraRequestParams().empty());
64 } // namespace component_updater