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

Side by Side Diff: remoting/host/policy_hack/policy_watcher_unittest.cc

Issue 867463006: Merged PolicyServiceWatcher into PolicyWatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a build problem on Mac. Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « remoting/host/policy_hack/policy_watcher.cc ('k') | remoting/remoting_host_srcs.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
11 #include "components/policy/core/common/fake_async_policy_loader.h" 11 #include "components/policy/core/common/fake_async_policy_loader.h"
12 #include "policy/policy_constants.h" 12 #include "policy/policy_constants.h"
13 #include "remoting/host/dns_blackhole_checker.h" 13 #include "remoting/host/dns_blackhole_checker.h"
14 #include "remoting/host/policy_hack/mock_policy_callback.h" 14 #include "remoting/host/policy_hack/mock_policy_callback.h"
15 #include "remoting/host/policy_hack/policy_service_watcher.h"
16 #include "remoting/host/policy_hack/policy_watcher.h" 15 #include "remoting/host/policy_hack/policy_watcher.h"
17 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 18
20 namespace remoting { 19 namespace remoting {
21 namespace policy_hack { 20 namespace policy_hack {
22 21
23 class PolicyWatcherTest : public testing::Test { 22 class PolicyWatcherTest : public testing::Test {
24 public: 23 public:
25 PolicyWatcherTest() : message_loop_(base::MessageLoop::TYPE_IO) {} 24 PolicyWatcherTest() : message_loop_(base::MessageLoop::TYPE_IO) {}
26 25
27 void SetUp() override { 26 void SetUp() override {
28 message_loop_proxy_ = base::MessageLoopProxy::current(); 27 message_loop_proxy_ = base::MessageLoopProxy::current();
29 policy_updated_callback_ = base::Bind( 28 policy_updated_callback_ = base::Bind(
30 &MockPolicyCallback::OnPolicyUpdate, 29 &MockPolicyCallback::OnPolicyUpdate,
31 base::Unretained(&mock_policy_callback_)); 30 base::Unretained(&mock_policy_callback_));
32 policy_error_callback_ = base::Bind( 31 policy_error_callback_ = base::Bind(
33 &MockPolicyCallback::OnPolicyError, 32 &MockPolicyCallback::OnPolicyError,
34 base::Unretained(&mock_policy_callback_)); 33 base::Unretained(&mock_policy_callback_));
35 34
36 // Retaining a raw pointer to keep control over policy contents. 35 // Retaining a raw pointer to keep control over policy contents.
37 policy_loader_ = new policy::FakeAsyncPolicyLoader(message_loop_proxy_); 36 policy_loader_ = new policy::FakeAsyncPolicyLoader(message_loop_proxy_);
38 policy_watcher_ = PolicyServiceWatcher::CreateFromPolicyLoader( 37 policy_watcher_ = PolicyWatcher::CreateFromPolicyLoader(
39 message_loop_proxy_, make_scoped_ptr(policy_loader_)); 38 message_loop_proxy_, make_scoped_ptr(policy_loader_));
40 39
41 nat_true_.SetBoolean(policy::key::kRemoteAccessHostFirewallTraversal, true); 40 nat_true_.SetBoolean(policy::key::kRemoteAccessHostFirewallTraversal, true);
42 nat_false_.SetBoolean(policy::key::kRemoteAccessHostFirewallTraversal, 41 nat_false_.SetBoolean(policy::key::kRemoteAccessHostFirewallTraversal,
43 false); 42 false);
44 nat_one_.SetInteger(policy::key::kRemoteAccessHostFirewallTraversal, 1); 43 nat_one_.SetInteger(policy::key::kRemoteAccessHostFirewallTraversal, 1);
45 domain_empty_.SetString(policy::key::kRemoteAccessHostDomain, 44 domain_empty_.SetString(policy::key::kRemoteAccessHostDomain,
46 std::string()); 45 std::string());
47 domain_full_.SetString(policy::key::kRemoteAccessHostDomain, kHostDomain); 46 domain_full_.SetString(policy::key::kRemoteAccessHostDomain, kHostDomain);
48 SetDefaults(nat_true_others_default_); 47 SetDefaults(nat_true_others_default_);
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 576
578 // Today, the only verification offered by this test is: 577 // Today, the only verification offered by this test is:
579 // - Manual verification of policy values dumped by OnPolicyUpdatedDumpPolicy 578 // - Manual verification of policy values dumped by OnPolicyUpdatedDumpPolicy
580 // - Automated verification that nothing crashed 579 // - Automated verification that nothing crashed
581 } 580 }
582 581
583 #endif 582 #endif
584 583
585 } // namespace policy_hack 584 } // namespace policy_hack
586 } // namespace remoting 585 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/policy_hack/policy_watcher.cc ('k') | remoting/remoting_host_srcs.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698