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

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

Issue 639233002: Remote assistance on Chrome OS Part IV - It2MeHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedbacks Created 6 years, 2 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
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/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"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #endif 92 #endif
93 } 93 }
94 94
95 protected: 95 protected:
96 void StartWatching() { 96 void StartWatching() {
97 policy_watcher_->StartWatching(policy_callback_); 97 policy_watcher_->StartWatching(policy_callback_);
98 base::RunLoop().RunUntilIdle(); 98 base::RunLoop().RunUntilIdle();
99 } 99 }
100 100
101 void StopWatching() { 101 void StopWatching() {
102 base::WaitableEvent stop_event(false, false); 102 EXPECT_CALL(*this, PostPolicyWatcherShutdown()).Times(1);
Wez 2014/10/17 17:58:01 You shouldn't mix call expectations in with actual
kelvinp 2014/10/20 00:21:18 I felt the same way when I saw the EXPECT_EQ in th
103 policy_watcher_->StopWatching(&stop_event); 103 policy_watcher_->StopWatching(base::Bind(
104 &PolicyWatcherTest::PostPolicyWatcherShutdown, base::Unretained(this)));
104 base::RunLoop().RunUntilIdle(); 105 base::RunLoop().RunUntilIdle();
105 EXPECT_EQ(true, stop_event.IsSignaled());
106 } 106 }
107 107
108 MOCK_METHOD0(PostPolicyWatcherShutdown, void());
109
108 static const char* kHostDomain; 110 static const char* kHostDomain;
109 static const char* kPortRange; 111 static const char* kPortRange;
110 base::MessageLoop message_loop_; 112 base::MessageLoop message_loop_;
111 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 113 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
112 MockPolicyCallback mock_policy_callback_; 114 MockPolicyCallback mock_policy_callback_;
113 PolicyWatcher::PolicyCallback policy_callback_; 115 PolicyWatcher::PolicyCallback policy_callback_;
114 scoped_ptr<FakePolicyWatcher> policy_watcher_; 116 scoped_ptr<FakePolicyWatcher> policy_watcher_;
115 base::DictionaryValue empty_; 117 base::DictionaryValue empty_;
116 base::DictionaryValue nat_true_; 118 base::DictionaryValue nat_true_;
117 base::DictionaryValue nat_false_; 119 base::DictionaryValue nat_false_;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 399
398 StartWatching(); 400 StartWatching();
399 policy_watcher_->SetPolicies(&empty_); 401 policy_watcher_->SetPolicies(&empty_);
400 policy_watcher_->SetPolicies(&port_range_full_); 402 policy_watcher_->SetPolicies(&port_range_full_);
401 policy_watcher_->SetPolicies(&port_range_empty_); 403 policy_watcher_->SetPolicies(&port_range_empty_);
402 StopWatching(); 404 StopWatching();
403 } 405 }
404 406
405 } // namespace policy_hack 407 } // namespace policy_hack
406 } // namespace remoting 408 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698