OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" | 12 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" |
13 #include "components/component_updater/component_updater_switches.h" | 13 #include "components/component_updater/component_updater_switches.h" |
14 #include "components/component_updater/component_updater_url_constants.h" | 14 #include "components/component_updater/component_updater_url_constants.h" |
15 #include "components/component_updater/configurator_impl.h" | 15 #include "components/component_updater/configurator_impl.h" |
16 #include "components/prefs/testing_pref_service.h" | 16 #include "components/prefs/testing_pref_service.h" |
17 #include "components/update_client/configurator.h" | 17 #include "components/update_client/configurator.h" |
| 18 #include "components/update_client/update_query_params.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
20 | 21 |
21 std::unique_ptr<TestingPrefServiceSimple> pref(new TestingPrefServiceSimple()); | 22 std::unique_ptr<TestingPrefServiceSimple> pref(new TestingPrefServiceSimple()); |
22 | 23 |
23 namespace component_updater { | 24 namespace component_updater { |
24 | 25 |
25 class ChromeComponentUpdaterConfiguratorTest : public testing::Test { | 26 class ChromeComponentUpdaterConfiguratorTest : public testing::Test { |
26 public: | 27 public: |
27 ChromeComponentUpdaterConfiguratorTest() {} | 28 ChromeComponentUpdaterConfiguratorTest() {} |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 169 |
169 // Sanity check setting the preference back to |false| and then removing it. | 170 // Sanity check setting the preference back to |false| and then removing it. |
170 pref_service()->SetManagedPref("component_updates.component_updates_enabled", | 171 pref_service()->SetManagedPref("component_updates.component_updates_enabled", |
171 new base::FundamentalValue(false)); | 172 new base::FundamentalValue(false)); |
172 EXPECT_FALSE(config->EnabledComponentUpdates()); | 173 EXPECT_FALSE(config->EnabledComponentUpdates()); |
173 pref_service()->RemoveManagedPref( | 174 pref_service()->RemoveManagedPref( |
174 "component_updates.component_updates_enabled"); | 175 "component_updates.component_updates_enabled"); |
175 EXPECT_TRUE(config->EnabledComponentUpdates()); | 176 EXPECT_TRUE(config->EnabledComponentUpdates()); |
176 } | 177 } |
177 | 178 |
| 179 TEST_F(ChromeComponentUpdaterConfiguratorTest, TestProdId) { |
| 180 base::CommandLine cmdline(*base::CommandLine::ForCurrentProcess()); |
| 181 const auto config(MakeChromeComponentUpdaterConfigurator(&cmdline, nullptr, |
| 182 pref_service())); |
| 183 EXPECT_STREQ(update_client::UpdateQueryParams::GetProdIdString( |
| 184 update_client::UpdateQueryParams::ProdId::CHROME), |
| 185 config->GetProdId().c_str()); |
| 186 } |
| 187 |
178 } // namespace component_updater | 188 } // namespace component_updater |
OLD | NEW |