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

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

Issue 2937553002: Create Mojo Struct for user information used in login/lock screen. (Closed)
Patch Set: rebase Created 3 years, 6 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
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 "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" 5 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 base::ReplaceStringPlaceholders(input, subst, &offsets); 45 base::ReplaceStringPlaceholders(input, subst, &offsets);
46 return !offsets.empty(); 46 return !offsets.empty();
47 } 47 }
48 48
49 // Fake lock handler to be used in these tests. 49 // Fake lock handler to be used in these tests.
50 class TestLockHandler : public proximity_auth::ScreenlockBridge::LockHandler { 50 class TestLockHandler : public proximity_auth::ScreenlockBridge::LockHandler {
51 public: 51 public:
52 explicit TestLockHandler(const AccountId& account_id) 52 explicit TestLockHandler(const AccountId& account_id)
53 : account_id_(account_id), 53 : account_id_(account_id),
54 show_icon_count_(0u), 54 show_icon_count_(0u),
55 auth_type_(OFFLINE_PASSWORD) {} 55 auth_type_(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD) {}
56 ~TestLockHandler() override {} 56 ~TestLockHandler() override {}
57 57
58 // proximity_auth::ScreenlockBridge::LockHandler implementation: 58 // proximity_auth::ScreenlockBridge::LockHandler implementation:
59 void ShowBannerMessage(const base::string16& message) override { 59 void ShowBannerMessage(const base::string16& message) override {
60 ASSERT_FALSE(true) << "Should not be reached."; 60 ASSERT_FALSE(true) << "Should not be reached.";
61 } 61 }
62 62
63 void ShowUserPodCustomIcon( 63 void ShowUserPodCustomIcon(
64 const AccountId& account_id, 64 const AccountId& account_id,
65 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon) 65 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon)
(...skipping 11 matching lines...) Expand all
77 << "account_id_=" << account_id_.Serialize() 77 << "account_id_=" << account_id_.Serialize()
78 << " != account_id=" << account_id.Serialize(); 78 << " != account_id=" << account_id.Serialize();
79 last_custom_icon_.reset(); 79 last_custom_icon_.reset();
80 } 80 }
81 81
82 void EnableInput() override { 82 void EnableInput() override {
83 ASSERT_FALSE(true) << "Should not be reached."; 83 ASSERT_FALSE(true) << "Should not be reached.";
84 } 84 }
85 85
86 void SetAuthType(const AccountId& account_id, 86 void SetAuthType(const AccountId& account_id,
87 AuthType auth_type, 87 proximity_auth::mojom::AuthType auth_type,
88 const base::string16& auth_value) override { 88 const base::string16& auth_value) override {
89 ASSERT_TRUE(account_id_ == account_id) 89 ASSERT_TRUE(account_id_ == account_id)
90 << "account_id_=" << account_id_.Serialize() 90 << "account_id_=" << account_id_.Serialize()
91 << " != account_id=" << account_id.Serialize(); 91 << " != account_id=" << account_id.Serialize();
92 // Generally, this is allowed, but EasyUnlockScreenlockStateHandler should 92 // Generally, this is allowed, but EasyUnlockScreenlockStateHandler should
93 // avoid resetting the same auth type. 93 // avoid resetting the same auth type.
94 EXPECT_NE(auth_type_, auth_type); 94 EXPECT_NE(auth_type_, auth_type);
95 95
96 auth_type_ = auth_type; 96 auth_type_ = auth_type;
97 auth_value_ = auth_value; 97 auth_value_ = auth_value;
98 } 98 }
99 99
100 AuthType GetAuthType(const AccountId& account_id) const override { 100 proximity_auth::mojom::AuthType GetAuthType(
101 const AccountId& account_id) const override {
101 EXPECT_TRUE(account_id_ == account_id) 102 EXPECT_TRUE(account_id_ == account_id)
102 << "account_id_=" << account_id_.Serialize() 103 << "account_id_=" << account_id_.Serialize()
103 << " != account_id=" << account_id.Serialize(); 104 << " != account_id=" << account_id.Serialize();
104 return auth_type_; 105 return auth_type_;
105 } 106 }
106 107
107 ScreenType GetScreenType() const override { 108 ScreenType GetScreenType() const override {
108 return LOCK_SCREEN; 109 return LOCK_SCREEN;
109 } 110 }
110 111
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // The fake account id used in test. All methods called on |this| should be 201 // The fake account id used in test. All methods called on |this| should be
201 // associated with this user. 202 // associated with this user.
202 const AccountId account_id_; 203 const AccountId account_id_;
203 204
204 // The last icon set using |SetUserPodCustomIcon|. Call to 205 // The last icon set using |SetUserPodCustomIcon|. Call to
205 // |HideUserPodcustomIcon| resets it. 206 // |HideUserPodcustomIcon| resets it.
206 std::unique_ptr<base::DictionaryValue> last_custom_icon_; 207 std::unique_ptr<base::DictionaryValue> last_custom_icon_;
207 size_t show_icon_count_; 208 size_t show_icon_count_;
208 209
209 // Auth type and value set using |SetAuthType|. 210 // Auth type and value set using |SetAuthType|.
210 AuthType auth_type_; 211 proximity_auth::mojom::AuthType auth_type_;
211 base::string16 auth_value_; 212 base::string16 auth_value_;
212 213
213 DISALLOW_COPY_AND_ASSIGN(TestLockHandler); 214 DISALLOW_COPY_AND_ASSIGN(TestLockHandler);
214 }; 215 };
215 216
216 class EasyUnlockScreenlockStateHandlerTest : public testing::Test { 217 class EasyUnlockScreenlockStateHandlerTest : public testing::Test {
217 public: 218 public:
218 EasyUnlockScreenlockStateHandlerTest() {} 219 EasyUnlockScreenlockStateHandlerTest() {}
219 ~EasyUnlockScreenlockStateHandlerTest() override {} 220 ~EasyUnlockScreenlockStateHandlerTest() override {}
220 221
(...skipping 26 matching lines...) Expand all
247 // Faked lock handler given to proximity_auth::ScreenlockBridge during the 248 // Faked lock handler given to proximity_auth::ScreenlockBridge during the
248 // test. Abstracts the screen lock UI. 249 // test. Abstracts the screen lock UI.
249 std::unique_ptr<TestLockHandler> lock_handler_; 250 std::unique_ptr<TestLockHandler> lock_handler_;
250 }; 251 };
251 252
252 TEST_F(EasyUnlockScreenlockStateHandlerTest, AuthenticatedTrialRun) { 253 TEST_F(EasyUnlockScreenlockStateHandlerTest, AuthenticatedTrialRun) {
253 state_handler_->SetTrialRun(); 254 state_handler_->SetTrialRun();
254 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 255 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
255 256
256 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 257 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
257 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 258 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
258 lock_handler_->GetAuthType(account_id_)); 259 lock_handler_->GetAuthType(account_id_));
259 260
260 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 261 ASSERT_TRUE(lock_handler_->HasCustomIcon());
261 EXPECT_EQ(kUnlockedIconId, lock_handler_->GetCustomIconId()); 262 EXPECT_EQ(kUnlockedIconId, lock_handler_->GetCustomIconId());
262 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()); 263 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip());
263 EXPECT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown()); 264 EXPECT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown());
264 EXPECT_FALSE(lock_handler_->CustomIconHardlocksOnClick()); 265 EXPECT_FALSE(lock_handler_->CustomIconHardlocksOnClick());
265 266
266 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 267 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
267 // Duplicated state change should be ignored. 268 // Duplicated state change should be ignored.
268 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 269 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
269 } 270 }
270 271
271 TEST_F(EasyUnlockScreenlockStateHandlerTest, AuthenticatedNotInitialRun) { 272 TEST_F(EasyUnlockScreenlockStateHandlerTest, AuthenticatedNotInitialRun) {
272 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 273 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
273 274
274 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 275 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
275 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 276 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
276 lock_handler_->GetAuthType(account_id_)); 277 lock_handler_->GetAuthType(account_id_));
277 278
278 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 279 ASSERT_TRUE(lock_handler_->HasCustomIcon());
279 EXPECT_EQ(kUnlockedIconId, lock_handler_->GetCustomIconId()); 280 EXPECT_EQ(kUnlockedIconId, lock_handler_->GetCustomIconId());
280 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()); 281 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip());
281 EXPECT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown()); 282 EXPECT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown());
282 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); 283 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick());
283 } 284 }
284 285
285 TEST_F(EasyUnlockScreenlockStateHandlerTest, IsActive) { 286 TEST_F(EasyUnlockScreenlockStateHandlerTest, IsActive) {
286 EXPECT_FALSE(state_handler_->IsActive()); 287 EXPECT_FALSE(state_handler_->IsActive());
287 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 288 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
288 EXPECT_TRUE(state_handler_->IsActive()); 289 EXPECT_TRUE(state_handler_->IsActive());
289 state_handler_->ChangeState(ScreenlockState::INACTIVE); 290 state_handler_->ChangeState(ScreenlockState::INACTIVE);
290 EXPECT_FALSE(state_handler_->IsActive()); 291 EXPECT_FALSE(state_handler_->IsActive());
291 } 292 }
292 293
293 TEST_F(EasyUnlockScreenlockStateHandlerTest, BluetoothConnecting) { 294 TEST_F(EasyUnlockScreenlockStateHandlerTest, BluetoothConnecting) {
294 state_handler_->ChangeState(ScreenlockState::BLUETOOTH_CONNECTING); 295 state_handler_->ChangeState(ScreenlockState::BLUETOOTH_CONNECTING);
295 EXPECT_TRUE(state_handler_->IsActive()); 296 EXPECT_TRUE(state_handler_->IsActive());
296 297
297 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 298 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
298 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 299 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
299 lock_handler_->GetAuthType(account_id_)); 300 lock_handler_->GetAuthType(account_id_));
300 301
301 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 302 ASSERT_TRUE(lock_handler_->HasCustomIcon());
302 EXPECT_EQ(kSpinnerIconId, lock_handler_->GetCustomIconId()); 303 EXPECT_EQ(kSpinnerIconId, lock_handler_->GetCustomIconId());
303 EXPECT_FALSE(lock_handler_->CustomIconHasTooltip()); 304 EXPECT_FALSE(lock_handler_->CustomIconHasTooltip());
304 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); 305 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick());
305 306
306 state_handler_->ChangeState(ScreenlockState::BLUETOOTH_CONNECTING); 307 state_handler_->ChangeState(ScreenlockState::BLUETOOTH_CONNECTING);
307 // Duplicated state change should be ignored. 308 // Duplicated state change should be ignored.
308 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 309 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
309 } 310 }
310 311
311 TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockedState) { 312 TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockedState) {
312 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 313 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
313 314
314 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 315 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
315 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 316 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
316 lock_handler_->GetAuthType(account_id_)); 317 lock_handler_->GetAuthType(account_id_));
317 318
318 state_handler_->SetHardlockState( 319 state_handler_->SetHardlockState(
319 EasyUnlockScreenlockStateHandler::USER_HARDLOCK); 320 EasyUnlockScreenlockStateHandler::USER_HARDLOCK);
320 321
321 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 322 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
322 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 323 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
323 lock_handler_->GetAuthType(account_id_)); 324 lock_handler_->GetAuthType(account_id_));
324 325
325 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 326 ASSERT_TRUE(lock_handler_->HasCustomIcon());
326 EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId()); 327 EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId());
327 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()); 328 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip());
328 EXPECT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown()); 329 EXPECT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown());
329 EXPECT_FALSE(lock_handler_->CustomIconHardlocksOnClick()); 330 EXPECT_FALSE(lock_handler_->CustomIconHardlocksOnClick());
330 331
331 state_handler_->SetHardlockState( 332 state_handler_->SetHardlockState(
332 EasyUnlockScreenlockStateHandler::USER_HARDLOCK); 333 EasyUnlockScreenlockStateHandler::USER_HARDLOCK);
333 334
334 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 335 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
335 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 336 ASSERT_TRUE(lock_handler_->HasCustomIcon());
336 } 337 }
337 338
338 TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockedStateNoPairing) { 339 TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockedStateNoPairing) {
339 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 340 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
340 341
341 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 342 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
342 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 343 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
343 lock_handler_->GetAuthType(account_id_)); 344 lock_handler_->GetAuthType(account_id_));
344 345
345 state_handler_->SetHardlockState( 346 state_handler_->SetHardlockState(
346 EasyUnlockScreenlockStateHandler::NO_PAIRING); 347 EasyUnlockScreenlockStateHandler::NO_PAIRING);
347 348
348 EXPECT_FALSE(lock_handler_->HasCustomIcon()); 349 EXPECT_FALSE(lock_handler_->HasCustomIcon());
349 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 350 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
350 lock_handler_->GetAuthType(account_id_)); 351 lock_handler_->GetAuthType(account_id_));
351 } 352 }
352 353
353 TEST_F(EasyUnlockScreenlockStateHandlerTest, StatesWithLockedIcon) { 354 TEST_F(EasyUnlockScreenlockStateHandlerTest, StatesWithLockedIcon) {
354 std::vector<ScreenlockState> states; 355 std::vector<ScreenlockState> states;
355 states.push_back(ScreenlockState::NO_BLUETOOTH); 356 states.push_back(ScreenlockState::NO_BLUETOOTH);
356 states.push_back(ScreenlockState::NO_PHONE); 357 states.push_back(ScreenlockState::NO_PHONE);
357 states.push_back(ScreenlockState::PHONE_UNSUPPORTED); 358 states.push_back(ScreenlockState::PHONE_UNSUPPORTED);
358 states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE); 359 states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE);
359 states.push_back(ScreenlockState::PHONE_NOT_AUTHENTICATED); 360 states.push_back(ScreenlockState::PHONE_NOT_AUTHENTICATED);
360 states.push_back(ScreenlockState::PHONE_LOCKED); 361 states.push_back(ScreenlockState::PHONE_LOCKED);
361 362
362 for (size_t i = 0; i < states.size(); ++i) { 363 for (size_t i = 0; i < states.size(); ++i) {
363 SCOPED_TRACE(base::SizeTToString(i)); 364 SCOPED_TRACE(base::SizeTToString(i));
364 state_handler_->ChangeState(states[i]); 365 state_handler_->ChangeState(states[i]);
365 EXPECT_TRUE(state_handler_->IsActive()); 366 EXPECT_TRUE(state_handler_->IsActive());
366 367
367 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 368 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
368 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 369 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
369 lock_handler_->GetAuthType(account_id_)); 370 lock_handler_->GetAuthType(account_id_));
370 371
371 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 372 ASSERT_TRUE(lock_handler_->HasCustomIcon());
372 EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()); 373 EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId());
373 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()); 374 EXPECT_TRUE(lock_handler_->CustomIconHasTooltip());
374 EXPECT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown()); 375 EXPECT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown());
375 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); 376 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick());
376 377
377 state_handler_->ChangeState(states[i]); 378 state_handler_->ChangeState(states[i]);
378 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 379 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
379 } 380 }
380 } 381 }
381 382
382 TEST_F(EasyUnlockScreenlockStateHandlerTest, SettingTrialRunUpdatesUI) { 383 TEST_F(EasyUnlockScreenlockStateHandlerTest, SettingTrialRunUpdatesUI) {
383 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 384 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
384 385
385 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 386 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
386 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 387 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
387 lock_handler_->GetAuthType(account_id_)); 388 lock_handler_->GetAuthType(account_id_));
388 389
389 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 390 ASSERT_TRUE(lock_handler_->HasCustomIcon());
390 ASSERT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown()); 391 ASSERT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown());
391 392
392 state_handler_->SetTrialRun(); 393 state_handler_->SetTrialRun();
393 394
394 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 395 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
395 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 396 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
396 lock_handler_->GetAuthType(account_id_)); 397 lock_handler_->GetAuthType(account_id_));
397 398
398 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 399 ASSERT_TRUE(lock_handler_->HasCustomIcon());
399 ASSERT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown()); 400 ASSERT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown());
400 } 401 }
401 402
402 TEST_F(EasyUnlockScreenlockStateHandlerTest, 403 TEST_F(EasyUnlockScreenlockStateHandlerTest,
403 LockScreenClearedOnStateHandlerDestruction) { 404 LockScreenClearedOnStateHandlerDestruction) {
404 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 405 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
405 406
406 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 407 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
407 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 408 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
408 lock_handler_->GetAuthType(account_id_)); 409 lock_handler_->GetAuthType(account_id_));
409 410
410 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 411 ASSERT_TRUE(lock_handler_->HasCustomIcon());
411 412
412 state_handler_.reset(); 413 state_handler_.reset();
413 414
414 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 415 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
415 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 416 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
416 lock_handler_->GetAuthType(account_id_)); 417 lock_handler_->GetAuthType(account_id_));
417 418
418 ASSERT_FALSE(lock_handler_->HasCustomIcon()); 419 ASSERT_FALSE(lock_handler_->HasCustomIcon());
419 } 420 }
420 421
421 TEST_F(EasyUnlockScreenlockStateHandlerTest, StatePreservedWhenScreenUnlocks) { 422 TEST_F(EasyUnlockScreenlockStateHandlerTest, StatePreservedWhenScreenUnlocks) {
422 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 423 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
423 424
424 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 425 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
425 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 426 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
426 lock_handler_->GetAuthType(account_id_)); 427 lock_handler_->GetAuthType(account_id_));
427 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 428 ASSERT_TRUE(lock_handler_->HasCustomIcon());
428 429
429 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); 430 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
430 lock_handler_.reset(new TestLockHandler(account_id_)); 431 lock_handler_.reset(new TestLockHandler(account_id_));
431 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 432 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
432 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); 433 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get());
433 434
434 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 435 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
435 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 436 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
436 lock_handler_->GetAuthType(account_id_)); 437 lock_handler_->GetAuthType(account_id_));
437 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 438 ASSERT_TRUE(lock_handler_->HasCustomIcon());
438 } 439 }
439 440
440 TEST_F(EasyUnlockScreenlockStateHandlerTest, StateChangeWhileScreenUnlocked) { 441 TEST_F(EasyUnlockScreenlockStateHandlerTest, StateChangeWhileScreenUnlocked) {
441 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 442 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
442 443
443 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 444 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
444 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 445 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
445 lock_handler_->GetAuthType(account_id_)); 446 lock_handler_->GetAuthType(account_id_));
446 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 447 ASSERT_TRUE(lock_handler_->HasCustomIcon());
447 448
448 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); 449 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
449 lock_handler_.reset(new TestLockHandler(account_id_)); 450 lock_handler_.reset(new TestLockHandler(account_id_));
450 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 451 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
451 452
452 state_handler_->ChangeState(ScreenlockState::BLUETOOTH_CONNECTING); 453 state_handler_->ChangeState(ScreenlockState::BLUETOOTH_CONNECTING);
453 454
454 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); 455 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get());
455 456
456 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 457 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
457 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 458 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
458 lock_handler_->GetAuthType(account_id_)); 459 lock_handler_->GetAuthType(account_id_));
459 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 460 ASSERT_TRUE(lock_handler_->HasCustomIcon());
460 EXPECT_EQ(kSpinnerIconId, lock_handler_->GetCustomIconId()); 461 EXPECT_EQ(kSpinnerIconId, lock_handler_->GetCustomIconId());
461 } 462 }
462 463
463 TEST_F(EasyUnlockScreenlockStateHandlerTest, 464 TEST_F(EasyUnlockScreenlockStateHandlerTest,
464 HardlockEnabledAfterInitialUnlock) { 465 HardlockEnabledAfterInitialUnlock) {
465 state_handler_->SetTrialRun(); 466 state_handler_->SetTrialRun();
466 467
467 std::vector<ScreenlockState> states; 468 std::vector<ScreenlockState> states;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 state_handler_->ChangeState(ScreenlockState::BLUETOOTH_CONNECTING); 589 state_handler_->ChangeState(ScreenlockState::BLUETOOTH_CONNECTING);
589 EXPECT_EQ(base::ASCIIToUTF16("xxx"), lock_handler_->GetAuthValue()); 590 EXPECT_EQ(base::ASCIIToUTF16("xxx"), lock_handler_->GetAuthValue());
590 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 591 ASSERT_TRUE(lock_handler_->HasCustomIcon());
591 EXPECT_EQ(kSpinnerIconId, lock_handler_->GetCustomIconId()); 592 EXPECT_EQ(kSpinnerIconId, lock_handler_->GetCustomIconId());
592 } 593 }
593 594
594 TEST_F(EasyUnlockScreenlockStateHandlerTest, StateChangesIgnoredIfHardlocked) { 595 TEST_F(EasyUnlockScreenlockStateHandlerTest, StateChangesIgnoredIfHardlocked) {
595 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 596 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
596 597
597 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 598 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
598 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 599 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
599 lock_handler_->GetAuthType(account_id_)); 600 lock_handler_->GetAuthType(account_id_));
600 601
601 state_handler_->SetHardlockState( 602 state_handler_->SetHardlockState(
602 EasyUnlockScreenlockStateHandler::USER_HARDLOCK); 603 EasyUnlockScreenlockStateHandler::USER_HARDLOCK);
603 604
604 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 605 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
605 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 606 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
606 lock_handler_->GetAuthType(account_id_)); 607 lock_handler_->GetAuthType(account_id_));
607 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 608 ASSERT_TRUE(lock_handler_->HasCustomIcon());
608 EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId()); 609 EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId());
609 610
610 state_handler_->ChangeState(ScreenlockState::NO_PHONE); 611 state_handler_->ChangeState(ScreenlockState::NO_PHONE);
611 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 612 ASSERT_TRUE(lock_handler_->HasCustomIcon());
612 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 613 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
613 614
614 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 615 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
615 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 616 ASSERT_TRUE(lock_handler_->HasCustomIcon());
616 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 617 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
617 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 618 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
618 lock_handler_->GetAuthType(account_id_)); 619 lock_handler_->GetAuthType(account_id_));
619 } 620 }
620 621
621 TEST_F(EasyUnlockScreenlockStateHandlerTest, 622 TEST_F(EasyUnlockScreenlockStateHandlerTest,
622 LockScreenChangeableOnLockAfterHardlockReset) { 623 LockScreenChangeableOnLockAfterHardlockReset) {
623 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 624 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
624 625
625 state_handler_->SetHardlockState( 626 state_handler_->SetHardlockState(
626 EasyUnlockScreenlockStateHandler::USER_HARDLOCK); 627 EasyUnlockScreenlockStateHandler::USER_HARDLOCK);
627 EXPECT_EQ(2u, lock_handler_->GetAndResetShowIconCount()); 628 EXPECT_EQ(2u, lock_handler_->GetAndResetShowIconCount());
(...skipping 11 matching lines...) Expand all
639 EXPECT_EQ(2u, lock_handler_->GetAndResetShowIconCount()); 640 EXPECT_EQ(2u, lock_handler_->GetAndResetShowIconCount());
640 EXPECT_TRUE(lock_handler_->HasCustomIcon()); 641 EXPECT_TRUE(lock_handler_->HasCustomIcon());
641 642
642 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); 643 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
643 lock_handler_.reset(new TestLockHandler(account_id_)); 644 lock_handler_.reset(new TestLockHandler(account_id_));
644 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 645 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
645 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); 646 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get());
646 647
647 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 648 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
648 EXPECT_TRUE(lock_handler_->HasCustomIcon()); 649 EXPECT_TRUE(lock_handler_->HasCustomIcon());
649 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 650 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
650 lock_handler_->GetAuthType(account_id_)); 651 lock_handler_->GetAuthType(account_id_));
651 EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()); 652 EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId());
652 653
653 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 654 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
654 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 655 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
655 EXPECT_TRUE(lock_handler_->HasCustomIcon()); 656 EXPECT_TRUE(lock_handler_->HasCustomIcon());
656 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 657 EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK,
657 lock_handler_->GetAuthType(account_id_)); 658 lock_handler_->GetAuthType(account_id_));
658 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); 659 EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick());
659 } 660 }
660 661
661 TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockStatePersistsOverUnlocks) { 662 TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockStatePersistsOverUnlocks) {
662 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 663 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
663 state_handler_->SetHardlockState( 664 state_handler_->SetHardlockState(
664 EasyUnlockScreenlockStateHandler::USER_HARDLOCK); 665 EasyUnlockScreenlockStateHandler::USER_HARDLOCK);
665 EXPECT_EQ(2u, lock_handler_->GetAndResetShowIconCount()); 666 EXPECT_EQ(2u, lock_handler_->GetAndResetShowIconCount());
666 667
667 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); 668 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
668 lock_handler_.reset(new TestLockHandler(account_id_)); 669 lock_handler_.reset(new TestLockHandler(account_id_));
669 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 670 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
670 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); 671 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get());
671 672
672 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); 673 EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount());
673 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 674 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
674 lock_handler_->GetAuthType(account_id_)); 675 lock_handler_->GetAuthType(account_id_));
675 ASSERT_TRUE(lock_handler_->HasCustomIcon()); 676 ASSERT_TRUE(lock_handler_->HasCustomIcon());
676 EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId()); 677 EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId());
677 678
678 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); 679 state_handler_->ChangeState(ScreenlockState::AUTHENTICATED);
679 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); 680 EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
680 EXPECT_TRUE(lock_handler_->HasCustomIcon()); 681 EXPECT_TRUE(lock_handler_->HasCustomIcon());
681 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, 682 EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD,
682 lock_handler_->GetAuthType(account_id_)); 683 lock_handler_->GetAuthType(account_id_));
683 } 684 }
684 685
685 TEST_F(EasyUnlockScreenlockStateHandlerTest, NoOverrideOnlineSignin) { 686 TEST_F(EasyUnlockScreenlockStateHandlerTest, NoOverrideOnlineSignin) {
686 lock_handler_->SetAuthType( 687 lock_handler_->SetAuthType(account_id_,
687 account_id_, 688 proximity_auth::mojom::AuthType::ONLINE_SIGN_IN,
688 proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, 689 base::string16());
689 base::string16());
690 690
691 std::vector<ScreenlockState> states; 691 std::vector<ScreenlockState> states;
692 states.push_back(ScreenlockState::NO_BLUETOOTH); 692 states.push_back(ScreenlockState::NO_BLUETOOTH);
693 states.push_back(ScreenlockState::NO_PHONE); 693 states.push_back(ScreenlockState::NO_PHONE);
694 states.push_back(ScreenlockState::PHONE_UNSUPPORTED); 694 states.push_back(ScreenlockState::PHONE_UNSUPPORTED);
695 states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE); 695 states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE);
696 states.push_back(ScreenlockState::PHONE_NOT_AUTHENTICATED); 696 states.push_back(ScreenlockState::PHONE_NOT_AUTHENTICATED);
697 states.push_back(ScreenlockState::PHONE_LOCKED); 697 states.push_back(ScreenlockState::PHONE_LOCKED);
698 states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE); 698 states.push_back(ScreenlockState::PHONE_NOT_LOCKABLE);
699 states.push_back(ScreenlockState::PHONE_UNSUPPORTED); 699 states.push_back(ScreenlockState::PHONE_UNSUPPORTED);
700 states.push_back(ScreenlockState::RSSI_TOO_LOW); 700 states.push_back(ScreenlockState::RSSI_TOO_LOW);
701 states.push_back(ScreenlockState::PHONE_LOCKED_AND_RSSI_TOO_LOW); 701 states.push_back(ScreenlockState::PHONE_LOCKED_AND_RSSI_TOO_LOW);
702 states.push_back(ScreenlockState::AUTHENTICATED); 702 states.push_back(ScreenlockState::AUTHENTICATED);
703 703
704 for (size_t i = 0; i < states.size(); ++i) { 704 for (size_t i = 0; i < states.size(); ++i) {
705 state_handler_->ChangeState(states[i]); 705 state_handler_->ChangeState(states[i]);
706 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, 706 EXPECT_EQ(proximity_auth::mojom::AuthType::ONLINE_SIGN_IN,
707 lock_handler_->GetAuthType(account_id_)); 707 lock_handler_->GetAuthType(account_id_));
708 EXPECT_FALSE(lock_handler_->HasCustomIcon()); 708 EXPECT_FALSE(lock_handler_->HasCustomIcon());
709 } 709 }
710 710
711 std::vector<EasyUnlockScreenlockStateHandler::HardlockState> hardlock_states; 711 std::vector<EasyUnlockScreenlockStateHandler::HardlockState> hardlock_states;
712 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::NO_HARDLOCK); 712 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::NO_HARDLOCK);
713 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::USER_HARDLOCK); 713 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::USER_HARDLOCK);
714 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::PAIRING_CHANGED); 714 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::PAIRING_CHANGED);
715 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::PAIRING_ADDED); 715 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::PAIRING_ADDED);
716 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::NO_PAIRING); 716 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::NO_PAIRING);
717 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::LOGIN_FAILED); 717 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::LOGIN_FAILED);
718 718
719 for (size_t i = 0; i < hardlock_states.size(); ++i) { 719 for (size_t i = 0; i < hardlock_states.size(); ++i) {
720 state_handler_->SetHardlockState(hardlock_states[i]); 720 state_handler_->SetHardlockState(hardlock_states[i]);
721 EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, 721 EXPECT_EQ(proximity_auth::mojom::AuthType::ONLINE_SIGN_IN,
722 lock_handler_->GetAuthType(account_id_)); 722 lock_handler_->GetAuthType(account_id_));
723 EXPECT_FALSE(lock_handler_->HasCustomIcon()); 723 EXPECT_FALSE(lock_handler_->HasCustomIcon());
724 } 724 }
725 } 725 }
726 726
727 TEST_F(EasyUnlockScreenlockStateHandlerTest, TrialRunMetrics) { 727 TEST_F(EasyUnlockScreenlockStateHandlerTest, TrialRunMetrics) {
728 base::HistogramTester histogram_tester; 728 base::HistogramTester histogram_tester;
729 729
730 // Simulate the user clicking on the lock icon twice outside of a trial run. 730 // Simulate the user clicking on the lock icon twice outside of a trial run.
731 // No trial run metrics should be recorded. 731 // No trial run metrics should be recorded.
732 state_handler_->RecordClickOnLockIcon(); 732 state_handler_->RecordClickOnLockIcon();
733 state_handler_->RecordClickOnLockIcon(); 733 state_handler_->RecordClickOnLockIcon();
734 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 0); 734 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 0);
735 735
736 // Simulate the user clicking on the lock icon three times during a trial run. 736 // Simulate the user clicking on the lock icon three times during a trial run.
737 state_handler_->SetTrialRun(); 737 state_handler_->SetTrialRun();
738 state_handler_->RecordClickOnLockIcon(); 738 state_handler_->RecordClickOnLockIcon();
739 state_handler_->RecordClickOnLockIcon(); 739 state_handler_->RecordClickOnLockIcon();
740 state_handler_->RecordClickOnLockIcon(); 740 state_handler_->RecordClickOnLockIcon();
741 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4); 741 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4);
742 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events", 742 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events",
743 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1); 743 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1);
744 histogram_tester.ExpectBucketCount( 744 histogram_tester.ExpectBucketCount(
745 "EasyUnlock.TrialRun.Events", 745 "EasyUnlock.TrialRun.Events",
746 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3); 746 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3);
747 } 747 }
748 748
749 } // namespace 749 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_screenlock_state_handler.cc ('k') | chrome/browser/ui/ash/lock_screen_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698