| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/search_engines/default_search_policy_handler.h" | 5 #include "components/search_engines/default_search_policy_handler.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 10 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 UpdateProviderPolicy(policy); | 172 UpdateProviderPolicy(policy); |
| 173 const base::Value* temp = nullptr; | 173 const base::Value* temp = nullptr; |
| 174 EXPECT_TRUE(store_->GetValue( | 174 EXPECT_TRUE(store_->GetValue( |
| 175 DefaultSearchManager::kDefaultSearchProviderDataPrefName, &temp)); | 175 DefaultSearchManager::kDefaultSearchProviderDataPrefName, &temp)); |
| 176 | 176 |
| 177 auto old_value = base::WrapUnique(policy.GetValue(policy_name)->DeepCopy()); | 177 auto old_value = base::WrapUnique(policy.GetValue(policy_name)->DeepCopy()); |
| 178 // BinaryValue is not supported in any current default search policy params. | 178 // BinaryValue is not supported in any current default search policy params. |
| 179 // Try changing policy param to BinaryValue and check that policy becomes | 179 // Try changing policy param to BinaryValue and check that policy becomes |
| 180 // invalid. | 180 // invalid. |
| 181 policy.Set(policy_name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 181 policy.Set(policy_name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 182 POLICY_SOURCE_CLOUD, base::WrapUnique(new base::BinaryValue()), | 182 POLICY_SOURCE_CLOUD, |
| 183 base::MakeUnique<base::Value>(base::Value::Type::BINARY), |
| 183 nullptr); | 184 nullptr); |
| 184 UpdateProviderPolicy(policy); | 185 UpdateProviderPolicy(policy); |
| 185 | 186 |
| 186 EXPECT_FALSE(store_->GetValue( | 187 EXPECT_FALSE(store_->GetValue( |
| 187 DefaultSearchManager::kDefaultSearchProviderDataPrefName, &temp)) | 188 DefaultSearchManager::kDefaultSearchProviderDataPrefName, &temp)) |
| 188 << "Policy type check failed " << policy_name; | 189 << "Policy type check failed " << policy_name; |
| 189 // Return old value to policy map. | 190 // Return old value to policy map. |
| 190 policy.Set(policy_name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 191 policy.Set(policy_name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 191 POLICY_SOURCE_CLOUD, std::move(old_value), nullptr); | 192 POLICY_SOURCE_CLOUD, std::move(old_value), nullptr); |
| 192 } | 193 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 357 |
| 357 EXPECT_TRUE(dictionary->GetString(DefaultSearchManager::kURL, &value)); | 358 EXPECT_TRUE(dictionary->GetString(DefaultSearchManager::kURL, &value)); |
| 358 EXPECT_EQ(kFileSearchURL, value); | 359 EXPECT_EQ(kFileSearchURL, value); |
| 359 EXPECT_TRUE(dictionary->GetString(DefaultSearchManager::kShortName, &value)); | 360 EXPECT_TRUE(dictionary->GetString(DefaultSearchManager::kShortName, &value)); |
| 360 EXPECT_EQ("_", value); | 361 EXPECT_EQ("_", value); |
| 361 EXPECT_TRUE(dictionary->GetString(DefaultSearchManager::kKeyword, &value)); | 362 EXPECT_TRUE(dictionary->GetString(DefaultSearchManager::kKeyword, &value)); |
| 362 EXPECT_EQ("_", value); | 363 EXPECT_EQ("_", value); |
| 363 } | 364 } |
| 364 | 365 |
| 365 } // namespace policy | 366 } // namespace policy |
| OLD | NEW |