[Chromoting] Add names of host policies for requiring 2-factor auth, and for the talkgadget name.

BUG=108448


Review URL: https://chromiumcodereview.appspot.com/10837022

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149238 0039d316-1c4b-4281-b951-d872f2087c98
parent e47b323a
...@@ -88,8 +88,15 @@ scoped_ptr<base::DictionaryValue> AddDefaultValuesWhenNecessary( ...@@ -88,8 +88,15 @@ scoped_ptr<base::DictionaryValue> AddDefaultValuesWhenNecessary(
scoped_ptr<base::DictionaryValue> to(new base::DictionaryValue()); scoped_ptr<base::DictionaryValue> to(new base::DictionaryValue());
CopyBooleanOrDefault(to.get(), from, CopyBooleanOrDefault(to.get(), from,
PolicyWatcher::kNatPolicyName, true, false); PolicyWatcher::kNatPolicyName, true, false);
CopyBooleanOrDefault(to.get(), from,
PolicyWatcher::kRequireTwoFactorPolicyName,
false, false);
CopyStringOrDefault(to.get(), from, CopyStringOrDefault(to.get(), from,
PolicyWatcher::kHostDomainPolicyName, "", ""); PolicyWatcher::kHostDomainPolicyName, "", "");
CopyStringOrDefault(to.get(), from,
PolicyWatcher::kTalkGadgetPolicyName,
"chromoting", "chromoting");
return to.Pass(); return to.Pass();
} }
...@@ -98,17 +105,27 @@ scoped_ptr<base::DictionaryValue> AddDefaultValuesWhenNecessary( ...@@ -98,17 +105,27 @@ scoped_ptr<base::DictionaryValue> AddDefaultValuesWhenNecessary(
const char PolicyWatcher::kNatPolicyName[] = const char PolicyWatcher::kNatPolicyName[] =
"RemoteAccessHostFirewallTraversal"; "RemoteAccessHostFirewallTraversal";
const char PolicyWatcher::kRequireTwoFactorPolicyName[] =
"RemoteAccessHostRequireTwoFactor";
const char PolicyWatcher::kHostDomainPolicyName[] = const char PolicyWatcher::kHostDomainPolicyName[] =
"RemoteAccessHostDomain"; "RemoteAccessHostDomain";
const char PolicyWatcher::kTalkGadgetPolicyName[] =
"RemoteAccessHostTalkGadget";
const char* const PolicyWatcher::kBooleanPolicyNames[] = const char* const PolicyWatcher::kBooleanPolicyNames[] =
{ PolicyWatcher::kNatPolicyName }; { PolicyWatcher::kNatPolicyName,
PolicyWatcher::kRequireTwoFactorPolicyName
};
const int PolicyWatcher::kBooleanPolicyNamesNum = const int PolicyWatcher::kBooleanPolicyNamesNum =
arraysize(kBooleanPolicyNames); arraysize(kBooleanPolicyNames);
const char* const PolicyWatcher::kStringPolicyNames[] = const char* const PolicyWatcher::kStringPolicyNames[] =
{ PolicyWatcher::kHostDomainPolicyName }; { PolicyWatcher::kHostDomainPolicyName,
PolicyWatcher::kTalkGadgetPolicyName
};
const int PolicyWatcher::kStringPolicyNamesNum = const int PolicyWatcher::kStringPolicyNamesNum =
arraysize(kStringPolicyNames); arraysize(kStringPolicyNames);
......
...@@ -49,9 +49,15 @@ class PolicyWatcher { ...@@ -49,9 +49,15 @@ class PolicyWatcher {
// The name of the NAT traversal policy. // The name of the NAT traversal policy.
static const char kNatPolicyName[]; static const char kNatPolicyName[];
// The name of the policy for requiring 2-factor authentication.
static const char kRequireTwoFactorPolicyName[];
// The name of the host domain policy. // The name of the host domain policy.
static const char kHostDomainPolicyName[]; static const char kHostDomainPolicyName[];
// The name of the talkgadget policy.
static const char kTalkGadgetPolicyName[];
protected: protected:
virtual void StartWatchingInternal() = 0; virtual void StartWatchingInternal() = 0;
virtual void StopWatchingInternal() = 0; virtual void StopWatchingInternal() = 0;
......
...@@ -50,6 +50,11 @@ class PolicyWatcherTest : public testing::Test { ...@@ -50,6 +50,11 @@ class PolicyWatcherTest : public testing::Test {
nat_false_domain_full_.SetBoolean(PolicyWatcher::kNatPolicyName, false); nat_false_domain_full_.SetBoolean(PolicyWatcher::kNatPolicyName, false);
nat_false_domain_full_.SetString(PolicyWatcher::kHostDomainPolicyName, nat_false_domain_full_.SetString(PolicyWatcher::kHostDomainPolicyName,
kHostDomain); kHostDomain);
SetDefaults(nat_true_domain_empty_others_default_);
nat_true_domain_empty_others_default_.SetBoolean(
PolicyWatcher::kNatPolicyName, true);
nat_true_domain_empty_others_default_.SetString(
PolicyWatcher::kHostDomainPolicyName, "");
} }
protected: protected:
...@@ -85,11 +90,14 @@ class PolicyWatcherTest : public testing::Test { ...@@ -85,11 +90,14 @@ class PolicyWatcherTest : public testing::Test {
base::DictionaryValue nat_true_domain_full_; base::DictionaryValue nat_true_domain_full_;
base::DictionaryValue nat_false_domain_empty_; base::DictionaryValue nat_false_domain_empty_;
base::DictionaryValue nat_false_domain_full_; base::DictionaryValue nat_false_domain_full_;
base::DictionaryValue nat_true_domain_empty_others_default_;
private: private:
void SetDefaults(base::DictionaryValue& dict) { void SetDefaults(base::DictionaryValue& dict) {
dict.SetBoolean(PolicyWatcher::kNatPolicyName, true); dict.SetBoolean(PolicyWatcher::kNatPolicyName, true);
dict.SetBoolean(PolicyWatcher::kRequireTwoFactorPolicyName, false);
dict.SetString(PolicyWatcher::kHostDomainPolicyName, ""); dict.SetString(PolicyWatcher::kHostDomainPolicyName, "");
dict.SetString(PolicyWatcher::kTalkGadgetPolicyName, "chromoting");
} }
}; };
...@@ -221,7 +229,8 @@ TEST_F(PolicyWatcherTest, NatNoneThenFalseThenTrue) { ...@@ -221,7 +229,8 @@ TEST_F(PolicyWatcherTest, NatNoneThenFalseThenTrue) {
TEST_F(PolicyWatcherTest, ChangeOneRepeatedlyThenTwo) { TEST_F(PolicyWatcherTest, ChangeOneRepeatedlyThenTwo) {
testing::InSequence sequence; testing::InSequence sequence;
EXPECT_CALL(mock_policy_callback_, EXPECT_CALL(mock_policy_callback_,
OnPolicyUpdatePtr(IsPolicies(&nat_true_domain_empty_))); OnPolicyUpdatePtr(IsPolicies(
&nat_true_domain_empty_others_default_)));
EXPECT_CALL(mock_policy_callback_, EXPECT_CALL(mock_policy_callback_,
OnPolicyUpdatePtr(IsPolicies(&domain_full_))); OnPolicyUpdatePtr(IsPolicies(&domain_full_)));
EXPECT_CALL(mock_policy_callback_, EXPECT_CALL(mock_policy_callback_,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment