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

Side by Side Diff: remoting/host/it2me/it2me_native_messaging_host_unittest.cc

Issue 2847853003: Remove policy watching from It2MeHost. (Closed)
Patch Set: Remove pending policies from It2MeNativeMessagingHost and add an accessor to PolicyWatcher. Created 3 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "remoting/host/it2me/it2me_native_messaging_host.h" 5 #include "remoting/host/it2me/it2me_native_messaging_host.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return true; 118 return true;
119 } 119 }
120 120
121 void FakePolicyService::RefreshPolicies(const base::Closure& callback) { 121 void FakePolicyService::RefreshPolicies(const base::Closure& callback) {
122 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); 122 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback);
123 } 123 }
124 124
125 class MockIt2MeHost : public It2MeHost { 125 class MockIt2MeHost : public It2MeHost {
126 public: 126 public:
127 MockIt2MeHost(std::unique_ptr<ChromotingHostContext> context, 127 MockIt2MeHost(std::unique_ptr<ChromotingHostContext> context,
128 std::unique_ptr<PolicyWatcher> policy_watcher,
129 base::WeakPtr<It2MeHost::Observer> observer, 128 base::WeakPtr<It2MeHost::Observer> observer,
130 std::unique_ptr<SignalStrategy> signal_strategy, 129 std::unique_ptr<SignalStrategy> signal_strategy,
131 const std::string& username, 130 const std::string& username,
132 const std::string& directory_bot_jid) 131 const std::string& directory_bot_jid)
133 : It2MeHost(std::move(context), 132 : It2MeHost(std::move(context),
134 std::move(policy_watcher),
135 /*confirmation_dialog_factory=*/nullptr, 133 /*confirmation_dialog_factory=*/nullptr,
136 observer, 134 observer,
137 std::move(signal_strategy), 135 std::move(signal_strategy),
138 username, 136 username,
139 directory_bot_jid) {} 137 directory_bot_jid) {}
140 138
141 // It2MeHost overrides 139 // It2MeHost overrides
142 void Connect() override; 140 void Connect() override;
143 void Disconnect() override; 141 void Disconnect() override;
144 void RequestNatPolicy() override; 142 void RequestNatPolicy() override;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 220
223 MockIt2MeHostFactory::~MockIt2MeHostFactory() {} 221 MockIt2MeHostFactory::~MockIt2MeHostFactory() {}
224 222
225 scoped_refptr<It2MeHost> MockIt2MeHostFactory::CreateIt2MeHost( 223 scoped_refptr<It2MeHost> MockIt2MeHostFactory::CreateIt2MeHost(
226 std::unique_ptr<ChromotingHostContext> context, 224 std::unique_ptr<ChromotingHostContext> context,
227 policy::PolicyService* policy_service, 225 policy::PolicyService* policy_service,
228 base::WeakPtr<It2MeHost::Observer> observer, 226 base::WeakPtr<It2MeHost::Observer> observer,
229 std::unique_ptr<SignalStrategy> signal_strategy, 227 std::unique_ptr<SignalStrategy> signal_strategy,
230 const std::string& username, 228 const std::string& username,
231 const std::string& directory_bot_jid) { 229 const std::string& directory_bot_jid) {
232 return new MockIt2MeHost(std::move(context), 230 return new MockIt2MeHost(std::move(context), observer,
233 /*policy_watcher=*/nullptr, observer,
234 std::move(signal_strategy), username, 231 std::move(signal_strategy), username,
235 directory_bot_jid); 232 directory_bot_jid);
236 } 233 }
237 234
238 } // namespace 235 } // namespace
239 236
240 class It2MeNativeMessagingHostTest : public testing::Test { 237 class It2MeNativeMessagingHostTest : public testing::Test {
241 public: 238 public:
242 It2MeNativeMessagingHostTest() {} 239 It2MeNativeMessagingHostTest() {}
243 ~It2MeNativeMessagingHostTest() override {} 240 ~It2MeNativeMessagingHostTest() override {}
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 } 629 }
633 630
634 // Verify rejection if type is unrecognized. 631 // Verify rejection if type is unrecognized.
635 TEST_F(It2MeNativeMessagingHostTest, InvalidType) { 632 TEST_F(It2MeNativeMessagingHostTest, InvalidType) {
636 base::DictionaryValue message; 633 base::DictionaryValue message;
637 message.SetString("type", "xxx"); 634 message.SetString("type", "xxx");
638 TestBadRequest(message, true); 635 TestBadRequest(message, true);
639 } 636 }
640 637
641 } // namespace remoting 638 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698