Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(747)

Side by Side Diff: chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc

Issue 572083004: Don't use opaque icons for easy unlock (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/signin/easy_unlock_screenlock_state_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); 324 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick());
325 EXPECT_TRUE(lock_handler_->IsCustomIconAnimated()); 325 EXPECT_TRUE(lock_handler_->IsCustomIconAnimated());
326 EXPECT_EQ(100, lock_handler_->GetCustomIconOpacity()); 326 EXPECT_EQ(100, lock_handler_->GetCustomIconOpacity());
327 327
328 state_handler_->ChangeState( 328 state_handler_->ChangeState(
329 EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING); 329 EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING);
330 // Duplicated state change should be ignored. 330 // Duplicated state change should be ignored.
331 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 331 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
332 } 332 }
333 333
334 TEST_F(EasyUnlockScreenlockStateHandlerTest, PhoneLocked) { 334 TEST_F(EasyUnlockScreenlockStateHandlerTest, StatesWithLockedIcon) {
335 pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false);
336 state_handler_->ChangeState(
337 EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED);
338
339 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
340 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD,
341 lock_handler_->GetAuthType(user_email_));
342
343 ASSERT_TRUE(lock_handler_->HasCustomIcon());
344 EXPECT_EQ(kLockedIconURL, lock_handler_->GetCustomIconURL());
345 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip());
346 EXPECT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown());
347 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick());
348 EXPECT_FALSE(lock_handler_->IsCustomIconAnimated());
349 EXPECT_EQ(100, lock_handler_->GetCustomIconOpacity());
350
351 state_handler_->ChangeState(
352 EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED);
353 // Duplicated state change should be ignored.
354 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
355 }
356
357 TEST_F(EasyUnlockScreenlockStateHandlerTest, PhoneNotAuthenticated) {
358 pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false);
359 state_handler_->ChangeState(
360 EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED);
361
362 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
363 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD,
364 lock_handler_->GetAuthType(user_email_));
365
366 ASSERT_TRUE(lock_handler_->HasCustomIcon());
367 EXPECT_EQ(kLockedIconURL, lock_handler_->GetCustomIconURL());
368 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip());
369 EXPECT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown());
370 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick());
371 EXPECT_FALSE(lock_handler_->IsCustomIconAnimated());
372 EXPECT_EQ(100, lock_handler_->GetCustomIconOpacity());
373
374 state_handler_->ChangeState(
375 EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED);
376 // Duplicated state change should be ignored.
377 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
378 }
379
380 TEST_F(EasyUnlockScreenlockStateHandlerTest, StatesWithOpaqueIcons) {
381 pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false); 335 pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false);
382 336
383 std::vector<EasyUnlockScreenlockStateHandler::State> states; 337 std::vector<EasyUnlockScreenlockStateHandler::State> states;
384 states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH); 338 states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH);
385 states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_PHONE); 339 states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_PHONE);
386 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED); 340 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED);
387 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_UNLOCKABLE); 341 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_UNLOCKABLE);
342 states.push_back(
343 EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED);
344 states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED);
388 345
389 for (size_t i = 0; i < states.size(); ++i) { 346 for (size_t i = 0; i < states.size(); ++i) {
390 state_handler_->ChangeState(states[i]); 347 state_handler_->ChangeState(states[i]);
391 348
392 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()) 349 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount())
393 << "State: " << states[i]; 350 << "State: " << states[i];
394 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 351 EXPECT_EQ(ScreenlockBridge::LockHandler::OFFLINE_PASSWORD,
395 lock_handler_->GetAuthType(user_email_)) 352 lock_handler_->GetAuthType(user_email_))
396 << "State: " << states[i]; 353 << "State: " << states[i];
397 354
398 ASSERT_TRUE(lock_handler_->HasCustomIcon()) 355 ASSERT_TRUE(lock_handler_->HasCustomIcon())
399 << "State: " << states[i]; 356 << "State: " << states[i];
400 EXPECT_EQ(kLockedIconURL, lock_handler_->GetCustomIconURL()) 357 EXPECT_EQ(kLockedIconURL, lock_handler_->GetCustomIconURL())
401 << "State: " << states[i]; 358 << "State: " << states[i];
402 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()) 359 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip())
403 << "State: " << states[i]; 360 << "State: " << states[i];
404 EXPECT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown()) 361 EXPECT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown())
405 << "State: " << states[i]; 362 << "State: " << states[i];
406 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()) 363 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick())
407 << "State: " << states[i]; 364 << "State: " << states[i];
408 EXPECT_FALSE(lock_handler_->IsCustomIconAnimated()) 365 EXPECT_FALSE(lock_handler_->IsCustomIconAnimated())
409 << "State: " << states[i]; 366 << "State: " << states[i];
410 EXPECT_EQ(50, lock_handler_->GetCustomIconOpacity()) 367 EXPECT_EQ(100, lock_handler_->GetCustomIconOpacity())
411 << "State: " << states[i]; 368 << "State: " << states[i];
412 369
413 state_handler_->ChangeState(states[i]); 370 state_handler_->ChangeState(states[i]);
414 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()) 371 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount())
415 << "State: " << states[i]; 372 << "State: " << states[i];
416 } 373 }
417 } 374 }
418 375
419 TEST_F(EasyUnlockScreenlockStateHandlerTest, 376 TEST_F(EasyUnlockScreenlockStateHandlerTest,
420 LockScreenClearedOnStateHandlerDestruction) { 377 LockScreenClearedOnStateHandlerDestruction) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 state_handler_->ChangeState( 571 state_handler_->ChangeState(
615 EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); 572 EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED);
616 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 573 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
617 EXPECT_TRUE(lock_handler_->HasCustomIcon()); 574 EXPECT_TRUE(lock_handler_->HasCustomIcon());
618 EXPECT_EQ(ScreenlockBridge::LockHandler::USER_CLICK, 575 EXPECT_EQ(ScreenlockBridge::LockHandler::USER_CLICK,
619 lock_handler_->GetAuthType(user_email_)); 576 lock_handler_->GetAuthType(user_email_));
620 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); 577 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick());
621 } 578 }
622 579
623 } // namespace 580 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_screenlock_state_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698