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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
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"
12
13 namespace component_updater {
14
15 TEST(ChromeComponentUpdaterConfiguratorTest, TestDisablePings) {
16 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
17 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "disable-pings");
18
19 scoped_ptr<update_client::Configurator> config(
20 MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
21
22 const std::vector<GURL> pingUrls = config->PingUrl();
23 EXPECT_TRUE(pingUrls.empty());
24 }
25
26 TEST(ChromeComponentUpdaterConfiguratorTest, TestFastUpdate) {
27 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
28 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "fast-update");
29
30 scoped_ptr<update_client::Configurator> config(
31 MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
32
33 ASSERT_EQ(1, config->InitialDelay());
34 }
35
36 TEST(ChromeComponentUpdaterConfiguratorTest, TestOverrideUrl) {
37 const char overrideUrl[] = "http://0.0.0.0/";
38
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());
44
45 scoped_ptr<update_client::Configurator> config(
46 MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
47
48 const std::vector<GURL> urls = config->UpdateUrl();
49
50 ASSERT_EQ(1U, urls.size());
51 ASSERT_EQ(overrideUrl, urls.at(0).possibly_invalid_spec());
52 }
53
54 TEST(ChromeComponentUpdaterConfiguratorTest, TestSwitchRequestParam) {
55 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
56 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "test-request");
57
58 scoped_ptr<update_client::Configurator> config(
59 MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
60
61 EXPECT_FALSE(config->ExtraRequestParams().empty());
62 }
63
64 } // namespace component_updater
OLDNEW
« 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