| 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 "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" | 5 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 TEST_F(EasyUnlockScreenlockStateHandlerTest, StatesWithLockedIcon) { | 346 TEST_F(EasyUnlockScreenlockStateHandlerTest, StatesWithLockedIcon) { |
| 347 std::vector<ScreenlockState> states; | 347 std::vector<ScreenlockState> states; |
| 348 states.push_back(ScreenlockState::NO_BLUETOOTH); | 348 states.push_back(ScreenlockState::NO_BLUETOOTH); |
| 349 states.push_back(ScreenlockState::NO_PHONE); | 349 states.push_back(ScreenlockState::NO_PHONE); |
| 350 states.push_back(ScreenlockState::PHONE_UNSUPPORTED); | 350 states.push_back(ScreenlockState::PHONE_UNSUPPORTED); |
| 351 states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE); | 351 states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE); |
| 352 states.push_back(ScreenlockState::PHONE_NOT_AUTHENTICATED); | 352 states.push_back(ScreenlockState::PHONE_NOT_AUTHENTICATED); |
| 353 states.push_back(ScreenlockState::PHONE_LOCKED); | 353 states.push_back(ScreenlockState::PHONE_LOCKED); |
| 354 | 354 |
| 355 for (size_t i = 0; i < states.size(); ++i) { | 355 for (size_t i = 0; i < states.size(); ++i) { |
| 356 SCOPED_TRACE(base::IntToString(i)); | 356 SCOPED_TRACE(base::SizeTToString(i)); |
| 357 state_handler_->ChangeState(states[i]); | 357 state_handler_->ChangeState(states[i]); |
| 358 EXPECT_TRUE(state_handler_->IsActive()); | 358 EXPECT_TRUE(state_handler_->IsActive()); |
| 359 | 359 |
| 360 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); | 360 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); |
| 361 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 361 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
| 362 lock_handler_->GetAuthType(user_email_)); | 362 lock_handler_->GetAuthType(user_email_)); |
| 363 | 363 |
| 364 ASSERT_TRUE(lock_handler_->HasCustomIcon()); | 364 ASSERT_TRUE(lock_handler_->HasCustomIcon()); |
| 365 EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()); | 365 EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()); |
| 366 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()); | 366 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 states.push_back(ScreenlockState::PHONE_NOT_AUTHENTICATED); | 462 states.push_back(ScreenlockState::PHONE_NOT_AUTHENTICATED); |
| 463 states.push_back(ScreenlockState::NO_BLUETOOTH); | 463 states.push_back(ScreenlockState::NO_BLUETOOTH); |
| 464 states.push_back(ScreenlockState::NO_PHONE); | 464 states.push_back(ScreenlockState::NO_PHONE); |
| 465 states.push_back(ScreenlockState::PHONE_UNSUPPORTED); | 465 states.push_back(ScreenlockState::PHONE_UNSUPPORTED); |
| 466 states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE); | 466 states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE); |
| 467 // This one should go last as changing state to AUTHENTICATED enables hard | 467 // This one should go last as changing state to AUTHENTICATED enables hard |
| 468 // locking. | 468 // locking. |
| 469 states.push_back(ScreenlockState::AUTHENTICATED); | 469 states.push_back(ScreenlockState::AUTHENTICATED); |
| 470 | 470 |
| 471 for (size_t i = 0; i < states.size(); ++i) { | 471 for (size_t i = 0; i < states.size(); ++i) { |
| 472 SCOPED_TRACE(base::IntToString(i)); | 472 SCOPED_TRACE(base::SizeTToString(i)); |
| 473 state_handler_->ChangeState(states[i]); | 473 state_handler_->ChangeState(states[i]); |
| 474 ASSERT_TRUE(lock_handler_->HasCustomIcon()); | 474 ASSERT_TRUE(lock_handler_->HasCustomIcon()); |
| 475 EXPECT_FALSE(lock_handler_->CustomIconHardlocksOnClick()); | 475 EXPECT_FALSE(lock_handler_->CustomIconHardlocksOnClick()); |
| 476 } | 476 } |
| 477 | 477 |
| 478 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); | 478 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); |
| 479 lock_handler_.reset(new TestLockHandler(user_email_)); | 479 lock_handler_.reset(new TestLockHandler(user_email_)); |
| 480 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); | 480 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); |
| 481 | 481 |
| 482 for (size_t i = 0; i < states.size(); ++i) { | 482 for (size_t i = 0; i < states.size(); ++i) { |
| 483 SCOPED_TRACE(base::IntToString(i)); | 483 SCOPED_TRACE(base::SizeTToString(i)); |
| 484 state_handler_->ChangeState(states[i]); | 484 state_handler_->ChangeState(states[i]); |
| 485 ASSERT_TRUE(lock_handler_->HasCustomIcon()); | 485 ASSERT_TRUE(lock_handler_->HasCustomIcon()); |
| 486 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); | 486 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 | 489 |
| 490 TEST_F(EasyUnlockScreenlockStateHandlerTest, | 490 TEST_F(EasyUnlockScreenlockStateHandlerTest, |
| 491 NoPairingHardlockClearsIcon) { | 491 NoPairingHardlockClearsIcon) { |
| 492 state_handler_->ChangeState(ScreenlockState::PHONE_LOCKED); | 492 state_handler_->ChangeState(ScreenlockState::PHONE_LOCKED); |
| 493 | 493 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 state_handler_->RecordClickOnLockIcon(); | 733 state_handler_->RecordClickOnLockIcon(); |
| 734 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4); | 734 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4); |
| 735 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events", | 735 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events", |
| 736 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1); | 736 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1); |
| 737 histogram_tester.ExpectBucketCount( | 737 histogram_tester.ExpectBucketCount( |
| 738 "EasyUnlock.TrialRun.Events", | 738 "EasyUnlock.TrialRun.Events", |
| 739 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3); | 739 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3); |
| 740 } | 740 } |
| 741 | 741 |
| 742 } // namespace | 742 } // namespace |
| OLD | NEW |