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

Unified Diff: components/proximity_auth/unlock_manager_unittest.cc

Issue 1377313002: Revert of Hook up ProximityAuthSystem in EasyUnlockService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_connection
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/proximity_auth/unlock_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/proximity_auth/unlock_manager_unittest.cc
diff --git a/components/proximity_auth/unlock_manager_unittest.cc b/components/proximity_auth/unlock_manager_unittest.cc
index 6a134bd65c1b9bb46fd370b33f247390f30acae9..56e71a70948811f3ff40025b5b57d3a4190e7e08 100644
--- a/components/proximity_auth/unlock_manager_unittest.cc
+++ b/components/proximity_auth/unlock_manager_unittest.cc
@@ -89,8 +89,6 @@
MOCK_CONST_METHOD0(IsUnlockAllowed, bool());
MOCK_CONST_METHOD0(IsInRssiRange, bool());
MOCK_METHOD0(RecordProximityMetricsOnAuthSuccess, void());
- MOCK_METHOD1(AddObserver, void(ProximityMonitorObserver*));
- MOCK_METHOD1(RemoveObserver, void(ProximityMonitorObserver*));
private:
DISALLOW_COPY_AND_ASSIGN(MockProximityMonitor);
@@ -465,11 +463,12 @@
CreateUnlockManager(UnlockManager::ScreenlockType::SESSION_LOCK);
SimulateUserPresentState();
- ON_CALL(life_cycle_, GetState())
+ NiceMock<MockRemoteDeviceLifeCycle> life_cycle;
+ ON_CALL(life_cycle, GetState())
.WillByDefault(Return(RemoteDeviceLifeCycle::State::FINDING_CONNECTION));
EXPECT_CALL(*proximity_monitor_, Stop()).Times(AtLeast(1));
- unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
+ unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle);
}
TEST_F(
@@ -478,18 +477,25 @@
CreateUnlockManager(UnlockManager::ScreenlockType::SESSION_LOCK);
SimulateUserPresentState();
- ON_CALL(life_cycle_, GetState())
+ NiceMock<MockRemoteDeviceLifeCycle> life_cycle;
+ ON_CALL(life_cycle, GetState())
.WillByDefault(
Return(RemoteDeviceLifeCycle::State::SECURE_CHANNEL_ESTABLISHED));
EXPECT_CALL(*proximity_monitor_, Start()).Times(AtLeast(1));
- unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
+ unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle);
}
TEST_F(ProximityAuthUnlockManagerTest,
OnLifeCycleStateChanged_SecureChannelEstablished_RegistersAsObserver) {
CreateUnlockManager(UnlockManager::ScreenlockType::SESSION_LOCK);
SimulateUserPresentState();
+
+ NiceMock<MockRemoteDeviceLifeCycle> life_cycle;
+ ON_CALL(life_cycle, GetState())
+ .WillByDefault(
+ Return(RemoteDeviceLifeCycle::State::SECURE_CHANNEL_ESTABLISHED));
+
EXPECT_CALL(messenger_, AddObserver(unlock_manager_.get()));
unlock_manager_->OnLifeCycleStateChanged();
}
@@ -498,6 +504,12 @@
OnLifeCycleStateChanged_StartsProximityMonitor) {
CreateUnlockManager(UnlockManager::ScreenlockType::SESSION_LOCK);
SimulateUserPresentState();
+
+ NiceMock<MockRemoteDeviceLifeCycle> life_cycle;
+ ON_CALL(life_cycle, GetState())
+ .WillByDefault(
+ Return(RemoteDeviceLifeCycle::State::SECURE_CHANNEL_ESTABLISHED));
+
EXPECT_CALL(*proximity_monitor_, Start()).Times(AtLeast(1));
unlock_manager_->OnLifeCycleStateChanged();
}
@@ -600,10 +612,8 @@
.WillByDefault(
Return(RemoteDeviceLifeCycle::State::AUTHENTICATION_FAILED));
- EXPECT_CALL(messenger_, RemoveObserver(unlock_manager_.get()))
- .Times(testing::AtLeast(1));
+ EXPECT_CALL(messenger_, RemoveObserver(unlock_manager_.get()));
unlock_manager_.get()->OnDisconnected();
- unlock_manager_->SetRemoteDeviceLifeCycle(nullptr);
}
TEST_F(ProximityAuthUnlockManagerTest,
« no previous file with comments | « components/proximity_auth/unlock_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698