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

Side by Side Diff: components/proximity_auth/ble/bluetooth_low_energy_connection_finder_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, 3 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_finder.h " 5 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h "
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 18 matching lines...) Expand all
29 using testing::_; 29 using testing::_;
30 using testing::AtLeast; 30 using testing::AtLeast;
31 using testing::NiceMock; 31 using testing::NiceMock;
32 using testing::Return; 32 using testing::Return;
33 using testing::StrictMock; 33 using testing::StrictMock;
34 using testing::SaveArg; 34 using testing::SaveArg;
35 35
36 namespace proximity_auth { 36 namespace proximity_auth {
37 namespace { 37 namespace {
38 38
39 const char kDeviceUserId[] = "example@gmail.com";
39 const char kDeviceName[] = "Device name"; 40 const char kDeviceName[] = "Device name";
40 const char kPublicKey[] = "Public key"; 41 const char kPublicKey[] = "Public key";
41 const char kBluetoothAddress[] = "11:22:33:44:55:66"; 42 const char kBluetoothAddress[] = "11:22:33:44:55:66";
42 const char kPersistentSymmetricKey[] = "PSK"; 43 const char kPersistentSymmetricKey[] = "PSK";
43 44
44 const char kServiceUUID[] = "DEADBEEF-CAFE-FEED-FOOD-D15EA5EBEEEF"; 45 const char kServiceUUID[] = "DEADBEEF-CAFE-FEED-FOOD-D15EA5EBEEEF";
45 const char kOtherUUID[] = "AAAAAAAA-AAAA-AAAA-AAAA-D15EA5EBEEEF"; 46 const char kOtherUUID[] = "AAAAAAAA-AAAA-AAAA-AAAA-D15EA5EBEEEF";
46 47
47 const int kMaxNumberOfAttempts = 2; 48 const int kMaxNumberOfAttempts = 2;
48 49
49 RemoteDevice CreateRemoteDevice() { 50 RemoteDevice CreateRemoteDevice() {
50 return RemoteDevice(kDeviceName, kPublicKey, kBluetoothAddress, 51 return RemoteDevice(kDeviceUserId, kDeviceName, kPublicKey, kBluetoothAddress,
51 kPersistentSymmetricKey); 52 kPersistentSymmetricKey);
52 } 53 }
53 54
54 class MockBluetoothLowEnergyDeviceWhitelist 55 class MockBluetoothLowEnergyDeviceWhitelist
55 : public BluetoothLowEnergyDeviceWhitelist { 56 : public BluetoothLowEnergyDeviceWhitelist {
56 public: 57 public:
57 MockBluetoothLowEnergyDeviceWhitelist() 58 MockBluetoothLowEnergyDeviceWhitelist()
58 : BluetoothLowEnergyDeviceWhitelist(nullptr) {} 59 : BluetoothLowEnergyDeviceWhitelist(nullptr) {}
59 ~MockBluetoothLowEnergyDeviceWhitelist() override {} 60 ~MockBluetoothLowEnergyDeviceWhitelist() override {}
60 61
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 // Completing the connection. 495 // Completing the connection.
495 base::RunLoop run_loop; 496 base::RunLoop run_loop;
496 ASSERT_FALSE(last_found_connection_); 497 ASSERT_FALSE(last_found_connection_);
497 connection->SetStatus(Connection::IN_PROGRESS); 498 connection->SetStatus(Connection::IN_PROGRESS);
498 connection->SetStatus(Connection::CONNECTED); 499 connection->SetStatus(Connection::CONNECTED);
499 run_loop.RunUntilIdle(); 500 run_loop.RunUntilIdle();
500 EXPECT_TRUE(last_found_connection_); 501 EXPECT_TRUE(last_found_connection_);
501 } 502 }
502 503
503 } // namespace proximity_auth 504 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698