| 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 20 matching lines...) Expand all Loading... |
| 31 const char kUnlockedIconId[] = "unlocked"; | 31 const char kUnlockedIconId[] = "unlocked"; |
| 32 const char kSpinnerIconId[] = "spinner"; | 32 const char kSpinnerIconId[] = "spinner"; |
| 33 const char kHardlockedIconId[] = "hardlocked"; | 33 const char kHardlockedIconId[] = "hardlocked"; |
| 34 | 34 |
| 35 // Checks if |input| string has any unreplaced placeholders. | 35 // Checks if |input| string has any unreplaced placeholders. |
| 36 bool StringHasPlaceholders(const base::string16& input) { | 36 bool StringHasPlaceholders(const base::string16& input) { |
| 37 std::vector<size_t> offsets; | 37 std::vector<size_t> offsets; |
| 38 std::vector<base::string16> subst; | 38 std::vector<base::string16> subst; |
| 39 subst.push_back(base::string16()); | 39 subst.push_back(base::string16()); |
| 40 | 40 |
| 41 base::string16 replaced = ReplaceStringPlaceholders(input, subst, &offsets); | 41 base::string16 replaced = |
| 42 base::ReplaceStringPlaceholders(input, subst, &offsets); |
| 42 return !offsets.empty(); | 43 return !offsets.empty(); |
| 43 } | 44 } |
| 44 | 45 |
| 45 // Fake lock handler to be used in these tests. | 46 // Fake lock handler to be used in these tests. |
| 46 class TestLockHandler : public proximity_auth::ScreenlockBridge::LockHandler { | 47 class TestLockHandler : public proximity_auth::ScreenlockBridge::LockHandler { |
| 47 public: | 48 public: |
| 48 explicit TestLockHandler(const std::string& user_email) | 49 explicit TestLockHandler(const std::string& user_email) |
| 49 : user_email_(user_email), | 50 : user_email_(user_email), |
| 50 show_icon_count_(0u), | 51 show_icon_count_(0u), |
| 51 auth_type_(OFFLINE_PASSWORD) { | 52 auth_type_(OFFLINE_PASSWORD) { |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 state_handler_->RecordClickOnLockIcon(); | 733 state_handler_->RecordClickOnLockIcon(); |
| 733 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4); | 734 histogram_tester.ExpectTotalCount("EasyUnlock.TrialRun.Events", 4); |
| 734 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events", | 735 histogram_tester.ExpectBucketCount("EasyUnlock.TrialRun.Events", |
| 735 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1); | 736 EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED, 1); |
| 736 histogram_tester.ExpectBucketCount( | 737 histogram_tester.ExpectBucketCount( |
| 737 "EasyUnlock.TrialRun.Events", | 738 "EasyUnlock.TrialRun.Events", |
| 738 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3); | 739 EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON, 3); |
| 739 } | 740 } |
| 740 | 741 |
| 741 } // namespace | 742 } // namespace |
| OLD | NEW |