Commit e8c807e7 authored by James Hawkins's avatar James Hawkins Committed by Commit Bot

Proximity Auth: Remove kEnableUnifiedMultiDeviceSetup flagging.

R=hansberry@chromium.org

Bug: 899324
Test: none
Change-Id: I45d7f04e97a914596cd1bffd5e2ea73543064810
Reviewed-on: https://chromium-review.googlesource.com/c/1329889
Commit-Queue: James Hawkins <jhawkins@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607051}
parent 64c5351d
......@@ -27,21 +27,15 @@ ProximityAuthProfilePrefManager::ProximityAuthProfilePrefManager(
: pref_service_(pref_service),
multidevice_setup_client_(multidevice_setup_client),
weak_ptr_factory_(this) {
if (base::FeatureList::IsEnabled(
chromeos::features::kEnableUnifiedMultiDeviceSetup)) {
OnFeatureStatesChanged(multidevice_setup_client_->GetFeatureStates());
OnFeatureStatesChanged(multidevice_setup_client_->GetFeatureStates());
multidevice_setup_client_->AddObserver(this);
}
multidevice_setup_client_->AddObserver(this);
}
ProximityAuthProfilePrefManager::~ProximityAuthProfilePrefManager() {
registrar_.RemoveAll();
if (base::FeatureList::IsEnabled(
chromeos::features::kEnableUnifiedMultiDeviceSetup)) {
multidevice_setup_client_->RemoveObserver(this);
}
multidevice_setup_client_->RemoveObserver(this);
}
// static
......@@ -128,9 +122,7 @@ void ProximityAuthProfilePrefManager::SetIsEasyUnlockEnabled(
}
bool ProximityAuthProfilePrefManager::IsEasyUnlockEnabled() const {
if (base::FeatureList::IsEnabled(
chromeos::features::kEnableUnifiedMultiDeviceSetup) &&
!is_in_legacy_host_mode_) {
if (!is_in_legacy_host_mode_) {
return feature_state_ ==
chromeos::multidevice_setup::mojom::FeatureState::kEnabledByUser;
}
......
......@@ -14,6 +14,7 @@
#include "chromeos/chromeos_features.h"
#include "chromeos/components/proximity_auth/proximity_auth_local_state_pref_manager.h"
#include "chromeos/components/proximity_auth/proximity_auth_pref_names.h"
#include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h"
#include "chromeos/services/multidevice_setup/public/cpp/prefs.h"
#include "components/prefs/testing_pref_service.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
......@@ -37,96 +38,91 @@ const ProximityAuthPrefManager::ProximityThreshold kProximityThreshold2 =
class ProximityAuthProfilePrefManagerTest : public testing::Test {
protected:
ProximityAuthProfilePrefManagerTest() {}
ProximityAuthProfilePrefManagerTest() = default;
void SetUp() override {
fake_multidevice_setup_client_ = std::make_unique<
chromeos::multidevice_setup::FakeMultiDeviceSetupClient>();
ProximityAuthProfilePrefManager::RegisterPrefs(pref_service_.registry());
chromeos::multidevice_setup::RegisterFeaturePrefs(pref_service_.registry());
scoped_feature_list_.InitWithFeatures(
std::vector<base::Feature>() /* enable_features */,
std::vector<base::Feature>{
chromeos::features::
kEnableUnifiedMultiDeviceSetup} /* disable_features */);
pref_manager_ = std::make_unique<ProximityAuthProfilePrefManager>(
&pref_service_, fake_multidevice_setup_client_.get());
}
std::unique_ptr<chromeos::multidevice_setup::FakeMultiDeviceSetupClient>
fake_multidevice_setup_client_;
sync_preferences::TestingPrefServiceSyncable pref_service_;
std::unique_ptr<ProximityAuthProfilePrefManager> pref_manager_;
private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(ProximityAuthProfilePrefManagerTest);
};
// TODO(crbug/904005): Investigate using Unified Setup API instead of directly
// manipulating the pref.
TEST_F(ProximityAuthProfilePrefManagerTest, IsEasyUnlockAllowed) {
ProximityAuthProfilePrefManager pref_manager(
&pref_service_, nullptr /* multidevice_setup_service */);
EXPECT_TRUE(pref_manager.IsEasyUnlockAllowed());
EXPECT_TRUE(pref_manager_->IsEasyUnlockAllowed());
// Simulating setting kEasyUnlockAllowed pref through enterprise policy.
pref_service_.SetBoolean(
chromeos::multidevice_setup::kSmartLockAllowedPrefName, false);
EXPECT_FALSE(pref_manager.IsEasyUnlockAllowed());
EXPECT_FALSE(pref_manager_->IsEasyUnlockAllowed());
}
TEST_F(ProximityAuthProfilePrefManagerTest, IsEasyUnlockEnabled) {
ProximityAuthProfilePrefManager pref_manager(
&pref_service_, nullptr /* multidevice_setup_service */);
EXPECT_TRUE(pref_manager.IsEasyUnlockEnabled());
pref_manager_->SetIsInLegacyHostMode(true);
EXPECT_TRUE(pref_manager_->IsEasyUnlockEnabled());
pref_manager.SetIsEasyUnlockEnabled(true);
EXPECT_TRUE(pref_manager.IsEasyUnlockEnabled());
pref_manager_->SetIsEasyUnlockEnabled(true);
EXPECT_TRUE(pref_manager_->IsEasyUnlockEnabled());
pref_manager.SetIsEasyUnlockEnabled(false);
EXPECT_FALSE(pref_manager.IsEasyUnlockEnabled());
pref_manager_->SetIsEasyUnlockEnabled(false);
EXPECT_FALSE(pref_manager_->IsEasyUnlockEnabled());
}
TEST_F(ProximityAuthProfilePrefManagerTest, LastPromotionCheckTimestamp) {
ProximityAuthProfilePrefManager pref_manager(
&pref_service_, nullptr /* multidevice_setup_service */);
EXPECT_EQ(0L, pref_manager.GetLastPromotionCheckTimestampMs());
pref_manager.SetLastPromotionCheckTimestampMs(kPromotionCheckTimestampMs1);
EXPECT_EQ(0L, pref_manager_->GetLastPromotionCheckTimestampMs());
pref_manager_->SetLastPromotionCheckTimestampMs(kPromotionCheckTimestampMs1);
EXPECT_EQ(kPromotionCheckTimestampMs1,
pref_manager.GetLastPromotionCheckTimestampMs());
pref_manager.SetLastPromotionCheckTimestampMs(kPromotionCheckTimestampMs2);
pref_manager_->GetLastPromotionCheckTimestampMs());
pref_manager_->SetLastPromotionCheckTimestampMs(kPromotionCheckTimestampMs2);
EXPECT_EQ(kPromotionCheckTimestampMs2,
pref_manager.GetLastPromotionCheckTimestampMs());
pref_manager_->GetLastPromotionCheckTimestampMs());
}
TEST_F(ProximityAuthProfilePrefManagerTest, PromotionShownCount) {
ProximityAuthProfilePrefManager pref_manager(
&pref_service_, nullptr /* multidevice_setup_service */);
EXPECT_EQ(0, pref_manager.GetPromotionShownCount());
pref_manager.SetPromotionShownCount(1);
EXPECT_EQ(1, pref_manager.GetPromotionShownCount());
pref_manager.SetPromotionShownCount(2);
EXPECT_EQ(2, pref_manager.GetPromotionShownCount());
EXPECT_EQ(0, pref_manager_->GetPromotionShownCount());
pref_manager_->SetPromotionShownCount(1);
EXPECT_EQ(1, pref_manager_->GetPromotionShownCount());
pref_manager_->SetPromotionShownCount(2);
EXPECT_EQ(2, pref_manager_->GetPromotionShownCount());
}
TEST_F(ProximityAuthProfilePrefManagerTest, ProximityThreshold) {
ProximityAuthProfilePrefManager pref_manager(
&pref_service_, nullptr /* multidevice_setup_service */);
EXPECT_EQ(1, pref_manager.GetProximityThreshold());
pref_manager.SetProximityThreshold(kProximityThreshold1);
EXPECT_EQ(kProximityThreshold1, pref_manager.GetProximityThreshold());
pref_manager.SetProximityThreshold(kProximityThreshold2);
EXPECT_EQ(kProximityThreshold2, pref_manager.GetProximityThreshold());
EXPECT_EQ(1, pref_manager_->GetProximityThreshold());
pref_manager_->SetProximityThreshold(kProximityThreshold1);
EXPECT_EQ(kProximityThreshold1, pref_manager_->GetProximityThreshold());
pref_manager_->SetProximityThreshold(kProximityThreshold2);
EXPECT_EQ(kProximityThreshold2, pref_manager_->GetProximityThreshold());
}
TEST_F(ProximityAuthProfilePrefManagerTest, IsChromeOSLoginEnabled) {
ProximityAuthProfilePrefManager pref_manager(
&pref_service_, nullptr /* multidevice_setup_service */);
EXPECT_FALSE(pref_manager.IsChromeOSLoginEnabled());
EXPECT_FALSE(pref_manager_->IsChromeOSLoginEnabled());
pref_manager.SetIsChromeOSLoginEnabled(true);
EXPECT_TRUE(pref_manager.IsChromeOSLoginEnabled());
pref_manager_->SetIsChromeOSLoginEnabled(true);
EXPECT_TRUE(pref_manager_->IsChromeOSLoginEnabled());
pref_manager.SetIsChromeOSLoginEnabled(false);
EXPECT_FALSE(pref_manager.IsChromeOSLoginEnabled());
pref_manager_->SetIsChromeOSLoginEnabled(false);
EXPECT_FALSE(pref_manager_->IsChromeOSLoginEnabled());
}
TEST_F(ProximityAuthProfilePrefManagerTest, SyncsToLocalPrefOnChange) {
// Use a local variable to ensure that the PrefRegistrar adds and removes
// observers on the same thread.
ProximityAuthProfilePrefManager profile_pref_manager(
&pref_service_, nullptr /* multidevice_setup_service */);
&pref_service_, fake_multidevice_setup_client_.get());
profile_pref_manager.SetIsInLegacyHostMode(true);
TestingPrefServiceSimple local_state;
AccountId account_id = AccountId::FromUserEmail(kUserEmail);
......
......@@ -139,9 +139,7 @@ class ProximityAuthSystemTest : public testing::Test {
pref_manager_.reset();
}
void InitializeTest(bool multidevice_flags_enabled) {
SetMultiDeviceApi(multidevice_flags_enabled /* enabled */);
void SetUp() override {
fake_multidevice_setup_client_ = std::make_unique<
chromeos::multidevice_setup::FakeMultiDeviceSetupClient>();
pref_manager_ = std::make_unique<NiceMock<MockProximityAuthPrefManager>>(
......@@ -167,17 +165,6 @@ class ProximityAuthSystemTest : public testing::Test {
LockScreen();
}
void SetMultiDeviceApi(bool enabled) {
static const std::vector<base::Feature> kFeatures{
chromeos::features::kEnableUnifiedMultiDeviceSetup};
scoped_feature_list_.InitWithFeatures(
(enabled ? kFeatures
: std::vector<base::Feature>() /* enable_features */),
(enabled ? std::vector<base::Feature>()
: kFeatures /* disable_features */));
}
void InitProximityAuthSystem(ProximityAuthSystem::ScreenlockType type) {
std::unique_ptr<MockUnlockManager> unlock_manager(
new NiceMock<MockUnlockManager>());
......@@ -239,7 +226,6 @@ class ProximityAuthSystemTest : public testing::Test {
};
TEST_F(ProximityAuthSystemTest, SetRemoteDevicesForUser_NotStarted) {
InitializeTest(false /* multidevice_flags_enabled */);
InitProximityAuthSystem(ProximityAuthSystem::SESSION_LOCK);
AccountId account1 = AccountId::FromUserEmail(kUser1);
......@@ -264,7 +250,6 @@ TEST_F(ProximityAuthSystemTest, SetRemoteDevicesForUser_NotStarted) {
}
TEST_F(ProximityAuthSystemTest, SetRemoteDevicesForUser_Started) {
InitializeTest(false /* multidevice_flags_enabled */);
InitProximityAuthSystem(ProximityAuthSystem::SESSION_LOCK);
AccountId account1 = AccountId::FromUserEmail(kUser1);
AccountId account2 = AccountId::FromUserEmail(kUser2);
......@@ -284,7 +269,6 @@ TEST_F(ProximityAuthSystemTest, SetRemoteDevicesForUser_Started) {
}
TEST_F(ProximityAuthSystemTest, FocusRegisteredUser) {
InitializeTest(false /* multidevice_flags_enabled */);
EXPECT_FALSE(life_cycle());
EXPECT_EQ(std::string(),
ScreenlockBridge::Get()->focused_account_id().GetUserEmail());
......@@ -304,7 +288,6 @@ TEST_F(ProximityAuthSystemTest, FocusRegisteredUser) {
}
TEST_F(ProximityAuthSystemTest, FocusUnregisteredUser) {
InitializeTest(false /* multidevice_flags_enabled */);
EXPECT_FALSE(life_cycle());
EXPECT_EQ(std::string(),
ScreenlockBridge::Get()->focused_account_id().GetUserEmail());
......@@ -315,35 +298,6 @@ TEST_F(ProximityAuthSystemTest, FocusUnregisteredUser) {
}
TEST_F(ProximityAuthSystemTest, ToggleFocus_RegisteredUsers) {
InitializeTest(false /* multidevice_flags_enabled */);
proximity_auth_system_->SetRemoteDevicesForUser(
AccountId::FromUserEmail(kUser2), user2_remote_devices_,
user2_local_device_);
RemoteDeviceLifeCycle* life_cycle1 = nullptr;
EXPECT_CALL(*unlock_manager_, SetRemoteDeviceLifeCycle(_))
.WillOnce(SaveArg<0>(&life_cycle1));
FocusUser(kUser1);
EXPECT_EQ(kUser1, life_cycle1->GetRemoteDevice().user_id());
RemoteDeviceLifeCycle* life_cycle2 = nullptr;
{
InSequence sequence;
EXPECT_CALL(*unlock_manager_, SetRemoteDeviceLifeCycle(nullptr))
.Times(AtLeast(1));
EXPECT_CALL(*unlock_manager_, SetRemoteDeviceLifeCycle(_))
.WillOnce(SaveArg<0>(&life_cycle2));
}
FocusUser(kUser2);
EXPECT_EQ(kUser2, life_cycle2->GetRemoteDevice().user_id());
EXPECT_CALL(*unlock_manager_, SetRemoteDeviceLifeCycle(nullptr))
.Times(AtLeast(1));
}
TEST_F(ProximityAuthSystemTest,
ToggleFocus_RegisteredUsers_MultiDeviceApiEnabled) {
InitializeTest(true /* multidevice_flags_enabled */);
proximity_auth_system_->SetRemoteDevicesForUser(
AccountId::FromUserEmail(kUser1), user1_remote_devices_,
user1_local_device_);
......@@ -375,7 +329,6 @@ TEST_F(ProximityAuthSystemTest,
}
TEST_F(ProximityAuthSystemTest, ToggleFocus_UnregisteredUsers) {
InitializeTest(false /* multidevice_flags_enabled */);
FocusUser(kUser2);
EXPECT_FALSE(life_cycle());
......@@ -387,7 +340,6 @@ TEST_F(ProximityAuthSystemTest, ToggleFocus_UnregisteredUsers) {
}
TEST_F(ProximityAuthSystemTest, ToggleFocus_RegisteredAndUnregisteredUsers) {
InitializeTest(false /* multidevice_flags_enabled */);
// Focus User 1, who is registered. This should create a new life cycle.
RemoteDeviceLifeCycle* life_cycle = nullptr;
......@@ -415,7 +367,6 @@ TEST_F(ProximityAuthSystemTest, ToggleFocus_RegisteredAndUnregisteredUsers) {
}
TEST_F(ProximityAuthSystemTest, ToggleFocus_SameUserRefocused) {
InitializeTest(false /* multidevice_flags_enabled */);
RemoteDeviceLifeCycle* life_cycle = nullptr;
EXPECT_CALL(*unlock_manager_, SetRemoteDeviceLifeCycle(_))
.WillOnce(SaveArg<0>(&life_cycle));
......@@ -433,7 +384,6 @@ TEST_F(ProximityAuthSystemTest, ToggleFocus_SameUserRefocused) {
}
TEST_F(ProximityAuthSystemTest, RestartSystem_UnregisteredUserFocused) {
InitializeTest(false /* multidevice_flags_enabled */);
FocusUser(kUser2);
EXPECT_CALL(*unlock_manager_, SetRemoteDeviceLifeCycle(nullptr))
......@@ -444,7 +394,6 @@ TEST_F(ProximityAuthSystemTest, RestartSystem_UnregisteredUserFocused) {
}
TEST_F(ProximityAuthSystemTest, StopSystem_RegisteredUserFocused) {
InitializeTest(false /* multidevice_flags_enabled */);
EXPECT_CALL(*unlock_manager_, SetRemoteDeviceLifeCycle(NotNull()));
FocusUser(kUser1);
......@@ -458,7 +407,6 @@ TEST_F(ProximityAuthSystemTest, StopSystem_RegisteredUserFocused) {
}
TEST_F(ProximityAuthSystemTest, OnLifeCycleStateChanged) {
InitializeTest(false /* multidevice_flags_enabled */);
FocusUser(kUser1);
EXPECT_CALL(*unlock_manager_, OnLifeCycleStateChanged());
......@@ -473,14 +421,12 @@ TEST_F(ProximityAuthSystemTest, OnLifeCycleStateChanged) {
}
TEST_F(ProximityAuthSystemTest, OnAuthAttempted) {
InitializeTest(false /* multidevice_flags_enabled */);
FocusUser(kUser1);
EXPECT_CALL(*unlock_manager_, OnAuthAttempted(_));
proximity_auth_system_->OnAuthAttempted(AccountId::FromUserEmail(kUser1));
}
TEST_F(ProximityAuthSystemTest, Suspend_ScreenUnlocked) {
InitializeTest(false /* multidevice_flags_enabled */);
UnlockScreen();
EXPECT_FALSE(life_cycle());
SimulateSuspend();
......@@ -488,13 +434,11 @@ TEST_F(ProximityAuthSystemTest, Suspend_ScreenUnlocked) {
}
TEST_F(ProximityAuthSystemTest, Suspend_UnregisteredUserFocused) {
InitializeTest(false /* multidevice_flags_enabled */);
SimulateSuspend();
EXPECT_FALSE(life_cycle());
}
TEST_F(ProximityAuthSystemTest, Suspend_RegisteredUserFocused) {
InitializeTest(false /* multidevice_flags_enabled */);
FocusUser(kUser1);
{
......
......@@ -181,9 +181,7 @@ class ProximityAuthUnlockManagerImplTest : public testing::Test {
ScreenlockBridge::Get()->SetLockHandler(nullptr);
}
void InitializeTest(bool multidevice_flags_enabled) {
SetMultiDeviceApi(multidevice_flags_enabled);
void SetUp() override {
ON_CALL(*bluetooth_adapter_, IsPresent()).WillByDefault(Return(true));
ON_CALL(*bluetooth_adapter_, IsPowered()).WillByDefault(Return(true));
ON_CALL(messenger_, SupportsSignIn()).WillByDefault(Return(true));
......@@ -199,17 +197,6 @@ class ProximityAuthUnlockManagerImplTest : public testing::Test {
chromeos::DBusThreadManager::Initialize();
}
void SetMultiDeviceApi(bool enabled) {
static const std::vector<base::Feature> kFeatures{
chromeos::features::kEnableUnifiedMultiDeviceSetup};
scoped_feature_list_.InitWithFeatures(
(enabled ? kFeatures
: std::vector<base::Feature>() /* enable_features */),
(enabled ? std::vector<base::Feature>()
: kFeatures /* disable_features */));
}
void CreateUnlockManager(
ProximityAuthSystem::ScreenlockType screenlock_type) {
unlock_manager_.reset(
......@@ -255,14 +242,12 @@ class ProximityAuthUnlockManagerImplTest : public testing::Test {
};
TEST_F(ProximityAuthUnlockManagerImplTest, IsUnlockAllowed_InitialState) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
EXPECT_FALSE(unlock_manager_->IsUnlockAllowed());
}
TEST_F(ProximityAuthUnlockManagerImplTest,
IsUnlockAllowed_SessionLock_AllGood) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
......@@ -275,7 +260,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
}
TEST_F(ProximityAuthUnlockManagerImplTest, IsUnlockAllowed_SignIn_AllGood) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SIGN_IN);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
......@@ -291,7 +275,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest, IsUnlockAllowed_SignIn_AllGood) {
TEST_F(ProximityAuthUnlockManagerImplTest,
IsUnlockAllowed_SignIn_MessengerDoesNotSupportSignIn) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SIGN_IN);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
......@@ -307,7 +290,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
IsUnlockAllowed_DisallowedByProximityMonitor) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
......@@ -322,7 +304,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
IsUnlockAllowed_SecureChannelNotEstablished) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
life_cycle_.set_messenger(nullptr);
......@@ -336,7 +317,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
IsUnlockAllowed_RemoteDeviceLifeCycleIsNull) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
unlock_manager_->SetRemoteDeviceLifeCycle(nullptr);
......@@ -347,7 +327,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
IsUnlockAllowed_RemoteScreenlockStateLocked) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
......@@ -361,7 +340,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
IsUnlockAllowed_RemoteScreenlockStateUnknown) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
......@@ -375,7 +353,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
IsUnlockAllowed_RemoteScreenlockStateDisabled) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
......@@ -389,7 +366,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
IsUnlockAllowed_RemoteScreenlockStateNotYetReceived) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
......@@ -401,7 +377,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
}
TEST_F(ProximityAuthUnlockManagerImplTest, SetRemoteDeviceLifeCycle_SetToNull) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -412,7 +387,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest, SetRemoteDeviceLifeCycle_SetToNull) {
TEST_F(ProximityAuthUnlockManagerImplTest,
SetRemoteDeviceLifeCycle_ExistingRemoteDeviceLifeCycle) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -422,7 +396,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
SetRemoteDeviceLifeCycle_AuthenticationFailed) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -436,7 +409,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
}
TEST_F(ProximityAuthUnlockManagerImplTest, SetRemoteDeviceLifeCycle_WakingUp) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -451,7 +423,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest, SetRemoteDeviceLifeCycle_WakingUp) {
TEST_F(ProximityAuthUnlockManagerImplTest,
SetRemoteDeviceLifeCycle_TimesOutBeforeConnection) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
life_cycle_.set_messenger(nullptr);
......@@ -469,7 +440,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
SetRemoteDeviceLifeCycle_NullRemoteDeviceLifeCycle_NoProximityMonitor) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
unlock_manager_->SetRemoteDeviceLifeCycle(nullptr);
......@@ -478,7 +448,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(
ProximityAuthUnlockManagerImplTest,
SetRemoteDeviceLifeCycle_ConnectingRemoteDeviceLifeCycle_StopsProximityMonitor) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -491,7 +460,6 @@ TEST_F(
TEST_F(
ProximityAuthUnlockManagerImplTest,
SetRemoteDeviceLifeCycle_ConnectedRemoteDeviceLifeCycle_StartsProximityMonitor) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
......@@ -503,7 +471,6 @@ TEST_F(
}
TEST_F(ProximityAuthUnlockManagerImplTest, BluetoothAdapterNotPresent) {
InitializeTest(false /* multidevice_flags_enabled */);
ON_CALL(*bluetooth_adapter_, IsPresent()).WillByDefault(Return(false));
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
......@@ -516,7 +483,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest, BluetoothAdapterNotPresent) {
}
TEST_F(ProximityAuthUnlockManagerImplTest, BluetoothAdapterPowerChanges) {
InitializeTest(false /* multidevice_flags_enabled */);
ON_CALL(*bluetooth_adapter_, IsPowered()).WillByDefault(Return(false));
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
......@@ -536,7 +502,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest, BluetoothAdapterPowerChanges) {
TEST_F(ProximityAuthUnlockManagerImplTest,
OnLifeCycleStateChanged_SecureChannelEstablished_RegistersAsObserver) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
EXPECT_CALL(messenger_, AddObserver(unlock_manager_.get()));
......@@ -545,7 +510,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnLifeCycleStateChanged_StartsProximityMonitor) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
EXPECT_TRUE(proximity_monitor()->started());
......@@ -554,7 +518,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnLifeCycleStateChanged_StopsProximityMonitor) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -566,7 +529,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnLifeCycleStateChanged_AuthenticationFailed_UpdatesScreenlockState) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -578,7 +540,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnLifeCycleStateChanged_FindingConnection_UpdatesScreenlockState) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
EXPECT_CALL(proximity_auth_client_,
......@@ -588,7 +549,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnLifeCycleStateChanged_Authenticating_UpdatesScreenlockState) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
EXPECT_CALL(proximity_auth_client_,
UpdateScreenlockState(ScreenlockState::BLUETOOTH_CONNECTING));
......@@ -601,7 +561,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnDisconnected_UnregistersAsObserver) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
life_cycle_.ChangeState(RemoteDeviceLifeCycle::State::AUTHENTICATION_FAILED);
......@@ -615,7 +574,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnScreenDidUnlock_StopsProximityMonitor) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -626,7 +584,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnScreenDidLock_StartsProximityMonitor) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
unlock_manager_->SetRemoteDeviceLifeCycle(&life_cycle_);
......@@ -640,7 +597,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
}
TEST_F(ProximityAuthUnlockManagerImplTest, OnScreenDidLock_SetsWakingUpState) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
EXPECT_CALL(proximity_auth_client_,
......@@ -656,7 +612,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest, OnScreenDidLock_SetsWakingUpState) {
TEST_F(ProximityAuthUnlockManagerImplTest,
OnDecryptResponse_NoAuthAttemptInProgress) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -666,7 +621,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnUnlockEventSent_NoAuthAttemptInProgress) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -676,7 +630,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnUnlockResponse_NoAuthAttemptInProgress) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -686,7 +639,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnAuthAttempted_NoRemoteDeviceLifeCycle) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -697,7 +649,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
}
TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_UnlockNotAllowed) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -708,7 +659,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_UnlockNotAllowed) {
}
TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_NotUserClick) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -717,7 +667,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_NotUserClick) {
}
TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_DuplicateCall) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -729,7 +678,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_DuplicateCall) {
}
TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_TimesOut) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -742,7 +690,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_TimesOut) {
TEST_F(ProximityAuthUnlockManagerImplTest,
OnAuthAttempted_DoesntTimeOutFollowingResponse) {
InitializeTest(false /* multidevice_flags_enabled */);
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -758,7 +705,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnAuthAttempted_Unlock_SupportsSignIn_UnlockRequestFails) {
InitializeTest(false /* multidevice_flags_enabled */);
ON_CALL(messenger_, SupportsSignIn()).WillByDefault(Return(true));
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -772,7 +718,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnAuthAttempted_Unlock_WithSignIn_RequestSucceeds_EventSendFails) {
InitializeTest(false /* multidevice_flags_enabled */);
ON_CALL(messenger_, SupportsSignIn()).WillByDefault(Return(true));
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -789,7 +734,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnAuthAttempted_Unlock_WithSignIn_RequestSucceeds_EventSendSucceeds) {
InitializeTest(false /* multidevice_flags_enabled */);
ON_CALL(messenger_, SupportsSignIn()).WillByDefault(Return(true));
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -806,7 +750,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnAuthAttempted_Unlock_DoesntSupportSignIn_UnlockEventSendFails) {
InitializeTest(false /* multidevice_flags_enabled */);
ON_CALL(messenger_, SupportsSignIn()).WillByDefault(Return(false));
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -820,7 +763,6 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
TEST_F(ProximityAuthUnlockManagerImplTest,
OnAuthAttempted_Unlock_SupportsSignIn_UnlockEventSendSucceeds) {
InitializeTest(false /* multidevice_flags_enabled */);
ON_CALL(messenger_, SupportsSignIn()).WillByDefault(Return(false));
CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK);
SimulateUserPresentState();
......@@ -832,10 +774,7 @@ TEST_F(ProximityAuthUnlockManagerImplTest,
unlock_manager_->OnUnlockEventSent(true);
}
TEST_F(ProximityAuthUnlockManagerImplTest,
OnAuthAttempted_SignIn_Success_MultiDeviceApiEnabled) {
InitializeTest(true /* multidevice_flags_enabled */);
TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_SignIn_Success) {
ON_CALL(messenger_, SupportsSignIn()).WillByDefault(Return(true));
CreateUnlockManager(ProximityAuthSystem::SIGN_IN);
SimulateUserPresentState();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment