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

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

Issue 1356943004: Add RemoteDeviceLoader to create RemoteDevice from CryptAuth data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webui
Patch Set: Created 5 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 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/remote_device_life_cycle_impl.h" 5 #include "components/proximity_auth/remote_device_life_cycle_impl.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/test/test_simple_task_runner.h" 9 #include "base/test/test_simple_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 10 matching lines...) Expand all
21 using testing::Mock; 21 using testing::Mock;
22 using testing::NiceMock; 22 using testing::NiceMock;
23 using testing::Return; 23 using testing::Return;
24 using testing::StrictMock; 24 using testing::StrictMock;
25 25
26 namespace proximity_auth { 26 namespace proximity_auth {
27 27
28 namespace { 28 namespace {
29 29
30 // Attributes of the remote device under test. 30 // Attributes of the remote device under test.
31 const char kRemoteDeviceUserId[] = "example@gmail.com";
31 const char kRemoteDeviceName[] = "remote device"; 32 const char kRemoteDeviceName[] = "remote device";
32 const char kRemoteDevicePublicKey[] = "public key"; 33 const char kRemoteDevicePublicKey[] = "public key";
33 const char kRemoteDeviceBluetoothAddress[] = "AA:BB:CC:DD:EE:FF"; 34 const char kRemoteDeviceBluetoothAddress[] = "AA:BB:CC:DD:EE:FF";
34 const char kRemoteDevicePSK[] = "remote device psk"; 35 const char kRemoteDevicePSK[] = "remote device psk";
35 36
36 class StubSecureContext : public SecureContext { 37 class StubSecureContext : public SecureContext {
37 public: 38 public:
38 StubSecureContext() {} 39 StubSecureContext() {}
39 ~StubSecureContext() override {} 40 ~StubSecureContext() override {}
40 41
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 DISALLOW_COPY_AND_ASSIGN(TestableRemoteDeviceLifeCycleImpl); 148 DISALLOW_COPY_AND_ASSIGN(TestableRemoteDeviceLifeCycleImpl);
148 }; 149 };
149 150
150 } // namespace 151 } // namespace
151 152
152 class ProximityAuthRemoteDeviceLifeCycleImplTest 153 class ProximityAuthRemoteDeviceLifeCycleImplTest
153 : public testing::Test, 154 : public testing::Test,
154 public RemoteDeviceLifeCycle::Observer { 155 public RemoteDeviceLifeCycle::Observer {
155 protected: 156 protected:
156 ProximityAuthRemoteDeviceLifeCycleImplTest() 157 ProximityAuthRemoteDeviceLifeCycleImplTest()
157 : life_cycle_(RemoteDevice(kRemoteDeviceName, 158 : life_cycle_(RemoteDevice(kRemoteDeviceUserId,
159 kRemoteDeviceName,
158 kRemoteDevicePublicKey, 160 kRemoteDevicePublicKey,
159 kRemoteDeviceBluetoothAddress, 161 kRemoteDeviceBluetoothAddress,
160 kRemoteDevicePSK)), 162 kRemoteDevicePSK)),
161 task_runner_(new base::TestSimpleTaskRunner()), 163 task_runner_(new base::TestSimpleTaskRunner()),
162 thread_task_runner_handle_(task_runner_) {} 164 thread_task_runner_handle_(task_runner_) {}
163 165
164 ~ProximityAuthRemoteDeviceLifeCycleImplTest() override { 166 ~ProximityAuthRemoteDeviceLifeCycleImplTest() override {
165 life_cycle_.RemoveObserver(this); 167 life_cycle_.RemoveObserver(this);
166 } 168 }
167 169
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 288
287 // Authentication succeeds on second pass. 289 // Authentication succeeds on second pass.
288 Connection* connection = OnConnectionFound(); 290 Connection* connection = OnConnectionFound();
289 Authenticate(Authenticator::Result::SUCCESS); 291 Authenticate(Authenticator::Result::SUCCESS);
290 EXPECT_TRUE(life_cycle_.GetMessenger()); 292 EXPECT_TRUE(life_cycle_.GetMessenger());
291 EXPECT_CALL(*this, OnLifeCycleStateChanged(_, _)); 293 EXPECT_CALL(*this, OnLifeCycleStateChanged(_, _));
292 connection->Disconnect(); 294 connection->Disconnect();
293 } 295 }
294 296
295 } // namespace proximity_auth 297 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698