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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 EXPECT_EQ(ScreenlockBridge::LockHandler::USER_CLICK, | 259 EXPECT_EQ(ScreenlockBridge::LockHandler::USER_CLICK, |
260 lock_handler_->GetAuthType(user_email_)); | 260 lock_handler_->GetAuthType(user_email_)); |
261 | 261 |
262 ASSERT_TRUE(lock_handler_->HasCustomIcon()); | 262 ASSERT_TRUE(lock_handler_->HasCustomIcon()); |
263 EXPECT_EQ(kUnlockedIconId, lock_handler_->GetCustomIconId()); | 263 EXPECT_EQ(kUnlockedIconId, lock_handler_->GetCustomIconId()); |
264 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()); | 264 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()); |
265 EXPECT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown()); | 265 EXPECT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown()); |
266 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); | 266 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); |
267 } | 267 } |
268 | 268 |
| 269 TEST_F(EasyUnlockScreenlockStateHandlerTest, IsActive) { |
| 270 EXPECT_FALSE(state_handler_->IsActive()); |
| 271 state_handler_->ChangeState( |
| 272 EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); |
| 273 EXPECT_TRUE(state_handler_->IsActive()); |
| 274 state_handler_->ChangeState( |
| 275 EasyUnlockScreenlockStateHandler::STATE_INACTIVE); |
| 276 EXPECT_FALSE(state_handler_->IsActive()); |
| 277 } |
| 278 |
269 TEST_F(EasyUnlockScreenlockStateHandlerTest, BluetoothConnecting) { | 279 TEST_F(EasyUnlockScreenlockStateHandlerTest, BluetoothConnecting) { |
270 state_handler_->ChangeState( | 280 state_handler_->ChangeState( |
271 EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING); | 281 EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING); |
| 282 EXPECT_TRUE(state_handler_->IsActive()); |
272 | 283 |
273 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); | 284 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); |
274 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 285 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
275 lock_handler_->GetAuthType(user_email_)); | 286 lock_handler_->GetAuthType(user_email_)); |
276 | 287 |
277 ASSERT_TRUE(lock_handler_->HasCustomIcon()); | 288 ASSERT_TRUE(lock_handler_->HasCustomIcon()); |
278 EXPECT_EQ(kSpinnerIconId, lock_handler_->GetCustomIconId()); | 289 EXPECT_EQ(kSpinnerIconId, lock_handler_->GetCustomIconId()); |
279 EXPECT_FALSE(lock_handler_->CustomIconHasTooltip()); | 290 EXPECT_FALSE(lock_handler_->CustomIconHasTooltip()); |
280 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); | 291 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); |
281 | 292 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH); | 345 states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH); |
335 states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_PHONE); | 346 states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_PHONE); |
336 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED); | 347 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED); |
337 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_UNLOCKABLE); | 348 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_UNLOCKABLE); |
338 states.push_back( | 349 states.push_back( |
339 EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED); | 350 EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED); |
340 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED); | 351 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED); |
341 | 352 |
342 for (size_t i = 0; i < states.size(); ++i) { | 353 for (size_t i = 0; i < states.size(); ++i) { |
343 state_handler_->ChangeState(states[i]); | 354 state_handler_->ChangeState(states[i]); |
| 355 EXPECT_TRUE(state_handler_->IsActive()); |
344 | 356 |
345 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()) | 357 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()) |
346 << "State: " << states[i]; | 358 << "State: " << states[i]; |
347 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 359 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
348 lock_handler_->GetAuthType(user_email_)) | 360 lock_handler_->GetAuthType(user_email_)) |
349 << "State: " << states[i]; | 361 << "State: " << states[i]; |
350 | 362 |
351 ASSERT_TRUE(lock_handler_->HasCustomIcon()) | 363 ASSERT_TRUE(lock_handler_->HasCustomIcon()) |
352 << "State: " << states[i]; | 364 << "State: " << states[i]; |
353 EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()) | 365 EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()) |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 741 |
730 state_handler_->ChangeState( | 742 state_handler_->ChangeState( |
731 EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); | 743 EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); |
732 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); | 744 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); |
733 EXPECT_TRUE(lock_handler_->HasCustomIcon()); | 745 EXPECT_TRUE(lock_handler_->HasCustomIcon()); |
734 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 746 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
735 lock_handler_->GetAuthType(user_email_)); | 747 lock_handler_->GetAuthType(user_email_)); |
736 } | 748 } |
737 | 749 |
738 } // namespace | 750 } // namespace |
OLD | NEW |