| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 PolicyWatcherTest() : message_loop_(base::MessageLoop::TYPE_IO) {} | 64 PolicyWatcherTest() : message_loop_(base::MessageLoop::TYPE_IO) {} |
| 65 | 65 |
| 66 void SetUp() override { | 66 void SetUp() override { |
| 67 // We expect no callbacks unless explicitly specified by individual tests. | 67 // We expect no callbacks unless explicitly specified by individual tests. |
| 68 EXPECT_CALL(mock_policy_callback_, OnPolicyUpdatePtr(testing::_)).Times(0); | 68 EXPECT_CALL(mock_policy_callback_, OnPolicyUpdatePtr(testing::_)).Times(0); |
| 69 EXPECT_CALL(mock_policy_callback_, OnPolicyError()).Times(0); | 69 EXPECT_CALL(mock_policy_callback_, OnPolicyError()).Times(0); |
| 70 | 70 |
| 71 // Retaining a raw pointer to keep control over policy contents. | 71 // Retaining a raw pointer to keep control over policy contents. |
| 72 policy_loader_ = | 72 policy_loader_ = |
| 73 new policy::FakeAsyncPolicyLoader(base::ThreadTaskRunnerHandle::Get()); | 73 new policy::FakeAsyncPolicyLoader(base::ThreadTaskRunnerHandle::Get()); |
| 74 policy_watcher_ = | 74 policy_watcher_ = PolicyWatcher::CreateFromPolicyLoaderForTesting( |
| 75 PolicyWatcher::CreateFromPolicyLoader(base::WrapUnique(policy_loader_)); | 75 base::WrapUnique(policy_loader_)); |
| 76 | 76 |
| 77 nat_true_.SetBoolean(key::kRemoteAccessHostFirewallTraversal, true); | 77 nat_true_.SetBoolean(key::kRemoteAccessHostFirewallTraversal, true); |
| 78 nat_false_.SetBoolean(key::kRemoteAccessHostFirewallTraversal, false); | 78 nat_false_.SetBoolean(key::kRemoteAccessHostFirewallTraversal, false); |
| 79 nat_one_.SetInteger(key::kRemoteAccessHostFirewallTraversal, 1); | 79 nat_one_.SetInteger(key::kRemoteAccessHostFirewallTraversal, 1); |
| 80 nat_one_domain_full_.SetInteger(key::kRemoteAccessHostFirewallTraversal, 1); | 80 nat_one_domain_full_.SetInteger(key::kRemoteAccessHostFirewallTraversal, 1); |
| 81 nat_one_domain_full_.SetString(key::kRemoteAccessHostDomain, kHostDomain); | 81 nat_one_domain_full_.SetString(key::kRemoteAccessHostDomain, kHostDomain); |
| 82 domain_empty_.SetString(key::kRemoteAccessHostDomain, std::string()); | 82 domain_empty_.SetString(key::kRemoteAccessHostDomain, std::string()); |
| 83 domain_full_.SetString(key::kRemoteAccessHostDomain, kHostDomain); | 83 domain_full_.SetString(key::kRemoteAccessHostDomain, kHostDomain); |
| 84 SetDefaults(nat_true_others_default_); | 84 SetDefaults(nat_true_others_default_); |
| 85 nat_true_others_default_.SetBoolean(key::kRemoteAccessHostFirewallTraversal, | 85 nat_true_others_default_.SetBoolean(key::kRemoteAccessHostFirewallTraversal, |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 678 |
| 679 // And check one, random "boolean" policy to see if the type propagated | 679 // And check one, random "boolean" policy to see if the type propagated |
| 680 // correctly from policy_templates.json file. | 680 // correctly from policy_templates.json file. |
| 681 const policy::Schema boolean_schema = | 681 const policy::Schema boolean_schema = |
| 682 schema->GetKnownProperty("RemoteAccessHostRequireCurtain"); | 682 schema->GetKnownProperty("RemoteAccessHostRequireCurtain"); |
| 683 EXPECT_TRUE(boolean_schema.valid()); | 683 EXPECT_TRUE(boolean_schema.valid()); |
| 684 EXPECT_EQ(boolean_schema.type(), base::Value::Type::BOOLEAN); | 684 EXPECT_EQ(boolean_schema.type(), base::Value::Type::BOOLEAN); |
| 685 } | 685 } |
| 686 | 686 |
| 687 } // namespace remoting | 687 } // namespace remoting |
| OLD | NEW |