| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/login/login_manager_test.h" | 9 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 10 #include "chrome/browser/chromeos/login/startup_utils.h" | 10 #include "chrome/browser/chromeos/login/startup_utils.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // InProcessBrowserTest: | 194 // InProcessBrowserTest: |
| 195 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 195 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 196 command_line->AppendSwitchASCII(switches::kForceFieldTrials, | 196 command_line->AppendSwitchASCII(switches::kForceFieldTrials, |
| 197 "EasyUnlock/Disable/"); | 197 "EasyUnlock/Disable/"); |
| 198 } | 198 } |
| 199 | 199 |
| 200 private: | 200 private: |
| 201 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceFinchDisabledTest); | 201 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceFinchDisabledTest); |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 // Tests that easy unlock is off when finch is disabled. | 204 // Tests that easy unlock is off when finch is disabled and policy overrides |
| 205 IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchDisabledTest, StayDisabled) { | 205 // finch. |
| 206 IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchDisabledTest, PolicyOverride) { |
| 206 // Finch is disabled. | 207 // Finch is disabled. |
| 207 EXPECT_FALSE(service()->IsAllowed()); | 208 EXPECT_FALSE(service()->IsAllowed()); |
| 208 #if defined(GOOGLE_CHROME_BUILD) | 209 #if defined(GOOGLE_CHROME_BUILD) |
| 209 EXPECT_FALSE(HasEasyUnlockApp()); | 210 EXPECT_FALSE(HasEasyUnlockApp()); |
| 210 #endif | 211 #endif |
| 211 | 212 |
| 212 // Easy unlock stays off even when it is allowed by policy. | 213 // Policy overrides finch and turns on Easy unlock. |
| 213 SetEasyUnlockAllowedPolicy(true); | 214 SetEasyUnlockAllowedPolicy(true); |
| 214 EXPECT_FALSE(service()->IsAllowed()); | 215 EXPECT_TRUE(service()->IsAllowed()); |
| 215 #if defined(GOOGLE_CHROME_BUILD) | 216 #if defined(GOOGLE_CHROME_BUILD) |
| 216 EXPECT_FALSE(HasEasyUnlockApp()); | 217 EXPECT_TRUE(HasEasyUnlockApp()); |
| 217 #endif | 218 #endif |
| 218 } | 219 } |
| 219 | 220 |
| 220 class EasyUnlockServiceMultiProfileTest : public LoginManagerTest { | 221 class EasyUnlockServiceMultiProfileTest : public LoginManagerTest { |
| 221 public: | 222 public: |
| 222 EasyUnlockServiceMultiProfileTest() : LoginManagerTest(false) {} | 223 EasyUnlockServiceMultiProfileTest() : LoginManagerTest(false) {} |
| 223 virtual ~EasyUnlockServiceMultiProfileTest() {} | 224 virtual ~EasyUnlockServiceMultiProfileTest() {} |
| 224 | 225 |
| 225 // InProcessBrowserTest: | 226 // InProcessBrowserTest: |
| 226 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 227 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 Profile* secondary_profile = ProfileHelper::Get()->GetProfileByUserIdHash( | 259 Profile* secondary_profile = ProfileHelper::Get()->GetProfileByUserIdHash( |
| 259 secondary_user->username_hash()); | 260 secondary_user->username_hash()); |
| 260 | 261 |
| 261 EXPECT_TRUE(EasyUnlockService::Get(primary_profile)->IsAllowed()); | 262 EXPECT_TRUE(EasyUnlockService::Get(primary_profile)->IsAllowed()); |
| 262 EXPECT_FALSE(EasyUnlockService::Get(secondary_profile)->IsAllowed()); | 263 EXPECT_FALSE(EasyUnlockService::Get(secondary_profile)->IsAllowed()); |
| 263 #if defined(GOOGLE_CHROME_BUILD) | 264 #if defined(GOOGLE_CHROME_BUILD) |
| 264 EXPECT_TRUE(HasEasyUnlockAppForProfile(primary_profile)); | 265 EXPECT_TRUE(HasEasyUnlockAppForProfile(primary_profile)); |
| 265 EXPECT_FALSE(HasEasyUnlockAppForProfile(secondary_profile)); | 266 EXPECT_FALSE(HasEasyUnlockAppForProfile(secondary_profile)); |
| 266 #endif | 267 #endif |
| 267 } | 268 } |
| OLD | NEW |