Commit 09098f77 authored by xiyuan's avatar xiyuan Committed by Commit bot

easy-unlock: Make policy fully override field trial.

This allows dogfooders to get Easy unlock on consumer devices
(i.e. non-enrolled devices).

BUG=395154

Review URL: https://codereview.chromium.org/546163005

Cr-Commit-Position: refs/heads/master@{#294872}
parent 4dd21732
......@@ -196,9 +196,12 @@ bool EasyUnlockService::IsAllowed() {
if (!profile_->GetPrefs()->GetBoolean(prefs::kEasyUnlockAllowed))
return false;
// It is disabled when the trial exists and is in "Disable" group.
if (base::FieldTrialList::FindFullName("EasyUnlock") == "Disable")
return false;
// Respect existing policy and skip finch test.
if (!profile_->GetPrefs()->IsManagedPreference(prefs::kEasyUnlockAllowed)) {
// It is disabled when the trial exists and is in "Disable" group.
if (base::FieldTrialList::FindFullName("EasyUnlock") == "Disable")
return false;
}
if (!bluetooth_detector_->IsPresent())
return false;
......
......@@ -201,19 +201,20 @@ class EasyUnlockServiceFinchDisabledTest : public EasyUnlockServiceTest {
DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceFinchDisabledTest);
};
// Tests that easy unlock is off when finch is disabled.
IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchDisabledTest, StayDisabled) {
// Tests that easy unlock is off when finch is disabled and policy overrides
// finch.
IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchDisabledTest, PolicyOverride) {
// Finch is disabled.
EXPECT_FALSE(service()->IsAllowed());
#if defined(GOOGLE_CHROME_BUILD)
EXPECT_FALSE(HasEasyUnlockApp());
#endif
// Easy unlock stays off even when it is allowed by policy.
// Policy overrides finch and turns on Easy unlock.
SetEasyUnlockAllowedPolicy(true);
EXPECT_FALSE(service()->IsAllowed());
EXPECT_TRUE(service()->IsAllowed());
#if defined(GOOGLE_CHROME_BUILD)
EXPECT_FALSE(HasEasyUnlockApp());
EXPECT_TRUE(HasEasyUnlockApp());
#endif
}
......
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