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

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: Fix memory leak 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 const std::vector<GURL> pingUrls = config->PingUrl();
22 EXPECT_TRUE(pingUrls.empty());
23 delete config;
Sorin Jianu 2015/03/25 21:50:09 we can use a scoped_ptr for this: #include "base/
24 }
25
26 TEST(ChromeComponentUpdaterConfiguratorTest, TestFastUpdate) {
27 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
28 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "fast-update");
29
30 const update_client::Configurator* config =
31 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
32
33 ASSERT_EQ(1, config->InitialDelay());
34 delete config;
35 }
36
37 TEST(ChromeComponentUpdaterConfiguratorTest, TestOverrideUrl) {
38 const char overrideUrl[] = "http://0.0.0.0/";
39
40 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
41 std::string val = "url-source";
42 val.append("=");
43 val.append(overrideUrl);
44 cmdline->AppendSwitchASCII(switches::kComponentUpdater, val.c_str());
45
46 const update_client::Configurator* config =
47 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
48
49 const std::vector<GURL> urls = config->UpdateUrl();
50
51 ASSERT_EQ(1U, urls.size());
52 ASSERT_EQ(overrideUrl, urls.at(0).possibly_invalid_spec());
53 delete config;
54 }
55
56 TEST(ChromeComponentUpdaterConfiguratorTest, TestSwitchRequestParam) {
57 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
58 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "test-request");
59
60 const update_client::Configurator* config =
61 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
62
63 EXPECT_FALSE(config->ExtraRequestParams().empty());
64 delete config;
65 }
66
67 } // 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