| 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 "remoting/host/policy_watcher.h" | 5 #include "remoting/host/policy_watcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 | 434 |
| 435 class MisspelledPolicyTest : public PolicyWatcherTest, | 435 class MisspelledPolicyTest : public PolicyWatcherTest, |
| 436 public ::testing::WithParamInterface<const char*> { | 436 public ::testing::WithParamInterface<const char*> { |
| 437 }; | 437 }; |
| 438 | 438 |
| 439 // Verify that a misspelled policy causes a warning written to the log. | 439 // Verify that a misspelled policy causes a warning written to the log. |
| 440 TEST_P(MisspelledPolicyTest, WarningLogged) { | 440 TEST_P(MisspelledPolicyTest, WarningLogged) { |
| 441 const char* misspelled_policy_name = GetParam(); | 441 const char* misspelled_policy_name = GetParam(); |
| 442 base::test::MockLog mock_log; | 442 base::test::MockLog mock_log; |
| 443 | 443 |
| 444 ON_CALL(mock_log, Log(testing::_, testing::_, testing::_, testing::_, | |
| 445 testing::_)).WillByDefault(testing::Return(true)); | |
| 446 | |
| 447 EXPECT_CALL(mock_log, | 444 EXPECT_CALL(mock_log, |
| 448 Log(logging::LOG_WARNING, testing::_, testing::_, testing::_, | 445 Log(logging::LOG_WARNING, testing::_, testing::_, testing::_, |
| 449 testing::HasSubstr(misspelled_policy_name))).Times(1); | 446 testing::HasSubstr(misspelled_policy_name))).Times(1); |
| 450 | 447 |
| 451 EXPECT_CALL(mock_policy_callback_, | 448 EXPECT_CALL(mock_policy_callback_, |
| 452 OnPolicyUpdatePtr(IsPolicies(&nat_true_others_default_))); | 449 OnPolicyUpdatePtr(IsPolicies(&nat_true_others_default_))); |
| 453 | 450 |
| 454 base::DictionaryValue misspelled_policies; | 451 base::DictionaryValue misspelled_policies; |
| 455 misspelled_policies.SetString(misspelled_policy_name, "some test value"); | 452 misspelled_policies.SetString(misspelled_policy_name, "some test value"); |
| 456 mock_log.StartCapturingLogs(); | 453 mock_log.StartCapturingLogs(); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 675 |
| 679 // And check one, random "boolean" policy to see if the type propagated | 676 // And check one, random "boolean" policy to see if the type propagated |
| 680 // correctly from policy_templates.json file. | 677 // correctly from policy_templates.json file. |
| 681 const policy::Schema boolean_schema = | 678 const policy::Schema boolean_schema = |
| 682 schema->GetKnownProperty("RemoteAccessHostRequireCurtain"); | 679 schema->GetKnownProperty("RemoteAccessHostRequireCurtain"); |
| 683 EXPECT_TRUE(boolean_schema.valid()); | 680 EXPECT_TRUE(boolean_schema.valid()); |
| 684 EXPECT_EQ(boolean_schema.type(), base::Value::Type::BOOLEAN); | 681 EXPECT_EQ(boolean_schema.type(), base::Value::Type::BOOLEAN); |
| 685 } | 682 } |
| 686 | 683 |
| 687 } // namespace remoting | 684 } // namespace remoting |
| OLD | NEW |