| 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" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 TEST_F(ChromeComponentUpdaterConfiguratorTest, TestEnabledComponentUpdates) { | 153 TEST_F(ChromeComponentUpdaterConfiguratorTest, TestEnabledComponentUpdates) { |
| 154 base::CommandLine cmdline(*base::CommandLine::ForCurrentProcess()); | 154 base::CommandLine cmdline(*base::CommandLine::ForCurrentProcess()); |
| 155 const auto config(MakeChromeComponentUpdaterConfigurator(&cmdline, nullptr, | 155 const auto config(MakeChromeComponentUpdaterConfigurator(&cmdline, nullptr, |
| 156 pref_service())); | 156 pref_service())); |
| 157 // Tests the default is set to |true| and the component updates are enabled. | 157 // Tests the default is set to |true| and the component updates are enabled. |
| 158 EXPECT_TRUE(config->EnabledComponentUpdates()); | 158 EXPECT_TRUE(config->EnabledComponentUpdates()); |
| 159 | 159 |
| 160 // Tests the component updates are disabled. | 160 // Tests the component updates are disabled. |
| 161 pref_service()->SetManagedPref("component_updates.component_updates_enabled", | 161 pref_service()->SetManagedPref("component_updates.component_updates_enabled", |
| 162 new base::Value(false)); | 162 base::MakeUnique<base::Value>(false)); |
| 163 EXPECT_FALSE(config->EnabledComponentUpdates()); | 163 EXPECT_FALSE(config->EnabledComponentUpdates()); |
| 164 | 164 |
| 165 // Tests the component updates are enabled. | 165 // Tests the component updates are enabled. |
| 166 pref_service()->SetManagedPref("component_updates.component_updates_enabled", | 166 pref_service()->SetManagedPref("component_updates.component_updates_enabled", |
| 167 new base::Value(true)); | 167 base::MakeUnique<base::Value>(true)); |
| 168 EXPECT_TRUE(config->EnabledComponentUpdates()); | 168 EXPECT_TRUE(config->EnabledComponentUpdates()); |
| 169 | 169 |
| 170 // 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. |
| 171 pref_service()->SetManagedPref("component_updates.component_updates_enabled", | 171 pref_service()->SetManagedPref("component_updates.component_updates_enabled", |
| 172 new base::Value(false)); | 172 base::MakeUnique<base::Value>(false)); |
| 173 EXPECT_FALSE(config->EnabledComponentUpdates()); | 173 EXPECT_FALSE(config->EnabledComponentUpdates()); |
| 174 pref_service()->RemoveManagedPref( | 174 pref_service()->RemoveManagedPref( |
| 175 "component_updates.component_updates_enabled"); | 175 "component_updates.component_updates_enabled"); |
| 176 EXPECT_TRUE(config->EnabledComponentUpdates()); | 176 EXPECT_TRUE(config->EnabledComponentUpdates()); |
| 177 } | 177 } |
| 178 | 178 |
| 179 TEST_F(ChromeComponentUpdaterConfiguratorTest, TestProdId) { | 179 TEST_F(ChromeComponentUpdaterConfiguratorTest, TestProdId) { |
| 180 base::CommandLine cmdline(*base::CommandLine::ForCurrentProcess()); | 180 base::CommandLine cmdline(*base::CommandLine::ForCurrentProcess()); |
| 181 const auto config(MakeChromeComponentUpdaterConfigurator(&cmdline, nullptr, | 181 const auto config(MakeChromeComponentUpdaterConfigurator(&cmdline, nullptr, |
| 182 pref_service())); | 182 pref_service())); |
| 183 EXPECT_STREQ(update_client::UpdateQueryParams::GetProdIdString( | 183 EXPECT_STREQ(update_client::UpdateQueryParams::GetProdIdString( |
| 184 update_client::UpdateQueryParams::ProdId::CHROME), | 184 update_client::UpdateQueryParams::ProdId::CHROME), |
| 185 config->GetProdId().c_str()); | 185 config->GetProdId().c_str()); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace component_updater | 188 } // namespace component_updater |
| OLD | NEW |