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

Side by Side Diff: components/proximity_auth/ble/bluetooth_low_energy_connection_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/ble/bluetooth_low_energy_connection.h" 5 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 19 matching lines...) Expand all
30 using testing::_; 30 using testing::_;
31 using testing::AtLeast; 31 using testing::AtLeast;
32 using testing::NiceMock; 32 using testing::NiceMock;
33 using testing::Return; 33 using testing::Return;
34 using testing::StrictMock; 34 using testing::StrictMock;
35 using testing::SaveArg; 35 using testing::SaveArg;
36 36
37 namespace proximity_auth { 37 namespace proximity_auth {
38 namespace { 38 namespace {
39 39
40 const char kDeviceUserId[] = "example@gmail.com";
40 const char kDeviceName[] = "Device name"; 41 const char kDeviceName[] = "Device name";
41 const char kPublicKey[] = "Public key"; 42 const char kPublicKey[] = "Public key";
42 const char kBluetoothAddress[] = "11:22:33:44:55:66"; 43 const char kBluetoothAddress[] = "11:22:33:44:55:66";
43 const char kPersistentSymmetricKey[] = "PSK"; 44 const char kPersistentSymmetricKey[] = "PSK";
44 45
45 const char kServiceUUID[] = "DEADBEEF-CAFE-FEED-FOOD-D15EA5EBEEEF"; 46 const char kServiceUUID[] = "DEADBEEF-CAFE-FEED-FOOD-D15EA5EBEEEF";
46 const char kToPeripheralCharUUID[] = "977c6674-1239-4e72-993b-502369b8bb5a"; 47 const char kToPeripheralCharUUID[] = "977c6674-1239-4e72-993b-502369b8bb5a";
47 const char kFromPeripheralCharUUID[] = "f4b904a2-a030-43b3-98a8-221c536c03cb"; 48 const char kFromPeripheralCharUUID[] = "f4b904a2-a030-43b3-98a8-221c536c03cb";
48 49
49 const char kServiceID[] = "service id"; 50 const char kServiceID[] = "service id";
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 private: 120 private:
120 DISALLOW_COPY_AND_ASSIGN(MockBluetoothLowEnergyConnection); 121 DISALLOW_COPY_AND_ASSIGN(MockBluetoothLowEnergyConnection);
121 }; 122 };
122 123
123 } // namespace 124 } // namespace
124 125
125 class ProximityAuthBluetoothLowEnergyConnectionTest : public testing::Test { 126 class ProximityAuthBluetoothLowEnergyConnectionTest : public testing::Test {
126 public: 127 public:
127 ProximityAuthBluetoothLowEnergyConnectionTest() 128 ProximityAuthBluetoothLowEnergyConnectionTest()
128 : adapter_(new NiceMock<device::MockBluetoothAdapter>), 129 : adapter_(new NiceMock<device::MockBluetoothAdapter>),
129 remote_device_(kDeviceName, 130 remote_device_(kDeviceUserId,
131 kDeviceName,
130 kPublicKey, 132 kPublicKey,
131 kBluetoothAddress, 133 kBluetoothAddress,
132 kPersistentSymmetricKey), 134 kPersistentSymmetricKey),
133 service_uuid_(device::BluetoothUUID(kServiceUUID)), 135 service_uuid_(device::BluetoothUUID(kServiceUUID)),
134 to_peripheral_char_uuid_(device::BluetoothUUID(kToPeripheralCharUUID)), 136 to_peripheral_char_uuid_(device::BluetoothUUID(kToPeripheralCharUUID)),
135 from_peripheral_char_uuid_( 137 from_peripheral_char_uuid_(
136 device::BluetoothUUID(kFromPeripheralCharUUID)), 138 device::BluetoothUUID(kFromPeripheralCharUUID)),
137 notify_session_alias_(NULL), 139 notify_session_alias_(NULL),
138 bluetooth_throttler_(new NiceMock<MockBluetoothThrottler>), 140 bluetooth_throttler_(new NiceMock<MockBluetoothThrottler>),
139 task_runner_(new base::TestSimpleTaskRunner) {} 141 task_runner_(new base::TestSimpleTaskRunner) {}
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 create_gatt_connection_success_callback_.Run( 678 create_gatt_connection_success_callback_.Run(
677 make_scoped_ptr(new NiceMock<device::MockBluetoothGattConnection>( 679 make_scoped_ptr(new NiceMock<device::MockBluetoothGattConnection>(
678 adapter_, kBluetoothAddress))); 680 adapter_, kBluetoothAddress)));
679 681
680 CharacteristicsFound(connection.get()); 682 CharacteristicsFound(connection.get());
681 NotifySessionStarted(connection.get()); 683 NotifySessionStarted(connection.get());
682 ResponseSignalReceived(connection.get()); 684 ResponseSignalReceived(connection.get());
683 } 685 }
684 686
685 } // namespace proximity_auth 687 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698