| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |