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