Commit 67eeb55c authored by xiyuan's avatar xiyuan Committed by Commit bot

easy-unlock: Tighten finch check.

Tighten finch check a bit so that the missing trial is treated as disable.

BUG=423016

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

Cr-Commit-Position: refs/heads/master@{#299408}
parent 5f0137cc
...@@ -136,23 +136,12 @@ class EasyUnlockServiceTest : public InProcessBrowserTest { ...@@ -136,23 +136,12 @@ class EasyUnlockServiceTest : public InProcessBrowserTest {
DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceTest); DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceTest);
}; };
// Tests that EasyUnlock is on by default. IN_PROC_BROWSER_TEST_F(EasyUnlockServiceTest, NoFinchNoService) {
IN_PROC_BROWSER_TEST_F(EasyUnlockServiceTest, DefaultOn) { EXPECT_FALSE(service()->IsAllowed());
EXPECT_TRUE(service()->IsAllowed());
#if defined(GOOGLE_CHROME_BUILD)
EXPECT_TRUE(HasEasyUnlockApp());
#endif
}
#if defined(GOOGLE_CHROME_BUILD) #if defined(GOOGLE_CHROME_BUILD)
IN_PROC_BROWSER_TEST_F(EasyUnlockServiceTest, UnloadsOnSuspend) {
EXPECT_TRUE(HasEasyUnlockApp());
power_manager_client()->SendSuspendImminent();
EXPECT_FALSE(HasEasyUnlockApp()); EXPECT_FALSE(HasEasyUnlockApp());
power_manager_client()->SendSuspendDone();
EXPECT_TRUE(HasEasyUnlockApp());
}
#endif #endif
}
class EasyUnlockServiceNoBluetoothTest : public EasyUnlockServiceTest { class EasyUnlockServiceNoBluetoothTest : public EasyUnlockServiceTest {
public: public:
...@@ -191,6 +180,23 @@ class EasyUnlockServiceFinchEnabledTest : public EasyUnlockServiceTest { ...@@ -191,6 +180,23 @@ class EasyUnlockServiceFinchEnabledTest : public EasyUnlockServiceTest {
DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceFinchEnabledTest); DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceFinchEnabledTest);
}; };
IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchEnabledTest, Enabled) {
EXPECT_TRUE(service()->IsAllowed());
#if defined(GOOGLE_CHROME_BUILD)
EXPECT_TRUE(HasEasyUnlockApp());
#endif
}
#if defined(GOOGLE_CHROME_BUILD)
IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchEnabledTest, UnloadsOnSuspend) {
EXPECT_TRUE(HasEasyUnlockApp());
power_manager_client()->SendSuspendImminent();
EXPECT_FALSE(HasEasyUnlockApp());
power_manager_client()->SendSuspendDone();
EXPECT_TRUE(HasEasyUnlockApp());
}
#endif
// Tests that policy can override finch to turn easy unlock off. // Tests that policy can override finch to turn easy unlock off.
IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchEnabledTest, PolicyOveride) { IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchEnabledTest, PolicyOveride) {
EXPECT_TRUE(service()->IsAllowed()); EXPECT_TRUE(service()->IsAllowed());
......
...@@ -191,9 +191,8 @@ bool EasyUnlockServiceRegular::IsAllowedInternal() { ...@@ -191,9 +191,8 @@ bool EasyUnlockServiceRegular::IsAllowedInternal() {
// Respect existing policy and skip finch test. // Respect existing policy and skip finch test.
if (!profile()->GetPrefs()->IsManagedPreference(prefs::kEasyUnlockAllowed)) { if (!profile()->GetPrefs()->IsManagedPreference(prefs::kEasyUnlockAllowed)) {
// It is disabled when the trial exists and is in "Disable" group. // It is enabled when the trial exists and is in "Enable" group.
if (base::FieldTrialList::FindFullName("EasyUnlock") == "Disable") return base::FieldTrialList::FindFullName("EasyUnlock") == "Enable";
return false;
} }
return true; return true;
......
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