| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/component_updater/origin_trials_component_installer.h" | 5 #include "chrome/browser/component_updater/origin_trials_component_installer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 57 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 58 | 58 |
| 59 traits_.reset(new OriginTrialsComponentInstallerTraits()); | 59 traits_.reset(new OriginTrialsComponentInstallerTraits()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void LoadUpdates(std::unique_ptr<base::DictionaryValue> manifest) { | 62 void LoadUpdates(std::unique_ptr<base::DictionaryValue> manifest) { |
| 63 if (!manifest) { | 63 if (!manifest) { |
| 64 manifest = base::MakeUnique<base::DictionaryValue>(); | 64 manifest = base::MakeUnique<base::DictionaryValue>(); |
| 65 manifest->SetString(kManifestOriginTrialsKey, ""); | 65 manifest->SetString(kManifestOriginTrialsKey, ""); |
| 66 } | 66 } |
| 67 ASSERT_TRUE(traits_->VerifyInstallation(*manifest, temp_dir_.path())); | 67 ASSERT_TRUE(traits_->VerifyInstallation(*manifest, temp_dir_.GetPath())); |
| 68 const base::Version expected_version(kTestUpdateVersion); | 68 const base::Version expected_version(kTestUpdateVersion); |
| 69 traits_->ComponentReady(expected_version, temp_dir_.path(), | 69 traits_->ComponentReady(expected_version, temp_dir_.GetPath(), |
| 70 std::move(manifest)); | 70 std::move(manifest)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void AddDisabledFeaturesToPrefs(const std::vector<std::string>& features) { | 73 void AddDisabledFeaturesToPrefs(const std::vector<std::string>& features) { |
| 74 base::ListValue disabled_feature_list; | 74 base::ListValue disabled_feature_list; |
| 75 disabled_feature_list.AppendStrings(features); | 75 disabled_feature_list.AppendStrings(features); |
| 76 ListPrefUpdate update(local_state(), prefs::kOriginTrialDisabledFeatures); | 76 ListPrefUpdate update(local_state(), prefs::kOriginTrialDisabledFeatures); |
| 77 update->Swap(&disabled_feature_list); | 77 update->Swap(&disabled_feature_list); |
| 78 } | 78 } |
| 79 | 79 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 disabled_feature_list->AppendStrings(kNewDisabledFeatures); | 187 disabled_feature_list->AppendStrings(kNewDisabledFeatures); |
| 188 manifest->Set(kManifestDisabledFeaturesPath, | 188 manifest->Set(kManifestDisabledFeaturesPath, |
| 189 std::move(disabled_feature_list)); | 189 std::move(disabled_feature_list)); |
| 190 | 190 |
| 191 LoadUpdates(std::move(manifest)); | 191 LoadUpdates(std::move(manifest)); |
| 192 | 192 |
| 193 CheckDisabledFeaturesPrefs(kNewDisabledFeatures); | 193 CheckDisabledFeaturesPrefs(kNewDisabledFeatures); |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace component_updater | 196 } // namespace component_updater |
| OLD | NEW |