Implement finding BLE connections in chrome://proximity-auth.
[chromium-blink-merge.git] / components / proximity_auth / proximity_auth_system_unittest.cc
blob45d17dbf7d690d12418d138926911cde5156500e
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/proximity_auth/proximity_auth_system.h"
6 #include "components/proximity_auth/remote_device.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace proximity_auth {
11 TEST(ProximityAuthSystemTest, GetRemoteDevices) {
12 RemoteDevice device1("device1", "public_key1", "bt_addr1", "psk1");
13 RemoteDevice device2("device2", "public_key2", "bt_addr2", "psk2");
15 std::vector<RemoteDevice> device_list;
16 device_list.push_back(device1);
17 device_list.push_back(device2);
19 ProximityAuthSystem system(device_list);
21 const std::vector<RemoteDevice>& returned_list = system.GetRemoteDevices();
22 ASSERT_EQ(2u, returned_list.size());
23 EXPECT_EQ(device1.name, returned_list[0].name);
24 EXPECT_EQ(device1.public_key, returned_list[0].public_key);
25 EXPECT_EQ(device2.name, returned_list[1].name);
26 EXPECT_EQ(device2.public_key, returned_list[1].public_key);
29 } // namespace proximity_auth