| 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/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "remoting/host/dns_blackhole_checker.h" | 10 #include "remoting/host/dns_blackhole_checker.h" |
| 11 #include "remoting/host/policy_hack/fake_policy_watcher.h" | 11 #include "remoting/host/policy_hack/fake_policy_watcher.h" |
| 12 #include "remoting/host/policy_hack/mock_policy_callback.h" | 12 #include "remoting/host/policy_hack/mock_policy_callback.h" |
| 13 #include "remoting/host/policy_hack/policy_watcher.h" | 13 #include "remoting/host/policy_hack/policy_watcher.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 namespace remoting { | 17 namespace remoting { |
| 18 namespace policy_hack { | 18 namespace policy_hack { |
| 19 | 19 |
| 20 class PolicyWatcherTest : public testing::Test { | 20 class PolicyWatcherTest : public testing::Test { |
| 21 public: | 21 public: |
| 22 PolicyWatcherTest() { | 22 PolicyWatcherTest() { |
| 23 } | 23 } |
| 24 | 24 |
| 25 virtual void SetUp() override { | 25 void SetUp() override { |
| 26 message_loop_proxy_ = base::MessageLoopProxy::current(); | 26 message_loop_proxy_ = base::MessageLoopProxy::current(); |
| 27 policy_callback_ = base::Bind(&MockPolicyCallback::OnPolicyUpdate, | 27 policy_callback_ = base::Bind(&MockPolicyCallback::OnPolicyUpdate, |
| 28 base::Unretained(&mock_policy_callback_)); | 28 base::Unretained(&mock_policy_callback_)); |
| 29 policy_watcher_.reset(new FakePolicyWatcher(message_loop_proxy_)); | 29 policy_watcher_.reset(new FakePolicyWatcher(message_loop_proxy_)); |
| 30 nat_true_.SetBoolean(PolicyWatcher::kNatPolicyName, true); | 30 nat_true_.SetBoolean(PolicyWatcher::kNatPolicyName, true); |
| 31 nat_false_.SetBoolean(PolicyWatcher::kNatPolicyName, false); | 31 nat_false_.SetBoolean(PolicyWatcher::kNatPolicyName, false); |
| 32 nat_one_.SetInteger(PolicyWatcher::kNatPolicyName, 1); | 32 nat_one_.SetInteger(PolicyWatcher::kNatPolicyName, 1); |
| 33 domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, | 33 domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, |
| 34 std::string()); | 34 std::string()); |
| 35 domain_full_.SetString(PolicyWatcher::kHostDomainPolicyName, kHostDomain); | 35 domain_full_.SetString(PolicyWatcher::kHostDomainPolicyName, kHostDomain); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 397 |
| 398 StartWatching(); | 398 StartWatching(); |
| 399 policy_watcher_->SetPolicies(&empty_); | 399 policy_watcher_->SetPolicies(&empty_); |
| 400 policy_watcher_->SetPolicies(&port_range_full_); | 400 policy_watcher_->SetPolicies(&port_range_full_); |
| 401 policy_watcher_->SetPolicies(&port_range_empty_); | 401 policy_watcher_->SetPolicies(&port_range_empty_); |
| 402 StopWatching(); | 402 StopWatching(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 } // namespace policy_hack | 405 } // namespace policy_hack |
| 406 } // namespace remoting | 406 } // namespace remoting |
| OLD | NEW |