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

Side by Side Diff: chromeos/components/tether/tether_host_fetcher_unittest.cc

Issue 2897843002: Revert of [EasyUnlock] Add beacon_seeds to RemoteDevice. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « chromeos/components/tether/tether_host_fetcher.cc ('k') | components/cryptauth/remote_device.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chromeos/components/tether/tether_host_fetcher.h" 5 #include "chromeos/components/tether/tether_host_fetcher.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 class MockDeviceLoader : public cryptauth::RemoteDeviceLoader { 85 class MockDeviceLoader : public cryptauth::RemoteDeviceLoader {
86 public: 86 public:
87 MockDeviceLoader() 87 MockDeviceLoader()
88 : cryptauth::RemoteDeviceLoader( 88 : cryptauth::RemoteDeviceLoader(
89 std::vector<cryptauth::ExternalDeviceInfo>(), 89 std::vector<cryptauth::ExternalDeviceInfo>(),
90 "", 90 "",
91 "", 91 "",
92 nullptr) {} 92 nullptr) {}
93 ~MockDeviceLoader() override {} 93 ~MockDeviceLoader() override {}
94 94
95 MOCK_METHOD2( 95 MOCK_METHOD1(
96 Load, 96 Load,
97 void(bool, const cryptauth::RemoteDeviceLoader::RemoteDeviceCallback&)); 97 void(const cryptauth::RemoteDeviceLoader::RemoteDeviceCallback&));
98 }; 98 };
99 99
100 std::vector<cryptauth::ExternalDeviceInfo> 100 std::vector<cryptauth::ExternalDeviceInfo>
101 CreateTetherExternalDeviceInfosForRemoteDevices( 101 CreateTetherExternalDeviceInfosForRemoteDevices(
102 const std::vector<cryptauth::RemoteDevice> remote_devices) { 102 const std::vector<cryptauth::RemoteDevice> remote_devices) {
103 std::vector<cryptauth::ExternalDeviceInfo> device_infos; 103 std::vector<cryptauth::ExternalDeviceInfo> device_infos;
104 for (const auto& remote_device : remote_devices) { 104 for (const auto& remote_device : remote_devices) {
105 // Add an ExternalDeviceInfo with the same public key as the RemoteDevice. 105 // Add an ExternalDeviceInfo with the same public key as the RemoteDevice.
106 cryptauth::ExternalDeviceInfo info; 106 cryptauth::ExternalDeviceInfo info;
107 info.set_public_key(remote_device.public_key); 107 info.set_public_key(remote_device.public_key);
(...skipping 21 matching lines...) Expand all
129 EXPECT_EQ(test_->test_device_infos_.size(), device_info_list.size()); 129 EXPECT_EQ(test_->test_device_infos_.size(), device_info_list.size());
130 EXPECT_EQ(std::string(kTestUserId), user_id); 130 EXPECT_EQ(std::string(kTestUserId), user_id);
131 EXPECT_EQ(std::string(kTestUserPrivateKey), user_private_key); 131 EXPECT_EQ(std::string(kTestUserPrivateKey), user_private_key);
132 test_->fake_cryptauth_service_ 132 test_->fake_cryptauth_service_
133 ->VerifySecureMessageDelegateCreatedByFactory( 133 ->VerifySecureMessageDelegateCreatedByFactory(
134 static_cast<cryptauth::FakeSecureMessageDelegate*>( 134 static_cast<cryptauth::FakeSecureMessageDelegate*>(
135 secure_message_delegate.get())); 135 secure_message_delegate.get()));
136 136
137 std::unique_ptr<MockDeviceLoader> device_loader = 137 std::unique_ptr<MockDeviceLoader> device_loader =
138 base::WrapUnique(new NiceMock<MockDeviceLoader>()); 138 base::WrapUnique(new NiceMock<MockDeviceLoader>());
139 ON_CALL(*device_loader, Load(false, _)) 139 ON_CALL(*device_loader, Load(_))
140 .WillByDefault( 140 .WillByDefault(
141 Invoke(this, &TestRemoteDeviceLoaderFactory::MockLoadImpl)); 141 Invoke(this, &TestRemoteDeviceLoaderFactory::MockLoadImpl));
142 return std::move(device_loader); 142 return std::move(device_loader);
143 } 143 }
144 144
145 void MockLoadImpl( 145 void MockLoadImpl(
146 bool should_load_beacon_seeds,
147 const cryptauth::RemoteDeviceLoader::RemoteDeviceCallback& callback) { 146 const cryptauth::RemoteDeviceLoader::RemoteDeviceCallback& callback) {
148 callback_ = callback; 147 callback_ = callback;
149 } 148 }
150 149
151 void InvokeLastCallback() { 150 void InvokeLastCallback() {
152 DCHECK(!callback_.is_null()); 151 DCHECK(!callback_.is_null());
153 callback_.Run(test_->test_devices_); 152 callback_.Run(test_->test_devices_);
154 } 153 }
155 154
156 private: 155 private:
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 EXPECT_EQ(1u, device_list_list_.size()); 297 EXPECT_EQ(1u, device_list_list_.size());
299 EXPECT_EQ(test_devices_, device_list_list_[0]); 298 EXPECT_EQ(test_devices_, device_list_list_[0]);
300 EXPECT_EQ(2u, single_device_list_.size()); 299 EXPECT_EQ(2u, single_device_list_.size());
301 EXPECT_EQ(test_devices_[0], *single_device_list_[0]); 300 EXPECT_EQ(test_devices_[0], *single_device_list_[0]);
302 EXPECT_EQ(nullptr, single_device_list_[1]); 301 EXPECT_EQ(nullptr, single_device_list_[1]);
303 } 302 }
304 303
305 } // namespace tether 304 } // namespace tether
306 305
307 } // namespace chromeos 306 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/components/tether/tether_host_fetcher.cc ('k') | components/cryptauth/remote_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698