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

Side by Side Diff: components/proximity_auth/unlock_manager_impl_unittest.cc

Issue 2973243002: Adding pref to store the user-selected proximity threshold. (Closed)
Patch Set: Fixing tests Created 3 years, 5 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/unlock_manager_impl.h" 5 #include "components/proximity_auth/unlock_manager_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 22 matching lines...) Expand all
33 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
34 #include "chromeos/dbus/dbus_thread_manager.h" 34 #include "chromeos/dbus/dbus_thread_manager.h"
35 #endif // defined(OS_CHROMEOS) 35 #endif // defined(OS_CHROMEOS)
36 36
37 using testing::AtLeast; 37 using testing::AtLeast;
38 using testing::Invoke; 38 using testing::Invoke;
39 using testing::NiceMock; 39 using testing::NiceMock;
40 using testing::Return; 40 using testing::Return;
41 using testing::_; 41 using testing::_;
42 42
43 class PrefService;
44
43 namespace proximity_auth { 45 namespace proximity_auth {
44 namespace { 46 namespace {
45 47
46 // The sign-in challenge to send to the remote device. 48 // The sign-in challenge to send to the remote device.
47 const char kChallenge[] = "sign-in challenge"; 49 const char kChallenge[] = "sign-in challenge";
48 const char kSignInSecret[] = "decrypted challenge"; 50 const char kSignInSecret[] = "decrypted challenge";
49 51
50 // Note that the trust agent state is currently ignored by the UnlockManager 52 // Note that the trust agent state is currently ignored by the UnlockManager
51 // implementation. 53 // implementation.
52 RemoteStatusUpdate kRemoteScreenUnlocked = { 54 RemoteStatusUpdate kRemoteScreenUnlocked = {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 using MessengerObserver::OnUnlockResponse; 132 using MessengerObserver::OnUnlockResponse;
131 using MessengerObserver::OnDisconnected; 133 using MessengerObserver::OnDisconnected;
132 using ScreenlockBridge::Observer::OnScreenDidLock; 134 using ScreenlockBridge::Observer::OnScreenDidLock;
133 using ScreenlockBridge::Observer::OnScreenDidUnlock; 135 using ScreenlockBridge::Observer::OnScreenDidUnlock;
134 using ScreenlockBridge::Observer::OnFocusedUserChanged; 136 using ScreenlockBridge::Observer::OnFocusedUserChanged;
135 137
136 MockProximityMonitor* proximity_monitor() { return proximity_monitor_; } 138 MockProximityMonitor* proximity_monitor() { return proximity_monitor_; }
137 139
138 private: 140 private:
139 std::unique_ptr<ProximityMonitor> CreateProximityMonitor( 141 std::unique_ptr<ProximityMonitor> CreateProximityMonitor(
140 cryptauth::Connection* connection) override { 142 cryptauth::Connection* connection,
143 PrefService* pref_service) override {
141 EXPECT_EQ(cryptauth::kTestRemoteDevicePublicKey, 144 EXPECT_EQ(cryptauth::kTestRemoteDevicePublicKey,
142 connection->remote_device().public_key); 145 connection->remote_device().public_key);
143 std::unique_ptr<MockProximityMonitor> proximity_monitor( 146 std::unique_ptr<MockProximityMonitor> proximity_monitor(
144 new NiceMock<MockProximityMonitor>()); 147 new NiceMock<MockProximityMonitor>());
145 proximity_monitor_ = proximity_monitor.get(); 148 proximity_monitor_ = proximity_monitor.get();
146 return std::move(proximity_monitor); 149 return std::move(proximity_monitor);
147 } 150 }
148 151
149 // Owned by the super class. 152 // Owned by the super class.
150 MockProximityMonitor* proximity_monitor_; 153 MockProximityMonitor* proximity_monitor_;
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 })); 846 }));
844 847
845 EXPECT_CALL(messenger_, RequestDecryption(kChallenge)); 848 EXPECT_CALL(messenger_, RequestDecryption(kChallenge));
846 unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); 849 unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK);
847 850
848 EXPECT_CALL(proximity_auth_client_, FinalizeSignin(std::string())); 851 EXPECT_CALL(proximity_auth_client_, FinalizeSignin(std::string()));
849 unlock_manager_->OnDecryptResponse(std::string()); 852 unlock_manager_->OnDecryptResponse(std::string());
850 } 853 }
851 854
852 } // namespace proximity_auth 855 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698