| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "remoting/host/constants.h" |
| 9 #include "remoting/host/policy_hack/fake_policy_watcher.h" | 10 #include "remoting/host/policy_hack/fake_policy_watcher.h" |
| 10 #include "remoting/host/policy_hack/mock_policy_callback.h" | 11 #include "remoting/host/policy_hack/mock_policy_callback.h" |
| 11 #include "remoting/host/policy_hack/policy_watcher.h" | 12 #include "remoting/host/policy_hack/policy_watcher.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 namespace remoting { | 16 namespace remoting { |
| 16 namespace policy_hack { | 17 namespace policy_hack { |
| 17 | 18 |
| 18 class PolicyWatcherTest : public testing::Test { | 19 class PolicyWatcherTest : public testing::Test { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 base::DictionaryValue domain_full_others_default_; | 89 base::DictionaryValue domain_full_others_default_; |
| 89 base::DictionaryValue nat_true_domain_empty_; | 90 base::DictionaryValue nat_true_domain_empty_; |
| 90 base::DictionaryValue nat_true_domain_full_; | 91 base::DictionaryValue nat_true_domain_full_; |
| 91 base::DictionaryValue nat_false_domain_empty_; | 92 base::DictionaryValue nat_false_domain_empty_; |
| 92 base::DictionaryValue nat_false_domain_full_; | 93 base::DictionaryValue nat_false_domain_full_; |
| 93 base::DictionaryValue nat_true_domain_empty_others_default_; | 94 base::DictionaryValue nat_true_domain_empty_others_default_; |
| 94 | 95 |
| 95 private: | 96 private: |
| 96 void SetDefaults(base::DictionaryValue& dict) { | 97 void SetDefaults(base::DictionaryValue& dict) { |
| 97 dict.SetBoolean(PolicyWatcher::kNatPolicyName, true); | 98 dict.SetBoolean(PolicyWatcher::kNatPolicyName, true); |
| 98 dict.SetBoolean(PolicyWatcher::kRequireTwoFactorPolicyName, false); | 99 dict.SetBoolean(PolicyWatcher::kHostRequireTwoFactorPolicyName, false); |
| 99 dict.SetString(PolicyWatcher::kHostDomainPolicyName, ""); | 100 dict.SetString(PolicyWatcher::kHostDomainPolicyName, ""); |
| 100 dict.SetString(PolicyWatcher::kTalkGadgetPolicyName, "chromoting"); | 101 dict.SetString(PolicyWatcher::kHostTalkGadgetPrefixPolicyName, |
| 102 DEFAULT_TALKGADGET_PREFIX); |
| 101 } | 103 } |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 const char* PolicyWatcherTest::kHostDomain = "google.com"; | 106 const char* PolicyWatcherTest::kHostDomain = "google.com"; |
| 105 | 107 |
| 106 MATCHER_P(IsPolicies, dict, "") { | 108 MATCHER_P(IsPolicies, dict, "") { |
| 107 return arg->Equals(dict); | 109 return arg->Equals(dict); |
| 108 } | 110 } |
| 109 | 111 |
| 110 TEST_F(PolicyWatcherTest, None) { | 112 TEST_F(PolicyWatcherTest, None) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 policy_watcher_->SetPolicies(&nat_true_domain_empty_); | 246 policy_watcher_->SetPolicies(&nat_true_domain_empty_); |
| 245 policy_watcher_->SetPolicies(&nat_true_domain_full_); | 247 policy_watcher_->SetPolicies(&nat_true_domain_full_); |
| 246 policy_watcher_->SetPolicies(&nat_false_domain_full_); | 248 policy_watcher_->SetPolicies(&nat_false_domain_full_); |
| 247 policy_watcher_->SetPolicies(&nat_false_domain_empty_); | 249 policy_watcher_->SetPolicies(&nat_false_domain_empty_); |
| 248 policy_watcher_->SetPolicies(&nat_true_domain_full_); | 250 policy_watcher_->SetPolicies(&nat_true_domain_full_); |
| 249 StopWatching(); | 251 StopWatching(); |
| 250 } | 252 } |
| 251 | 253 |
| 252 } // namespace policy_hack | 254 } // namespace policy_hack |
| 253 } // namespace remoting | 255 } // namespace remoting |
| OLD | NEW |