OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 // metrics api test |
| 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Metrics |
| 7 |
| 8 // Any changes to the logging done in these functions should be matched |
| 9 // with the checks done in IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Metrics). |
| 10 // See extension_metrics_apitest.cc. |
| 11 chrome.test.runTests([ |
| 12 function recordUserAction() { |
| 13 // Log a metric once. |
| 14 chrome.metrics.recordUserAction('test.ua.1'); |
| 15 |
| 16 // Log a metric more than once. |
| 17 chrome.metrics.recordUserAction('test.ua.2'); |
| 18 chrome.metrics.recordUserAction('test.ua.2'); |
| 19 |
| 20 chrome.test.succeed(); |
| 21 }, |
| 22 |
| 23 function recordValue() { |
| 24 chrome.metrics.recordValue({ |
| 25 'metricName': 'test.h.1', |
| 26 'type': 'histogram-log', |
| 27 'min': 1, |
| 28 'max': 100, |
| 29 'buckets': 50 |
| 30 }, 42); |
| 31 |
| 32 chrome.metrics.recordValue({ |
| 33 'metricName': 'test.h.2', |
| 34 'type': 'histogram-linear', |
| 35 'min': 1, |
| 36 'max': 200, |
| 37 'buckets': 50 |
| 38 }, 42); |
| 39 |
| 40 chrome.metrics.recordPercentage('test.h.3', 42); |
| 41 chrome.metrics.recordPercentage('test.h.3', 42); |
| 42 |
| 43 chrome.test.succeed(); |
| 44 }, |
| 45 |
| 46 function recordTimes() { |
| 47 chrome.metrics.recordTime('test.time', 42); |
| 48 chrome.metrics.recordMediumTime('test.medium.time', 42 * 1000); |
| 49 chrome.metrics.recordLongTime('test.long.time', 42 * 1000 * 60); |
| 50 |
| 51 chrome.test.succeed(); |
| 52 }, |
| 53 |
| 54 function recordCounts() { |
| 55 chrome.metrics.recordCount('test.count', 420000); |
| 56 chrome.metrics.recordMediumCount('test.medium.count', 4200); |
| 57 chrome.metrics.recordSmallCount('test.small.count', 42); |
| 58 |
| 59 chrome.test.succeed(); |
| 60 } |
| 61 ]); |
| 62 |
OLD | NEW |