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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 mock_adapter_ = new testing::NiceMock<MockBluetoothAdapter>(); | 107 mock_adapter_ = new testing::NiceMock<MockBluetoothAdapter>(); |
108 SetUpBluetoothMock(mock_adapter_, is_bluetooth_adapter_present_); | 108 SetUpBluetoothMock(mock_adapter_, is_bluetooth_adapter_present_); |
109 | 109 |
110 scoped_ptr<DBusThreadManagerSetter> dbus_setter = | 110 scoped_ptr<DBusThreadManagerSetter> dbus_setter = |
111 chromeos::DBusThreadManager::GetSetterForTesting(); | 111 chromeos::DBusThreadManager::GetSetterForTesting(); |
112 power_manager_client_ = new FakePowerManagerClient; | 112 power_manager_client_ = new FakePowerManagerClient; |
113 dbus_setter->SetPowerManagerClient( | 113 dbus_setter->SetPowerManagerClient( |
114 scoped_ptr<PowerManagerClient>(power_manager_client_)); | 114 scoped_ptr<PowerManagerClient>(power_manager_client_)); |
115 } | 115 } |
116 | 116 |
117 void SetUpCommandLine(CommandLine* command_line) override { | 117 void SetUpCommandLine(base::CommandLine* command_line) override { |
118 command_line->AppendSwitch( | 118 command_line->AppendSwitch( |
119 proximity_auth::switches::kForceLoadEasyUnlockAppInTests); | 119 proximity_auth::switches::kForceLoadEasyUnlockAppInTests); |
120 } | 120 } |
121 | 121 |
122 Profile* profile() const { return browser()->profile(); } | 122 Profile* profile() const { return browser()->profile(); } |
123 | 123 |
124 EasyUnlockService* service() const { | 124 EasyUnlockService* service() const { |
125 return EasyUnlockService::Get(profile()); | 125 return EasyUnlockService::Get(profile()); |
126 } | 126 } |
127 | 127 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 EXPECT_FALSE(HasEasyUnlockApp()); | 200 EXPECT_FALSE(HasEasyUnlockApp()); |
201 #endif | 201 #endif |
202 } | 202 } |
203 | 203 |
204 class EasyUnlockServiceDisabledTest : public EasyUnlockServiceTest { | 204 class EasyUnlockServiceDisabledTest : public EasyUnlockServiceTest { |
205 public: | 205 public: |
206 EasyUnlockServiceDisabledTest() {} | 206 EasyUnlockServiceDisabledTest() {} |
207 ~EasyUnlockServiceDisabledTest() override {} | 207 ~EasyUnlockServiceDisabledTest() override {} |
208 | 208 |
209 // InProcessBrowserTest: | 209 // InProcessBrowserTest: |
210 void SetUpCommandLine(CommandLine* command_line) override { | 210 void SetUpCommandLine(base::CommandLine* command_line) override { |
211 command_line->AppendSwitch(proximity_auth::switches::kDisableEasyUnlock); | 211 command_line->AppendSwitch(proximity_auth::switches::kDisableEasyUnlock); |
212 } | 212 } |
213 | 213 |
214 private: | 214 private: |
215 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceDisabledTest); | 215 DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceDisabledTest); |
216 }; | 216 }; |
217 | 217 |
218 IN_PROC_BROWSER_TEST_F(EasyUnlockServiceDisabledTest, Disabled) { | 218 IN_PROC_BROWSER_TEST_F(EasyUnlockServiceDisabledTest, Disabled) { |
219 EXPECT_FALSE(service()->IsAllowed()); | 219 EXPECT_FALSE(service()->IsAllowed()); |
220 #if defined(GOOGLE_CHROME_BUILD) | 220 #if defined(GOOGLE_CHROME_BUILD) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 Profile* secondary_profile = ProfileHelper::Get()->GetProfileByUserIdHash( | 279 Profile* secondary_profile = ProfileHelper::Get()->GetProfileByUserIdHash( |
280 secondary_user->username_hash()); | 280 secondary_user->username_hash()); |
281 | 281 |
282 EXPECT_TRUE(EasyUnlockService::Get(primary_profile)->IsAllowed()); | 282 EXPECT_TRUE(EasyUnlockService::Get(primary_profile)->IsAllowed()); |
283 EXPECT_FALSE(EasyUnlockService::Get(secondary_profile)->IsAllowed()); | 283 EXPECT_FALSE(EasyUnlockService::Get(secondary_profile)->IsAllowed()); |
284 #if defined(GOOGLE_CHROME_BUILD) | 284 #if defined(GOOGLE_CHROME_BUILD) |
285 EXPECT_TRUE(HasEasyUnlockAppForProfile(primary_profile)); | 285 EXPECT_TRUE(HasEasyUnlockAppForProfile(primary_profile)); |
286 EXPECT_FALSE(HasEasyUnlockAppForProfile(secondary_profile)); | 286 EXPECT_FALSE(HasEasyUnlockAppForProfile(secondary_profile)); |
287 #endif | 287 #endif |
288 } | 288 } |
OLD | NEW |