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

Unified Diff: remoting/host/policy_watcher_unittest.cc

Issue 2682473003: Add support for multiple allowed domains (Closed)
Patch Set: Rework to follow a deprecation approach Created 3 years, 8 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
Index: remoting/host/policy_watcher_unittest.cc
diff --git a/remoting/host/policy_watcher_unittest.cc b/remoting/host/policy_watcher_unittest.cc
index ccbdf6d8f46dc993d2bcc1188270a4120a3ebea2..74f676977ef681d156947a10c624bbeea43aa7d2 100644
--- a/remoting/host/policy_watcher_unittest.cc
+++ b/remoting/host/policy_watcher_unittest.cc
@@ -74,13 +74,19 @@ class PolicyWatcherTest : public testing::Test {
policy_watcher_ = PolicyWatcher::CreateFromPolicyLoaderForTesting(
base::WrapUnique(policy_loader_));
+ base::ListValue host_domain;
+ host_domain.AppendString(kHostDomain);
+
nat_true_.SetBoolean(key::kRemoteAccessHostFirewallTraversal, true);
nat_false_.SetBoolean(key::kRemoteAccessHostFirewallTraversal, false);
nat_one_.SetInteger(key::kRemoteAccessHostFirewallTraversal, 1);
nat_one_domain_full_.SetInteger(key::kRemoteAccessHostFirewallTraversal, 1);
- nat_one_domain_full_.SetString(key::kRemoteAccessHostDomain, kHostDomain);
- domain_empty_.SetString(key::kRemoteAccessHostDomain, std::string());
- domain_full_.SetString(key::kRemoteAccessHostDomain, kHostDomain);
+ nat_one_domain_full_.Set(key::kRemoteAccessHostDomainList,
+ host_domain.CreateDeepCopy());
+ domain_empty_.Set(key::kRemoteAccessHostDomainList,
+ base::MakeUnique<base::ListValue>());
+ domain_full_.Set(key::kRemoteAccessHostDomainList,
+ host_domain.CreateDeepCopy());
SetDefaults(nat_true_others_default_);
nat_true_others_default_.SetBoolean(key::kRemoteAccessHostFirewallTraversal,
true);
@@ -88,30 +94,32 @@ class PolicyWatcherTest : public testing::Test {
nat_false_others_default_.SetBoolean(
key::kRemoteAccessHostFirewallTraversal, false);
SetDefaults(domain_empty_others_default_);
- domain_empty_others_default_.SetString(key::kRemoteAccessHostDomain,
- std::string());
+ domain_empty_others_default_.Set(key::kRemoteAccessHostDomainList,
+ base::MakeUnique<base::ListValue>());
SetDefaults(domain_full_others_default_);
- domain_full_others_default_.SetString(key::kRemoteAccessHostDomain,
- kHostDomain);
+ domain_full_others_default_.Set(key::kRemoteAccessHostDomainList,
+ host_domain.CreateDeepCopy());
nat_true_domain_empty_.SetBoolean(key::kRemoteAccessHostFirewallTraversal,
true);
- nat_true_domain_empty_.SetString(key::kRemoteAccessHostDomain,
- std::string());
+ nat_true_domain_empty_.Set(key::kRemoteAccessHostDomainList,
+ base::MakeUnique<base::ListValue>());
nat_true_domain_full_.SetBoolean(key::kRemoteAccessHostFirewallTraversal,
true);
- nat_true_domain_full_.SetString(key::kRemoteAccessHostDomain, kHostDomain);
+ nat_true_domain_full_.Set(key::kRemoteAccessHostDomainList,
+ host_domain.CreateDeepCopy());
nat_false_domain_empty_.SetBoolean(key::kRemoteAccessHostFirewallTraversal,
false);
- nat_false_domain_empty_.SetString(key::kRemoteAccessHostDomain,
- std::string());
+ nat_false_domain_empty_.Set(key::kRemoteAccessHostDomainList,
+ base::MakeUnique<base::ListValue>());
nat_false_domain_full_.SetBoolean(key::kRemoteAccessHostFirewallTraversal,
false);
- nat_false_domain_full_.SetString(key::kRemoteAccessHostDomain, kHostDomain);
+ nat_false_domain_full_.Set(key::kRemoteAccessHostDomainList,
+ host_domain.CreateDeepCopy());
SetDefaults(nat_true_domain_empty_others_default_);
nat_true_domain_empty_others_default_.SetBoolean(
key::kRemoteAccessHostFirewallTraversal, true);
- nat_true_domain_empty_others_default_.SetString(
- key::kRemoteAccessHostDomain, std::string());
+ nat_true_domain_empty_others_default_.Set(
+ key::kRemoteAccessHostDomainList, base::MakeUnique<base::ListValue>());
unknown_policies_.SetString("UnknownPolicyOne", std::string());
unknown_policies_.SetString("UnknownPolicyTwo", std::string());
unknown_policies_.SetBoolean("RemoteAccessHostUnknownPolicyThree", true);
@@ -129,8 +137,8 @@ class PolicyWatcherTest : public testing::Test {
port_range_malformed_.SetString(key::kRemoteAccessHostUdpPortRange,
"malformed");
port_range_malformed_domain_full_.MergeDictionary(&port_range_malformed_);
- port_range_malformed_domain_full_.SetString(key::kRemoteAccessHostDomain,
- kHostDomain);
+ port_range_malformed_domain_full_.Set(key::kRemoteAccessHostDomainList,
+ host_domain.CreateDeepCopy());
curtain_true_.SetBoolean(key::kRemoteAccessHostRequireCurtain, true);
curtain_false_.SetBoolean(key::kRemoteAccessHostRequireCurtain, false);
@@ -250,8 +258,10 @@ class PolicyWatcherTest : public testing::Test {
dict.SetBoolean(key::kRemoteAccessHostFirewallTraversal, true);
dict.SetBoolean(key::kRemoteAccessHostAllowRelayedConnection, true);
dict.SetString(key::kRemoteAccessHostUdpPortRange, "");
- dict.SetString(key::kRemoteAccessHostClientDomain, std::string());
- dict.SetString(key::kRemoteAccessHostDomain, std::string());
+ dict.Set(key::kRemoteAccessHostClientDomainList,
+ base::MakeUnique<base::ListValue>());
+ dict.Set(key::kRemoteAccessHostDomainList,
+ base::MakeUnique<base::ListValue>());
dict.SetBoolean(key::kRemoteAccessHostMatchUsername, false);
dict.SetString(key::kRemoteAccessHostTalkGadgetPrefix,
kDefaultHostTalkGadgetPrefix);
@@ -659,6 +669,11 @@ TEST_F(PolicyWatcherTest, PolicySchemaAndPolicyWatcherShouldBeInSync) {
// policies, so we have to skip them here.
continue;
}
+ if (key == policy::key::kRemoteAccessHostDomain ||
+ key == policy::key::kRemoteAccessHostClientDomain) {
+ // These policies are deprecated and get removed during normalization
+ continue;
+ }
actual_schema[key] = it.schema().type();
}

Powered by Google App Engine
This is Rietveld 408576698