Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Unified Diff: remoting/host/policy_hack/policy_watcher_unittest.cc

Issue 820133002: Reusing names of policy keys from policy_constants.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Marked the 5 "new" policies as chrome_os:42- Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/policy_hack/policy_watcher.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
};
« no previous file with comments | « remoting/host/policy_hack/policy_watcher.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698