| 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 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 TEST_F(RestoreOnStartupPolicyHandlerTest, CheckPolicySettings_FailsTypeCheck) { | 53 TEST_F(RestoreOnStartupPolicyHandlerTest, CheckPolicySettings_FailsTypeCheck) { |
| 54 // Handler expects an int; pass it a bool. | 54 // Handler expects an int; pass it a bool. |
| 55 SetPolicyValue(key::kRestoreOnStartup, | 55 SetPolicyValue(key::kRestoreOnStartup, |
| 56 base::MakeUnique<base::FundamentalValue>(false)); | 56 base::MakeUnique<base::FundamentalValue>(false)); |
| 57 // Checking should fail and add an error to the error map. | 57 // Checking should fail and add an error to the error map. |
| 58 EXPECT_FALSE(CheckPolicySettings()); | 58 EXPECT_FALSE(CheckPolicySettings()); |
| 59 ASSERT_EQ(1U, errors().size()); | 59 ASSERT_EQ(1U, errors().size()); |
| 60 EXPECT_EQ( | 60 EXPECT_EQ( |
| 61 l10n_util::GetStringFUTF16(IDS_POLICY_TYPE_ERROR, | 61 l10n_util::GetStringFUTF16(IDS_POLICY_TYPE_ERROR, |
| 62 base::ASCIIToUTF16(base::Value::GetTypeName( | 62 base::ASCIIToUTF16(base::Value::GetTypeName( |
| 63 base::Value::TYPE_INTEGER))), | 63 base::Value::Type::INTEGER))), |
| 64 errors().begin()->second); | 64 errors().begin()->second); |
| 65 } | 65 } |
| 66 | 66 |
| 67 TEST_F(RestoreOnStartupPolicyHandlerTest, CheckPolicySettings_Unspecified) { | 67 TEST_F(RestoreOnStartupPolicyHandlerTest, CheckPolicySettings_Unspecified) { |
| 68 // Don't specify a value for the policy. | 68 // Don't specify a value for the policy. |
| 69 // Checking should succeed with no errors. | 69 // Checking should succeed with no errors. |
| 70 EXPECT_TRUE(CheckPolicySettings()); | 70 EXPECT_TRUE(CheckPolicySettings()); |
| 71 EXPECT_TRUE(errors().empty()); | 71 EXPECT_TRUE(errors().empty()); |
| 72 } | 72 } |
| 73 | 73 |
| (...skipping 114 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 |