OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview Fake implementation of chrome histogram recording for testing. |
| 7 */ |
| 8 cr.define('settings', function() { |
| 9 /** |
| 10 * Fake of the chrome.quickUnlockUma. |
| 11 * @constructor |
| 12 */ |
| 13 function FakeQuickUnlockUma() { |
| 14 this.histogram = {}; |
| 15 for (var key in LockScreenProgress) |
| 16 this.histogram[LockScreenProgress[key]] = 0; |
| 17 } |
| 18 |
| 19 FakeQuickUnlockUma.prototype = { |
| 20 /** |
| 21 * Update the histgoram at |key| by one. |
| 22 * @param {LockScreenProgress} key |
| 23 */ |
| 24 recordProgress: function(key) { |
| 25 if (!(key in this.histogram)) |
| 26 this.histogram[key] = 0; |
| 27 this.histogram[key]++; |
| 28 }, |
| 29 |
| 30 /** |
| 31 * Get the value of the uma histogram at |key|. |
| 32 * @param {LockScreenProgress} key |
| 33 * @return {Number} |
| 34 */ |
| 35 getHistogramValue: function(key) { |
| 36 return this.histogram[key]; |
| 37 } |
| 38 }; |
| 39 |
| 40 return {FakeQuickUnlockUma: FakeQuickUnlockUma}; |
| 41 }); |
OLD | NEW |