Chromium Code Reviews| 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 // metrics api test | 5 // metrics api test |
| 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Metrics | 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Metrics |
| 7 | 7 |
| 8 // Any changes to the logging done in these functions should be matched | 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). | 9 // with the checks done in IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Metrics). |
| 10 // See metrics_apitest.cc. | 10 // See metrics_apitest.cc. |
| 11 chrome.test.runTests([ | 11 chrome.test.runTests([ |
| 12 function getIsCrashReportingEnabled() { | |
| 13 chrome.metricsPrivate.getIsCrashReportingEnabled(function(enabled) { | |
| 14 chrome.test.assertEq('boolean', typeof enabled); | |
|
Devlin
2016/10/01 01:25:14
It'd be kind of nice to verify the result is corre
| |
| 15 chrome.test.succeed(); | |
| 16 }); | |
| 17 }, | |
| 18 | |
| 12 function recordUserAction() { | 19 function recordUserAction() { |
| 13 // Log a metric once. | 20 // Log a metric once. |
| 14 chrome.metricsPrivate.recordUserAction('test.ua.1'); | 21 chrome.metricsPrivate.recordUserAction('test.ua.1'); |
| 15 | 22 |
| 16 // Log a metric more than once. | 23 // Log a metric more than once. |
| 17 chrome.metricsPrivate.recordUserAction('test.ua.2'); | 24 chrome.metricsPrivate.recordUserAction('test.ua.2'); |
| 18 chrome.metricsPrivate.recordUserAction('test.ua.2'); | 25 chrome.metricsPrivate.recordUserAction('test.ua.2'); |
| 19 | 26 |
| 20 chrome.test.succeed(); | 27 chrome.test.succeed(); |
| 21 }, | 28 }, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 // This one should be rejected because the bucket count is different. | 152 // This one should be rejected because the bucket count is different. |
| 146 // We check for sample count == 2 in metrics_apitest.cc | 153 // We check for sample count == 2 in metrics_apitest.cc |
| 147 chrome.metricsPrivate.recordValue(log2, 42); | 154 chrome.metricsPrivate.recordValue(log2, 42); |
| 148 chrome.metricsPrivate.recordValue(log1, 42); | 155 chrome.metricsPrivate.recordValue(log1, 42); |
| 149 | 156 |
| 150 chrome.test.succeed(); | 157 chrome.test.succeed(); |
| 151 }, | 158 }, |
| 152 | 159 |
| 153 ]); | 160 ]); |
| 154 | 161 |
| OLD | NEW |