OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "crypto/mock_apple_keychain.h" |
| 6 |
5 #include "base/logging.h" | 7 #include "base/logging.h" |
6 #include "base/macros.h" | 8 #include "base/macros.h" |
7 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram_macros.h" |
8 #include "base/time/time.h" | 10 #include "base/time/time.h" |
9 #include "crypto/mock_apple_keychain.h" | |
10 | 11 |
11 namespace { | 12 namespace { |
12 | 13 |
13 // Adds an entry to a local histogram to indicate that the Apple Keychain would | 14 // Adds an entry to a local histogram to indicate that the Apple Keychain would |
14 // have been accessed, if this class were not a mock of the Apple Keychain. | 15 // have been accessed, if this class were not a mock of the Apple Keychain. |
15 void IncrementKeychainAccessHistogram() { | 16 void IncrementKeychainAccessHistogram() { |
16 // This local histogram is accessed by Telemetry to track the number of times | 17 // This local histogram is accessed by Telemetry to track the number of times |
17 // the keychain is accessed, since keychain access is known to be synchronous | 18 // the keychain is accessed, since keychain access is known to be synchronous |
18 // and slow. | 19 // and slow. |
19 LOCAL_HISTOGRAM_BOOLEAN("OSX.Keychain.Access", true); | 20 LOCAL_HISTOGRAM_BOOLEAN("OSX.Keychain.Access", true); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 passwordLength); | 77 passwordLength); |
77 return noErr; | 78 return noErr; |
78 } | 79 } |
79 | 80 |
80 std::string MockAppleKeychain::GetEncryptionPassword() const { | 81 std::string MockAppleKeychain::GetEncryptionPassword() const { |
81 IncrementKeychainAccessHistogram(); | 82 IncrementKeychainAccessHistogram(); |
82 return "mock_password"; | 83 return "mock_password"; |
83 } | 84 } |
84 | 85 |
85 } // namespace crypto | 86 } // namespace crypto |
OLD | NEW |