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

Side by Side Diff: chrome/browser/component_updater/test/chrome_component_updater_configurator_unittest.cc

Issue 1102103002: Move the unit tests files side-by-side with the corresponding .cc files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 8 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 "base/memory/ref_counted.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 const auto config(MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
20
21 const std::vector<GURL> pingUrls = config->PingUrl();
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 auto config(MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
30
31 ASSERT_EQ(1, config->InitialDelay());
32 }
33
34 TEST(ChromeComponentUpdaterConfiguratorTest, TestOverrideUrl) {
35 const char overrideUrl[] = "http://0.0.0.0/";
36
37 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
38 std::string val = "url-source";
39 val.append("=");
40 val.append(overrideUrl);
41 cmdline->AppendSwitchASCII(switches::kComponentUpdater, val.c_str());
42
43 const auto config(MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
44
45 const std::vector<GURL> urls = config->UpdateUrl();
46
47 ASSERT_EQ(1U, urls.size());
48 ASSERT_EQ(overrideUrl, urls.at(0).possibly_invalid_spec());
49 }
50
51 TEST(ChromeComponentUpdaterConfiguratorTest, TestSwitchRequestParam) {
52 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
53 cmdline->AppendSwitchASCII(switches::kComponentUpdater, "test-request");
54
55 const auto config(MakeChromeComponentUpdaterConfigurator(cmdline, NULL));
56
57 EXPECT_FALSE(config->ExtraRequestParams().empty());
58 }
59
60 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698