OLD | NEW |
---|---|
(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 = | |
Sorin Jianu
2015/03/25 20:32:21
I missed the memory leak here and below.
I am wor
| |
19 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 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 const std::vector<GURL> urls = config->UpdateUrl(); | |
48 | |
49 ASSERT_EQ(1U, urls.size()); | |
50 ASSERT_EQ(overrideUrl, urls.at(0).possibly_invalid_spec()); | |
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 | |
OLD | NEW |