OLD | NEW |
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 Loading... |
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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 })); | 864 })); |
864 | 865 |
865 EXPECT_CALL(messenger_, RequestDecryption(kChallenge)); | 866 EXPECT_CALL(messenger_, RequestDecryption(kChallenge)); |
866 unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); | 867 unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); |
867 | 868 |
868 EXPECT_CALL(proximity_auth_client_, FinalizeSignin(std::string())); | 869 EXPECT_CALL(proximity_auth_client_, FinalizeSignin(std::string())); |
869 unlock_manager_->OnDecryptResponse(std::string()); | 870 unlock_manager_->OnDecryptResponse(std::string()); |
870 } | 871 } |
871 | 872 |
872 } // namespace proximity_auth | 873 } // namespace proximity_auth |
OLD | NEW |