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

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: 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 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 "chrome/browser/component_updater/chrome_component_updater_configurator .h"
7 #include "components/component_updater/component_updater_switches.h"
8 #include "components/update_client/configurator.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "url/gurl.h"
11
12 namespace component_updater {
13
14 TEST(ChromeComponentUpdaterConfiguratorTest, TestDisablePings) {
15 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
16 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "disable-pings");
17
18 const update_client::Configurator* config =
19 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
20
21 std::vector<GURL> pingUrls = config->PingUrl();
Sorin Jianu 2015/03/24 23:05:32 Small deal, we could use a const declaration for t
22 EXPECT_TRUE(pingUrls.empty());
23 }
24
25 TEST(ChromeComponentUpdaterConfiguratorTest, TestFastUpdate) {
26 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
27 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "fast-update");
28
29 const update_client::Configurator* config =
30 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
31
32 ASSERT_EQ(1, config->InitialDelay());
33 }
34
35 TEST(ChromeComponentUpdaterConfiguratorTest, TestOverrideUrl) {
36 const char overrideUrl[] = "http://0.0.0.0/";
37
38 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
39 std::string val = "url-source";
40 val.append("=");
41 val.append(overrideUrl);
42 cmdline->AppendSwitchASCII(switches::kComponentUpdater, val.c_str());
43
44 const update_client::Configurator* config =
45 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
46
47 std::vector<GURL> urls = config->UpdateUrl();
48
49 ASSERT_EQ(1U, urls.size());
50 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
51 }
52
53 TEST(ChromeComponentUpdaterConfiguratorTest, TestSwitchRequestParam) {
54 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
55 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "test-request");
56
57 const update_client::Configurator* config =
58 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
59
60 EXPECT_FALSE(config->ExtraRequestParams().empty());
61 }
62
63 } // 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