Index: remoting/host/policy_hack/policy_watcher_unittest.cc |
diff --git a/remoting/host/policy_hack/policy_watcher_unittest.cc b/remoting/host/policy_hack/policy_watcher_unittest.cc |
index cb9415485e8bc961f1d9678cfa0f2d9cbaa65a09..0d6c88296955106012a8ff7345bebb928d6336d7 100644 |
--- a/remoting/host/policy_hack/policy_watcher_unittest.cc |
+++ b/remoting/host/policy_hack/policy_watcher_unittest.cc |
@@ -7,6 +7,7 @@ |
#include "base/message_loop/message_loop.h" |
#include "base/run_loop.h" |
#include "base/synchronization/waitable_event.h" |
+#include "policy/policy_constants.h" |
#include "remoting/host/dns_blackhole_checker.h" |
#include "remoting/host/policy_hack/fake_policy_watcher.h" |
#include "remoting/host/policy_hack/mock_policy_callback.h" |
@@ -31,67 +32,79 @@ class PolicyWatcherTest : public testing::Test { |
&MockPolicyCallback::OnPolicyError, |
base::Unretained(&mock_policy_callback_)); |
policy_watcher_.reset(new FakePolicyWatcher(message_loop_proxy_)); |
- nat_true_.SetBoolean(PolicyWatcher::kNatPolicyName, true); |
- nat_false_.SetBoolean(PolicyWatcher::kNatPolicyName, false); |
- nat_one_.SetInteger(PolicyWatcher::kNatPolicyName, 1); |
- domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, |
+ nat_true_.SetBoolean(policy::key::kRemoteAccessHostFirewallTraversal, true); |
+ nat_false_.SetBoolean(policy::key::kRemoteAccessHostFirewallTraversal, |
+ false); |
+ nat_one_.SetInteger(policy::key::kRemoteAccessHostFirewallTraversal, 1); |
+ domain_empty_.SetString(policy::key::kRemoteAccessHostDomain, |
std::string()); |
- domain_full_.SetString(PolicyWatcher::kHostDomainPolicyName, kHostDomain); |
+ domain_full_.SetString(policy::key::kRemoteAccessHostDomain, kHostDomain); |
SetDefaults(nat_true_others_default_); |
- nat_true_others_default_.SetBoolean(PolicyWatcher::kNatPolicyName, true); |
+ nat_true_others_default_.SetBoolean( |
+ policy::key::kRemoteAccessHostFirewallTraversal, true); |
SetDefaults(nat_false_others_default_); |
- nat_false_others_default_.SetBoolean(PolicyWatcher::kNatPolicyName, false); |
+ nat_false_others_default_.SetBoolean( |
+ policy::key::kRemoteAccessHostFirewallTraversal, false); |
SetDefaults(domain_empty_others_default_); |
- domain_empty_others_default_.SetString(PolicyWatcher::kHostDomainPolicyName, |
+ domain_empty_others_default_.SetString(policy::key::kRemoteAccessHostDomain, |
std::string()); |
SetDefaults(domain_full_others_default_); |
- domain_full_others_default_.SetString(PolicyWatcher::kHostDomainPolicyName, |
+ domain_full_others_default_.SetString(policy::key::kRemoteAccessHostDomain, |
kHostDomain); |
- nat_true_domain_empty_.SetBoolean(PolicyWatcher::kNatPolicyName, true); |
- nat_true_domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, |
+ nat_true_domain_empty_.SetBoolean( |
+ policy::key::kRemoteAccessHostFirewallTraversal, true); |
+ nat_true_domain_empty_.SetString(policy::key::kRemoteAccessHostDomain, |
std::string()); |
- nat_true_domain_full_.SetBoolean(PolicyWatcher::kNatPolicyName, true); |
- nat_true_domain_full_.SetString(PolicyWatcher::kHostDomainPolicyName, |
- kHostDomain); |
- nat_false_domain_empty_.SetBoolean(PolicyWatcher::kNatPolicyName, false); |
- nat_false_domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, |
- std::string()); |
- nat_false_domain_full_.SetBoolean(PolicyWatcher::kNatPolicyName, false); |
- nat_false_domain_full_.SetString(PolicyWatcher::kHostDomainPolicyName, |
+ nat_true_domain_full_.SetBoolean( |
+ policy::key::kRemoteAccessHostFirewallTraversal, true); |
+ nat_true_domain_full_.SetString(policy::key::kRemoteAccessHostDomain, |
kHostDomain); |
+ nat_false_domain_empty_.SetBoolean( |
+ policy::key::kRemoteAccessHostFirewallTraversal, false); |
+ nat_false_domain_empty_.SetString(policy::key::kRemoteAccessHostDomain, |
+ std::string()); |
+ nat_false_domain_full_.SetBoolean( |
+ policy::key::kRemoteAccessHostFirewallTraversal, false); |
+ nat_false_domain_full_.SetString(policy::key::kRemoteAccessHostDomain, |
+ kHostDomain); |
SetDefaults(nat_true_domain_empty_others_default_); |
nat_true_domain_empty_others_default_.SetBoolean( |
- PolicyWatcher::kNatPolicyName, true); |
+ policy::key::kRemoteAccessHostFirewallTraversal, true); |
nat_true_domain_empty_others_default_.SetString( |
- PolicyWatcher::kHostDomainPolicyName, std::string()); |
+ policy::key::kRemoteAccessHostDomain, std::string()); |
unknown_policies_.SetString("UnknownPolicyOne", std::string()); |
unknown_policies_.SetString("UnknownPolicyTwo", std::string()); |
const char kOverrideNatTraversalToFalse[] = |
"{ \"RemoteAccessHostFirewallTraversal\": false }"; |
- nat_true_and_overridden_.SetBoolean(PolicyWatcher::kNatPolicyName, true); |
+ nat_true_and_overridden_.SetBoolean( |
+ policy::key::kRemoteAccessHostFirewallTraversal, true); |
nat_true_and_overridden_.SetString( |
- PolicyWatcher::kHostDebugOverridePoliciesName, |
+ policy::key::kRemoteAccessHostDebugOverridePolicies, |
kOverrideNatTraversalToFalse); |
- pairing_true_.SetBoolean(PolicyWatcher::kHostAllowClientPairing, true); |
- pairing_false_.SetBoolean(PolicyWatcher::kHostAllowClientPairing, false); |
- gnubby_auth_true_.SetBoolean(PolicyWatcher::kHostAllowGnubbyAuthPolicyName, |
+ pairing_true_.SetBoolean(policy::key::kRemoteAccessHostAllowClientPairing, |
+ true); |
+ pairing_false_.SetBoolean(policy::key::kRemoteAccessHostAllowClientPairing, |
+ false); |
+ gnubby_auth_true_.SetBoolean(policy::key::kRemoteAccessHostAllowGnubbyAuth, |
true); |
- gnubby_auth_false_.SetBoolean(PolicyWatcher::kHostAllowGnubbyAuthPolicyName, |
- false); |
- relay_true_.SetBoolean(PolicyWatcher::kRelayPolicyName, true); |
- relay_false_.SetBoolean(PolicyWatcher::kRelayPolicyName, false); |
- port_range_full_.SetString(PolicyWatcher::kUdpPortRangePolicyName, |
+ gnubby_auth_false_.SetBoolean(policy::key::kRemoteAccessHostAllowGnubbyAuth, |
+ false); |
+ relay_true_.SetBoolean(policy::key::kRemoteAccessHostAllowRelayedConnection, |
+ true); |
+ relay_false_.SetBoolean( |
+ policy::key::kRemoteAccessHostAllowRelayedConnection, false); |
+ port_range_full_.SetString(policy::key::kRemoteAccessHostUdpPortRange, |
kPortRange); |
- port_range_empty_.SetString(PolicyWatcher::kUdpPortRangePolicyName, |
+ port_range_empty_.SetString(policy::key::kRemoteAccessHostUdpPortRange, |
std::string()); |
#if !defined(NDEBUG) |
SetDefaults(nat_false_overridden_others_default_); |
nat_false_overridden_others_default_.SetBoolean( |
- PolicyWatcher::kNatPolicyName, false); |
+ policy::key::kRemoteAccessHostFirewallTraversal, false); |
nat_false_overridden_others_default_.SetString( |
- PolicyWatcher::kHostDebugOverridePoliciesName, |
+ policy::key::kRemoteAccessHostDebugOverridePolicies, |
kOverrideNatTraversalToFalse); |
#endif |
} |
@@ -150,24 +163,25 @@ class PolicyWatcherTest : public testing::Test { |
private: |
void SetDefaults(base::DictionaryValue& dict) { |
- dict.SetBoolean(PolicyWatcher::kNatPolicyName, true); |
- dict.SetBoolean(PolicyWatcher::kRelayPolicyName, true); |
- dict.SetString(PolicyWatcher::kUdpPortRangePolicyName, ""); |
- dict.SetBoolean(PolicyWatcher::kHostRequireTwoFactorPolicyName, false); |
- dict.SetString(PolicyWatcher::kHostDomainPolicyName, std::string()); |
- dict.SetBoolean(PolicyWatcher::kHostMatchUsernamePolicyName, false); |
- dict.SetString(PolicyWatcher::kHostTalkGadgetPrefixPolicyName, |
+ dict.SetBoolean(policy::key::kRemoteAccessHostFirewallTraversal, true); |
+ dict.SetBoolean(policy::key::kRemoteAccessHostAllowRelayedConnection, true); |
+ dict.SetString(policy::key::kRemoteAccessHostUdpPortRange, ""); |
+ dict.SetBoolean(policy::key::kRemoteAccessHostRequireTwoFactor, false); |
+ dict.SetString(policy::key::kRemoteAccessHostDomain, std::string()); |
+ dict.SetBoolean(policy::key::kRemoteAccessHostMatchUsername, false); |
+ dict.SetString(policy::key::kRemoteAccessHostTalkGadgetPrefix, |
kDefaultHostTalkGadgetPrefix); |
- dict.SetBoolean(PolicyWatcher::kHostRequireCurtainPolicyName, false); |
- dict.SetString(PolicyWatcher::kHostTokenUrlPolicyName, std::string()); |
- dict.SetString(PolicyWatcher::kHostTokenValidationUrlPolicyName, |
- std::string()); |
- dict.SetString(PolicyWatcher::kHostTokenValidationCertIssuerPolicyName, |
+ dict.SetBoolean(policy::key::kRemoteAccessHostRequireCurtain, false); |
+ dict.SetString(policy::key::kRemoteAccessHostTokenUrl, std::string()); |
+ dict.SetString(policy::key::kRemoteAccessHostTokenValidationUrl, |
std::string()); |
- dict.SetBoolean(PolicyWatcher::kHostAllowClientPairing, true); |
- dict.SetBoolean(PolicyWatcher::kHostAllowGnubbyAuthPolicyName, true); |
+ dict.SetString( |
+ policy::key::kRemoteAccessHostTokenValidationCertificateIssuer, |
+ std::string()); |
+ dict.SetBoolean(policy::key::kRemoteAccessHostAllowClientPairing, true); |
+ dict.SetBoolean(policy::key::kRemoteAccessHostAllowGnubbyAuth, true); |
#if !defined(NDEBUG) |
- dict.SetString(PolicyWatcher::kHostDebugOverridePoliciesName, ""); |
+ dict.SetString(policy::key::kRemoteAccessHostDebugOverridePolicies, ""); |
#endif |
} |
}; |