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

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: Addressing DEPS issues 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 bool started_; 112 bool started_;
113 bool stopped_; 113 bool stopped_;
114 114
115 DISALLOW_COPY_AND_ASSIGN(MockProximityMonitor); 115 DISALLOW_COPY_AND_ASSIGN(MockProximityMonitor);
116 }; 116 };
117 117
118 class TestUnlockManager : public UnlockManagerImpl { 118 class TestUnlockManager : public UnlockManagerImpl {
119 public: 119 public:
120 TestUnlockManager(ProximityAuthSystem::ScreenlockType screenlock_type, 120 TestUnlockManager(ProximityAuthSystem::ScreenlockType screenlock_type,
121 ProximityAuthClient* proximity_auth_client) 121 ProximityAuthClient* proximity_auth_client)
122 : UnlockManagerImpl(screenlock_type, proximity_auth_client), 122 : UnlockManagerImpl(screenlock_type, proximity_auth_client, nullptr),
123 proximity_monitor_(nullptr) {} 123 proximity_monitor_(nullptr) {}
124 ~TestUnlockManager() override {} 124 ~TestUnlockManager() override {}
125 125
126 using UnlockManager::OnAuthAttempted; 126 using UnlockManager::OnAuthAttempted;
127 using MessengerObserver::OnUnlockEventSent; 127 using MessengerObserver::OnUnlockEventSent;
128 using MessengerObserver::OnRemoteStatusUpdate; 128 using MessengerObserver::OnRemoteStatusUpdate;
129 using MessengerObserver::OnDecryptResponse; 129 using MessengerObserver::OnDecryptResponse;
130 using MessengerObserver::OnUnlockResponse; 130 using MessengerObserver::OnUnlockResponse;
131 using MessengerObserver::OnDisconnected; 131 using MessengerObserver::OnDisconnected;
132 using ScreenlockBridge::Observer::OnScreenDidLock; 132 using ScreenlockBridge::Observer::OnScreenDidLock;
133 using ScreenlockBridge::Observer::OnScreenDidUnlock; 133 using ScreenlockBridge::Observer::OnScreenDidUnlock;
134 using ScreenlockBridge::Observer::OnFocusedUserChanged; 134 using ScreenlockBridge::Observer::OnFocusedUserChanged;
135 135
136 MockProximityMonitor* proximity_monitor() { return proximity_monitor_; } 136 MockProximityMonitor* proximity_monitor() { return proximity_monitor_; }
137 137
138 private: 138 private:
139 std::unique_ptr<ProximityMonitor> CreateProximityMonitor( 139 std::unique_ptr<ProximityMonitor> CreateProximityMonitor(
140 cryptauth::Connection* connection) override { 140 cryptauth::Connection* connection,
141 ProximityAuthPrefManager* pref_manager) override {
141 EXPECT_EQ(cryptauth::kTestRemoteDevicePublicKey, 142 EXPECT_EQ(cryptauth::kTestRemoteDevicePublicKey,
142 connection->remote_device().public_key); 143 connection->remote_device().public_key);
143 std::unique_ptr<MockProximityMonitor> proximity_monitor( 144 std::unique_ptr<MockProximityMonitor> proximity_monitor(
144 new NiceMock<MockProximityMonitor>()); 145 new NiceMock<MockProximityMonitor>());
145 proximity_monitor_ = proximity_monitor.get(); 146 proximity_monitor_ = proximity_monitor.get();
146 return std::move(proximity_monitor); 147 return std::move(proximity_monitor);
147 } 148 }
148 149
149 // Owned by the super class. 150 // Owned by the super class.
150 MockProximityMonitor* proximity_monitor_; 151 MockProximityMonitor* proximity_monitor_;
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 })); 844 }));
844 845
845 EXPECT_CALL(messenger_, RequestDecryption(kChallenge)); 846 EXPECT_CALL(messenger_, RequestDecryption(kChallenge));
846 unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); 847 unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK);
847 848
848 EXPECT_CALL(proximity_auth_client_, FinalizeSignin(std::string())); 849 EXPECT_CALL(proximity_auth_client_, FinalizeSignin(std::string()));
849 unlock_manager_->OnDecryptResponse(std::string()); 850 unlock_manager_->OnDecryptResponse(std::string());
850 } 851 }
851 852
852 } // namespace proximity_auth 853 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698