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

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

Issue 935303002: [Smart Lock] Measure clicks on the lock icon during Easy Unlock's trial run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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"
6
5 #include <string> 7 #include <string>
6 #include <vector> 8 #include <vector>
7 9
8 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
9 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" 13 #include "base/test/histogram_tester.h"
14 #include "chrome/browser/signin/easy_unlock_metrics.h"
12 #include "chrome/browser/signin/easy_unlock_service.h" 15 #include "chrome/browser/signin/easy_unlock_service.h"
13 #include "chrome/browser/signin/screenlock_bridge.h" 16 #include "chrome/browser/signin/screenlock_bridge.h"
14 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
15 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
16 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
17 20
18 namespace { 21 namespace {
19 22
20 // Icons used by EasyUnlockScreenlockStateHandler. The icon id values are the 23 // Icons used by EasyUnlockScreenlockStateHandler. The icon id values are the
21 // same as the ones set by ScreenlockBridge. 24 // same as the ones set by ScreenlockBridge.
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::LOGIN_FAILED); 747 hardlock_states.push_back(EasyUnlockScreenlockStateHandler::LOGIN_FAILED);
745 748
746 for (size_t i = 0; i < hardlock_states.size(); ++i) { 749 for (size_t i = 0; i < hardlock_states.size(); ++i) {
747 state_handler_->SetHardlockState(hardlock_states[i]); 750 state_handler_->SetHardlockState(hardlock_states[i]);
748 EXPECT_EQ(ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, 751 EXPECT_EQ(ScreenlockBridge::LockHandler::ONLINE_SIGN_IN,
749 lock_handler_->GetAuthType(user_email_)); 752 lock_handler_->GetAuthType(user_email_));
750 EXPECT_FALSE(lock_handler_->HasCustomIcon()); 753 EXPECT_FALSE(lock_handler_->HasCustomIcon());
751 } 754 }
752 } 755 }
753 756
757 TEST_F(EasyUnlockScreenlockStateHandlerTest, TrialRunMetrics) {
758 base::HistogramTester histogram_tester;
759
760 // Simulate the user clicking on the lock icon twice outside of a trial run.
761 // No trial run metrics should be recorded.
762 state_handler_->RecordClickOnLockIcon();
763 state_handler_->RecordClickOnLockIcon();
764 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 0);
765
766 // Simulate the user clicking on the lock icon three times during a trial run.
767 state_handler_->SetTrialRun();
768 state_handler_->RecordClickOnLockIcon();
769 state_handler_->RecordClickOnLockIcon();
770 state_handler_->RecordClickOnLockIcon();
771 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4);
772 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events",
773 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1);
774 histogram_tester.ExpectBucketCount(
775 "EasyUnlock.TrialRun.Events",
776 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3);
777 }
778
754 } // namespace 779 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_screenlock_state_handler.cc ('k') | chrome/browser/signin/easy_unlock_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698