Index: chrome/test/data/webui/settings/fake_quick_unlock_uma.js |
diff --git a/chrome/test/data/webui/settings/fake_quick_unlock_uma.js b/chrome/test/data/webui/settings/fake_quick_unlock_uma.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a472bb484113b1cd514ec1e333b1681640646439 |
--- /dev/null |
+++ b/chrome/test/data/webui/settings/fake_quick_unlock_uma.js |
@@ -0,0 +1,41 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+/** |
+ * @fileoverview Fake implementation of chrome histogram recording for testing. |
+ */ |
+cr.define('settings', function() { |
+ /** |
+ * Fake of the chrome.quickUnlockUma. |
+ * @constructor |
+ */ |
+ function FakeQuickUnlockUma() { |
+ this.histogram = {}; |
+ for (var key in LockScreenProgress) |
+ this.histogram[LockScreenProgress[key]] = 0; |
+ } |
+ |
+ FakeQuickUnlockUma.prototype = { |
+ /** |
+ * Update the histgoram at |key| by one. |
+ * @param {LockScreenProgress} key |
+ */ |
+ recordProgress: function(key) { |
+ if (!(key in this.histogram)) |
+ this.histogram[key] = 0; |
+ this.histogram[key]++; |
+ }, |
+ |
+ /** |
+ * Get the value of the uma histogram at |key|. |
+ * @param {LockScreenProgress} key |
+ * @return {Number} |
+ */ |
+ getHistogramValue: function(key) { |
+ return this.histogram[key]; |
+ } |
+ }; |
+ |
+ return {FakeQuickUnlockUma: FakeQuickUnlockUma}; |
+}); |