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

Side by Side Diff: components/proximity_auth/device_to_device_authenticator_unittest.cc

Issue 2560713002: Move RemoteDevice from //components/proximity_auth to //components/cryptauth so that it can be easi… (Closed)
Patch Set: Add cryptauth dependency. Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/proximity_auth/device_to_device_authenticator.h" 5 #include "components/proximity_auth/device_to_device_authenticator.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64url.h" 9 #include "base/base64url.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 std::string* public_key_out, 56 std::string* public_key_out,
57 bool validated, 57 bool validated,
58 const std::string& public_key) { 58 const std::string& public_key) {
59 *validated_out = validated; 59 *validated_out = validated;
60 *public_key_out = public_key; 60 *public_key_out = public_key;
61 } 61 }
62 62
63 // Connection implementation for testing. 63 // Connection implementation for testing.
64 class FakeConnection : public Connection { 64 class FakeConnection : public Connection {
65 public: 65 public:
66 FakeConnection(const RemoteDevice& remote_device) 66 FakeConnection(const cryptauth::RemoteDevice& remote_device)
67 : Connection(remote_device), connection_blocked_(false) {} 67 : Connection(remote_device), connection_blocked_(false) {}
68 ~FakeConnection() override {} 68 ~FakeConnection() override {}
69 69
70 // Connection: 70 // Connection:
71 void Connect() override { SetStatus(Connection::Status::CONNECTED); } 71 void Connect() override { SetStatus(Connection::Status::CONNECTED); }
72 void Disconnect() override { SetStatus(Connection::Status::DISCONNECTED); } 72 void Disconnect() override { SetStatus(Connection::Status::DISCONNECTED); }
73 73
74 using Connection::OnBytesReceived; 74 using Connection::OnBytesReceived;
75 75
76 void ClearMessageBuffer() { message_buffer_.clear(); } 76 void ClearMessageBuffer() { message_buffer_.clear(); }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 void OnAuthenticationResult(Authenticator::Result result, 216 void OnAuthenticationResult(Authenticator::Result result,
217 std::unique_ptr<SecureContext> secure_context) { 217 std::unique_ptr<SecureContext> secure_context) {
218 secure_context_ = std::move(secure_context); 218 secure_context_ = std::move(secure_context);
219 OnAuthenticationResultProxy(result); 219 OnAuthenticationResultProxy(result);
220 } 220 }
221 221
222 MOCK_METHOD1(OnAuthenticationResultProxy, void(Authenticator::Result result)); 222 MOCK_METHOD1(OnAuthenticationResultProxy, void(Authenticator::Result result));
223 223
224 // Contains information about the remote device. 224 // Contains information about the remote device.
225 const RemoteDevice remote_device_; 225 const cryptauth::RemoteDevice remote_device_;
226 226
227 // Simulates the connection to the remote device. 227 // Simulates the connection to the remote device.
228 FakeConnection connection_; 228 FakeConnection connection_;
229 229
230 // The SecureMessageDelegate used by the authenticator. 230 // The SecureMessageDelegate used by the authenticator.
231 // Owned by |authenticator_|. 231 // Owned by |authenticator_|.
232 cryptauth::FakeSecureMessageDelegate* secure_message_delegate_; 232 cryptauth::FakeSecureMessageDelegate* secure_message_delegate_;
233 233
234 // The DeviceToDeviceAuthenticator under test. 234 // The DeviceToDeviceAuthenticator under test.
235 DeviceToDeviceAuthenticatorForTest authenticator_; 235 DeviceToDeviceAuthenticatorForTest authenticator_;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 WireMessage wire_message(base::RandBytesAsString(300u)); 342 WireMessage wire_message(base::RandBytesAsString(300u));
343 connection_.SendMessage( 343 connection_.SendMessage(
344 base::MakeUnique<WireMessage>(base::RandBytesAsString(300u))); 344 base::MakeUnique<WireMessage>(base::RandBytesAsString(300u)));
345 connection_.OnBytesReceived(wire_message.Serialize()); 345 connection_.OnBytesReceived(wire_message.Serialize());
346 connection_.SendMessage( 346 connection_.SendMessage(
347 base::MakeUnique<WireMessage>(base::RandBytesAsString(300u))); 347 base::MakeUnique<WireMessage>(base::RandBytesAsString(300u)));
348 connection_.OnBytesReceived(wire_message.Serialize()); 348 connection_.OnBytesReceived(wire_message.Serialize());
349 } 349 }
350 350
351 } // namespace proximity_auth 351 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/connection_unittest.cc ('k') | components/proximity_auth/fake_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698