| 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" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/test/histogram_tester.h" | 13 #include "base/test/histogram_tester.h" |
| 14 #include "chrome/browser/signin/easy_unlock_metrics.h" | 14 #include "chrome/browser/signin/easy_unlock_metrics.h" |
| 15 #include "chrome/browser/signin/easy_unlock_service.h" | 15 #include "chrome/browser/signin/easy_unlock_service.h" |
| 16 #include "chrome/browser/signin/screenlock_bridge.h" | |
| 17 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 17 #include "components/signin/content/screenlock_bridge.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // Icons used by EasyUnlockScreenlockStateHandler. The icon id values are the | 23 // Icons used by EasyUnlockScreenlockStateHandler. The icon id values are the |
| 24 // same as the ones set by ScreenlockBridge. | 24 // same as the ones set by ScreenlockBridge. |
| 25 const char kLockedIconId[] = "locked"; | 25 const char kLockedIconId[] = "locked"; |
| 26 const char kLockedToBeActivatedIconId[] = "locked-to-be-activated"; | 26 const char kLockedToBeActivatedIconId[] = "locked-to-be-activated"; |
| 27 const char kUnlockedIconId[] = "unlocked"; | 27 const char kUnlockedIconId[] = "unlocked"; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 ScreenType GetScreenType() const override { | 91 ScreenType GetScreenType() const override { |
| 92 return LOCK_SCREEN; | 92 return LOCK_SCREEN; |
| 93 } | 93 } |
| 94 | 94 |
| 95 void Unlock(const std::string& user_email) override { | 95 void Unlock(const std::string& user_email) override { |
| 96 ASSERT_FALSE(true) << "Should not be reached."; | 96 ASSERT_FALSE(true) << "Should not be reached."; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void Lock(content::BrowserContext* browser_context) override { |
| 100 ASSERT_FALSE(true) << "Should not be reached."; |
| 101 } |
| 102 |
| 103 void Unlock(content::BrowserContext* browser_context) override { |
| 104 ASSERT_FALSE(true) << "Should not be reached."; |
| 105 } |
| 106 |
| 99 void AttemptEasySignin(const std::string& user_email, | 107 void AttemptEasySignin(const std::string& user_email, |
| 100 const std::string& secret, | 108 const std::string& secret, |
| 101 const std::string& key_label) override { | 109 const std::string& key_label) override { |
| 102 ASSERT_FALSE(true) << "Should not be reached."; | 110 ASSERT_FALSE(true) << "Should not be reached."; |
| 103 } | 111 } |
| 104 | 112 |
| 105 // Utility methods used by tests: | 113 // Utility methods used by tests: |
| 106 | 114 |
| 107 // Gets last set auth value. | 115 // Gets last set auth value. |
| 108 base::string16 GetAuthValue() const { | 116 base::string16 GetAuthValue() const { |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 state_handler_->RecordClickOnLockIcon(); | 778 state_handler_->RecordClickOnLockIcon(); |
| 771 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4); | 779 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4); |
| 772 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events", | 780 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events", |
| 773 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1); | 781 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1); |
| 774 histogram_tester.ExpectBucketCount( | 782 histogram_tester.ExpectBucketCount( |
| 775 "EasyUnlock.TrialRun.Events", | 783 "EasyUnlock.TrialRun.Events", |
| 776 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3); | 784 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3); |
| 777 } | 785 } |
| 778 | 786 |
| 779 } // namespace | 787 } // namespace |
| OLD | NEW |