OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sessions/restore_on_startup_policy_handler.h" | 5 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/prefs/session_startup_pref.h" | 16 #include "chrome/browser/prefs/session_startup_pref.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "components/policy/core/browser/configuration_policy_handler.h" | 18 #include "components/policy/core/browser/configuration_policy_handler.h" |
19 #include "components/policy/core/browser/policy_error_map.h" | 19 #include "components/policy/core/browser/policy_error_map.h" |
20 #include "components/policy/core/common/policy_map.h" | 20 #include "components/policy/core/common/policy_map.h" |
21 #include "components/policy/core/common/policy_types.h" | 21 #include "components/policy/core/common/policy_types.h" |
22 #include "components/policy/policy_constants.h" | 22 #include "components/policy/policy_constants.h" |
23 #include "components/prefs/pref_value_map.h" | 23 #include "components/prefs/pref_value_map.h" |
24 #include "grit/components_strings.h" | 24 #include "components/strings/grit/components_strings.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 | 27 |
28 namespace policy { | 28 namespace policy { |
29 | 29 |
30 class RestoreOnStartupPolicyHandlerTest : public testing::Test { | 30 class RestoreOnStartupPolicyHandlerTest : public testing::Test { |
31 protected: | 31 protected: |
32 void SetPolicyValue(const std::string& policy, | 32 void SetPolicyValue(const std::string& policy, |
33 std::unique_ptr<base::Value> value) { | 33 std::unique_ptr<base::Value> value) { |
34 policies_.Set(policy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 34 policies_.Set(policy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 TEST_F(RestoreOnStartupPolicyHandlerTest, ApplyPolicySettings_WrongType) { | 189 TEST_F(RestoreOnStartupPolicyHandlerTest, ApplyPolicySettings_WrongType) { |
190 // Handler expects an int; pass it a bool. | 190 // Handler expects an int; pass it a bool. |
191 SetPolicyValue(key::kRestoreOnStartup, | 191 SetPolicyValue(key::kRestoreOnStartup, |
192 base::MakeUnique<base::FundamentalValue>(false)); | 192 base::MakeUnique<base::FundamentalValue>(false)); |
193 // The resulting prefs should be empty. | 193 // The resulting prefs should be empty. |
194 EXPECT_TRUE(prefs().empty()); | 194 EXPECT_TRUE(prefs().empty()); |
195 } | 195 } |
196 | 196 |
197 } // namespace policy | 197 } // namespace policy |
OLD | NEW |