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

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
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
Sorin Jianu 2015/03/23 23:32:01 Extra empty line not needed/
15 TEST(ChromeComponentUpdaterConfiguratorTest, TestDisablePings) {
16 base::CommandLine * cmdline = base::CommandLine::ForCurrentProcess();
Sorin Jianu 2015/03/23 23:32:01 * goes next to the type. Are you using the "git c
17 cmdline->AppendSwitchASCII(switches::kComponentUpdater, kSwitchDisablePings);
Sorin Jianu 2015/03/23 23:32:01 There are two ways to write these data driven unit
18
19 update_client::Configurator* config =
Sorin Jianu 2015/03/23 23:32:01 Some of these variables can be declared const.
20 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
21
22 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 // Set command line flag
Sorin Jianu 2015/03/23 23:32:01 Comment not needed.
29 cmdline->AppendSwitchASCII(switches::kComponentUpdater, kSwitchFastUpdate);
30
31 update_client::Configurator* config =
32 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
33
34 EXPECT_EQ(config->InitialDelay(), 1);
35
36 }
37
38 TEST(ChromeComponentUpdaterConfiguratorTest, TestOverrideUrl) {
39 char overrideUrl[] = "http://0.0.0.0/";
40
41 base::CommandLine * cmdline = base::CommandLine::ForCurrentProcess();
42 std::string val = kSwitchUrlSource;
43 val.append("=");
44 val.append(overrideUrl);
45 cmdline->AppendSwitchASCII(switches::kComponentUpdater, val.c_str());
46
47 update_client::Configurator* config =
48 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
49
50 std::vector<GURL> urls = config->UpdateUrl();
51
52 // should only be one element
Sorin Jianu 2015/03/23 23:32:01 Comment not needed.
53 EXPECT_EQ(urls.size(), 1U);
Sorin Jianu 2015/03/23 23:32:01 The syntaxt for the EXPECT assertion is ASSERT_EQ(
54 EXPECT_EQ(urls.at(0).possibly_invalid_spec(), overrideUrl);
55 }
56
57 TEST(ChromeComponentUpdaterConfiguratorTest, TestSwitchRequestParam) {
58 base::CommandLine * cmdline = base::CommandLine::ForCurrentProcess();
59 cmdline->AppendSwitchASCII(switches::kComponentUpdater, kSwitchRequestParam);
60
61 update_client::Configurator* config =
62 MakeChromeComponentUpdaterConfigurator(cmdline, NULL);
63
64 EXPECT_FALSE(config->ExtraRequestParams().empty());
65 }
66
67 } // namespace component_updater
Sorin Jianu 2015/03/23 23:32:01 Needs a space before //.
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/chrome_component_updater_configurator.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698