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

Side by Side Diff: components/proximity_auth/proximity_auth_system_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: move RemoteDevice creation in tests to util function 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 2014 The Chromium Authors. All rights reserved. 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 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/proximity_auth_system.h" 5 #include "components/proximity_auth/proximity_auth_system.h"
6 #include "components/proximity_auth/remote_device.h" 6 #include "components/proximity_auth/remote_device.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace proximity_auth { 9 namespace proximity_auth {
10 10
11 TEST(ProximityAuthSystemTest, GetRemoteDevices) { 11 TEST(ProximityAuthSystemTest, GetRemoteDevices) {
12 RemoteDevice device1("device1", "public_key1", "bt_addr1", "psk1"); 12 RemoteDevice device1("example@gmail.com", "device1", "public_key1",
13 RemoteDevice device2("device2", "public_key2", "bt_addr2", "psk2"); 13 RemoteDevice::BLUETOOTH_CLASSIC, "bt_addr1", "psk1", "");
14 RemoteDevice device2("example@gmail.com", "device2", "public_key2",
15 RemoteDevice::BLUETOOTH_LE, "bt_addr2", "psk2", "");
14 16
15 std::vector<RemoteDevice> device_list; 17 std::vector<RemoteDevice> device_list;
16 device_list.push_back(device1); 18 device_list.push_back(device1);
17 device_list.push_back(device2); 19 device_list.push_back(device2);
18 20
19 ProximityAuthSystem system(device_list); 21 ProximityAuthSystem system(device_list);
20 22
21 const std::vector<RemoteDevice>& returned_list = system.GetRemoteDevices(); 23 const std::vector<RemoteDevice>& returned_list = system.GetRemoteDevices();
22 ASSERT_EQ(2u, returned_list.size()); 24 ASSERT_EQ(2u, returned_list.size());
23 EXPECT_EQ(device1.name, returned_list[0].name); 25 EXPECT_EQ(device1.name, returned_list[0].name);
24 EXPECT_EQ(device1.public_key, returned_list[0].public_key); 26 EXPECT_EQ(device1.public_key, returned_list[0].public_key);
25 EXPECT_EQ(device2.name, returned_list[1].name); 27 EXPECT_EQ(device2.name, returned_list[1].name);
26 EXPECT_EQ(device2.public_key, returned_list[1].public_key); 28 EXPECT_EQ(device2.public_key, returned_list[1].public_key);
27 } 29 }
28 30
29 } // namespace proximity_auth 31 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698