summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 12:02:06 +0000
committerkaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 12:02:06 +0000
commitda5ba6982c90521b37c966a775c88d444079938e (patch)
tree5cd1189d35b9520b1a2012b11aa8195b596d63c4
parentce178df9466d2cd0a0c9a15a94c94c5b466f83f7 (diff)
downloadchromium_src-da5ba6982c90521b37c966a775c88d444079938e.zip
chromium_src-da5ba6982c90521b37c966a775c88d444079938e.tar.gz
chromium_src-da5ba6982c90521b37c966a775c88d444079938e.tar.bz2
Moving experimental.metrics API to metricsPrivate
1. experimental.metrics is now metricsPrivate 2. metricsPrivate is available to component extensions only 3. removed getEnabled/setEnabled functions as useless/harmful. BUG= TEST= Review URL: http://codereview.chromium.org/8548013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111136 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.cc2
-rw-r--r--chrome/browser/extensions/extension_metrics_apitest.cc44
-rw-r--r--chrome/browser/extensions/extension_metrics_module.cc47
-rw-r--r--chrome/browser/extensions/extension_metrics_module.h30
-rw-r--r--chrome/browser/resources/file_manager/js/metrics.js14
-rw-r--r--chrome/browser/resources/file_manager/manifest.json2
-rw-r--r--chrome/common/extensions/api/extension_api.json35
-rw-r--r--chrome/common/extensions/extension_permission_set.cc3
-rw-r--r--chrome/common/extensions/extension_permission_set.h1
-rw-r--r--chrome/common/extensions/extension_permission_set_unittest.cc4
-rw-r--r--chrome/test/data/extensions/api_test/metrics/manifest.json5
-rw-r--r--chrome/test/data/extensions/api_test/metrics/test.js50
12 files changed, 53 insertions, 184 deletions
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 9de1930..8ea8bb7 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -235,8 +235,6 @@ void FactoryRegistry::ResetFunctions() {
RegisterFunction<GetProcessIdForTabFunction>();
// Metrics.
- RegisterFunction<MetricsGetEnabledFunction>();
- RegisterFunction<MetricsSetEnabledFunction>();
RegisterFunction<MetricsRecordUserActionFunction>();
RegisterFunction<MetricsRecordValueFunction>();
RegisterFunction<MetricsRecordPercentageFunction>();
diff --git a/chrome/browser/extensions/extension_metrics_apitest.cc b/chrome/browser/extensions/extension_metrics_apitest.cc
index f96d4ac..3d8b506 100644
--- a/chrome/browser/extensions/extension_metrics_apitest.cc
+++ b/chrome/browser/extensions/extension_metrics_apitest.cc
@@ -6,8 +6,6 @@
#include "base/metrics/histogram.h"
#include "chrome/browser/extensions/extension_apitest.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/extension.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
@@ -17,7 +15,7 @@ namespace {
// user actions, with the specified counts. If the tests in test.js are
// modified, this array may need to be updated.
struct RecordedUserAction {
- const char* name; // base name of metric without extension id.
+ const char* name;
int count; // number of times the metric was recorded.
} g_user_actions[] = {
{"test.ua.1", 1},
@@ -28,7 +26,7 @@ struct RecordedUserAction {
// histograms. If the tests in test.js are modified, this array may need to be
// updated.
struct RecordedHistogram {
- const char* name; // base name of metric without extension id.
+ const char* name;
base::Histogram::ClassType type;
int min;
int max;
@@ -45,24 +43,13 @@ struct RecordedHistogram {
{"test.small.count", base::Histogram::HISTOGRAM, 1, 100, 50},
};
-// Build the full name of a metrics for the given extension. Each metric
-// is made up of the unique name within the extension followed by the
-// extension's id.
-std::string BuildFullName(const std::string& name, const Extension* extension) {
- std::string full_name(name);
- full_name += extension->id();
- return full_name;
-}
-
// This class observes and collects user action notifications that are sent
// by the tests, so that they can be examined afterwards for correctness.
class UserActionObserver : public content::NotificationObserver {
public:
UserActionObserver();
- void ValidateUserActions(const Extension* extension,
- const RecordedUserAction* recorded,
- int count);
+ void ValidateUserActions(const RecordedUserAction* recorded, int count);
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -96,19 +83,17 @@ void UserActionObserver::Observe(int type,
++(count_map_[name]);
}
-void UserActionObserver::ValidateUserActions(const Extension* extension,
- const RecordedUserAction* recorded,
+void UserActionObserver::ValidateUserActions(const RecordedUserAction* recorded,
int count) {
EXPECT_EQ(count, num_metrics());
for (int i = 0; i < count; ++i) {
const RecordedUserAction& ua = recorded[i];
- EXPECT_EQ(ua.count, GetMetricCount(BuildFullName(ua.name, extension)));
+ EXPECT_EQ(ua.count, GetMetricCount(ua.name));
}
}
-void ValidateHistograms(const Extension* extension,
- const RecordedHistogram* recorded,
+void ValidateHistograms(const RecordedHistogram* recorded,
int count) {
base::StatisticsRecorder::Histograms histograms;
base::StatisticsRecorder::GetHistograms(&histograms);
@@ -119,13 +104,11 @@ void ValidateHistograms(const Extension* extension,
// correct.
for (int i = 0; i < count; ++i) {
const RecordedHistogram& r = recorded[i];
- std::string name(BuildFullName(r.name, extension));
-
size_t j = 0;
for (j = 0; j < histograms.size(); ++j) {
base::Histogram* histogram(histograms[j]);
- if (name == histogram->histogram_name()) {
+ if (r.name == histogram->histogram_name()) {
EXPECT_EQ(r.type, histogram->histogram_type());
EXPECT_EQ(r.min, histogram->declared_min());
EXPECT_EQ(r.max, histogram->declared_max());
@@ -140,17 +123,10 @@ void ValidateHistograms(const Extension* extension,
} // anonymous namespace
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Metrics) {
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kEnableExperimentalExtensionApis);
-
UserActionObserver observer;
- ASSERT_TRUE(RunExtensionTest("metrics")) << message_;
- const Extension* extension = GetSingleLoadedExtension();
- ASSERT_TRUE(extension);
+ ASSERT_TRUE(RunComponentExtensionTest("metrics")) << message_;
- observer.ValidateUserActions(extension,
- g_user_actions,
- arraysize(g_user_actions));
- ValidateHistograms(extension, g_histograms, arraysize(g_histograms));
+ observer.ValidateUserActions(g_user_actions, arraysize(g_user_actions));
+ ValidateHistograms(g_histograms, arraysize(g_histograms));
}
diff --git a/chrome/browser/extensions/extension_metrics_module.cc b/chrome/browser/extensions/extension_metrics_module.cc
index 4bba31b..cd80ef9 100644
--- a/chrome/browser/extensions/extension_metrics_module.cc
+++ b/chrome/browser/extensions/extension_metrics_module.cc
@@ -5,58 +5,16 @@
#include "chrome/browser/extensions/extension_metrics_module.h"
#include "base/metrics/histogram.h"
-#include "base/values.h"
#include "chrome/common/extensions/extension.h"
-#include "chrome/browser/ui/options/options_util.h"
-#include "chrome/installer/util/google_update_settings.h"
#include "content/browser/user_metrics.h"
using base::Histogram;
using base::LinearHistogram;
-namespace {
-
-// Build the full name of a metrics for the given extension.
-// For a non-component extension the metric name is made up of the unique name
-// within the extension followed by the extension's id. This keeps the metrics
-// from one extension unique from other extensions, as well as those metrics
-// from chrome itself.
-// For a component extension the metric name is used as is. There are not so
-// many of them and it is easy enough to prevent name clashes.
-std::string BuildMetricName(const std::string& name,
- const Extension* extension) {
- std::string full_name(name);
- if (extension->location() != Extension::COMPONENT)
- full_name += extension->id();
- return full_name;
-}
-
-} // anonymous namespace
-
-bool MetricsSetEnabledFunction::RunImpl() {
- bool enabled = false;
- EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(0, &enabled));
-
- // Using OptionsUtil is better because it actually ensures we reset all the
- // necessary threads. This is the main way for starting / stopping UMA and
- // crash reporting.
- // This method will return the resulting enabled, which we send to JS.
- bool result = OptionsUtil::ResolveMetricsReportingEnabled(enabled);
- result_.reset(Value::CreateBooleanValue(result));
- return true;
-}
-
-bool MetricsGetEnabledFunction::RunImpl() {
- bool enabled = GoogleUpdateSettings::GetCollectStatsConsent();
- result_.reset(Value::CreateBooleanValue(enabled));
- return true;
-}
-
bool MetricsRecordUserActionFunction::RunImpl() {
std::string name;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &name));
- name = BuildMetricName(name, GetExtension());
UserMetrics::RecordComputedAction(name);
return true;
}
@@ -74,16 +32,15 @@ bool MetricsHistogramHelperFunction::RecordValue(const std::string& name,
int max,
size_t buckets,
int sample) {
- std::string full_name = BuildMetricName(name, GetExtension());
Histogram* counter;
if (type == Histogram::LINEAR_HISTOGRAM) {
- counter = LinearHistogram::FactoryGet(full_name,
+ counter = LinearHistogram::FactoryGet(name,
min,
max,
buckets,
Histogram::kUmaTargetedHistogramFlag);
} else {
- counter = Histogram::FactoryGet(full_name,
+ counter = Histogram::FactoryGet(name,
min,
max,
buckets,
diff --git a/chrome/browser/extensions/extension_metrics_module.h b/chrome/browser/extensions/extension_metrics_module.h
index e2a9890..8c1ffa4 100644
--- a/chrome/browser/extensions/extension_metrics_module.h
+++ b/chrome/browser/extensions/extension_metrics_module.h
@@ -11,21 +11,9 @@
#include "base/metrics/histogram.h"
#include "chrome/browser/extensions/extension_function.h"
-class MetricsSetEnabledFunction : public SyncExtensionFunction {
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.setEnabled")
- protected:
- virtual bool RunImpl() OVERRIDE;
-};
-
-class MetricsGetEnabledFunction : public SyncExtensionFunction {
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.getEnabled")
- protected:
- virtual bool RunImpl() OVERRIDE;
-};
-
class MetricsRecordUserActionFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordUserAction")
+ DECLARE_EXTENSION_FUNCTION_NAME("metricsPrivate.recordUserAction")
};
class MetricsHistogramHelperFunction : public SyncExtensionFunction {
@@ -38,42 +26,42 @@ class MetricsHistogramHelperFunction : public SyncExtensionFunction {
class MetricsRecordValueFunction : public MetricsHistogramHelperFunction {
virtual bool RunImpl() OVERRIDE;
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordValue")
+ DECLARE_EXTENSION_FUNCTION_NAME("metricsPrivate.recordValue")
};
class MetricsRecordPercentageFunction : public MetricsHistogramHelperFunction {
virtual bool RunImpl() OVERRIDE;
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordPercentage")
+ DECLARE_EXTENSION_FUNCTION_NAME("metricsPrivate.recordPercentage")
};
class MetricsRecordCountFunction : public MetricsHistogramHelperFunction {
virtual bool RunImpl() OVERRIDE;
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordCount")
+ DECLARE_EXTENSION_FUNCTION_NAME("metricsPrivate.recordCount")
};
class MetricsRecordSmallCountFunction : public MetricsHistogramHelperFunction {
virtual bool RunImpl() OVERRIDE;
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordSmallCount")
+ DECLARE_EXTENSION_FUNCTION_NAME("metricsPrivate.recordSmallCount")
};
class MetricsRecordMediumCountFunction : public MetricsHistogramHelperFunction {
virtual bool RunImpl() OVERRIDE;
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordMediumCount")
+ DECLARE_EXTENSION_FUNCTION_NAME("metricsPrivate.recordMediumCount")
};
class MetricsRecordTimeFunction : public MetricsHistogramHelperFunction {
virtual bool RunImpl() OVERRIDE;
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordTime")
+ DECLARE_EXTENSION_FUNCTION_NAME("metricsPrivate.recordTime")
};
class MetricsRecordMediumTimeFunction : public MetricsHistogramHelperFunction {
virtual bool RunImpl() OVERRIDE;
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordMediumTime")
+ DECLARE_EXTENSION_FUNCTION_NAME("metricsPrivate.recordMediumTime")
};
class MetricsRecordLongTimeFunction : public MetricsHistogramHelperFunction {
virtual bool RunImpl() OVERRIDE;
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordLongTime")
+ DECLARE_EXTENSION_FUNCTION_NAME("metricsPrivate.recordLongTime")
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_METRICS_MODULE_H__
diff --git a/chrome/browser/resources/file_manager/js/metrics.js b/chrome/browser/resources/file_manager/js/metrics.js
index ebef967..d01c550 100644
--- a/chrome/browser/resources/file_manager/js/metrics.js
+++ b/chrome/browser/resources/file_manager/js/metrics.js
@@ -3,7 +3,7 @@
// found in the LICENSE file.
/**
- * @fileoverview Utility methods for accessing chrome.experimental.metrics API.
+ * @fileoverview Utility methods for accessing chrome.metricsPrivate API.
*
* To be included as a first script in main.html
*/
@@ -20,27 +20,25 @@ metrics.startInterval('TotalLoad');
metrics.startInterval('ScriptParse');
metrics.convertName_ = function(name) {
- // chrome.experimental.metrics will append extension ID after the last dot.
- return 'FileBrowser.' + name + '.';
+ return 'FileBrowser.' + name;
};
metrics.recordTime = function(name) {
if (name in metrics.intervals) {
var elapsed = Date.now() - metrics.intervals[name];
console.log(name + ': ' + elapsed + 'ms');
- chrome.experimental.metrics.recordTime(metrics.convertName_(name), elapsed);
+ chrome.metricsPrivate.recordTime(metrics.convertName_(name), elapsed);
} else {
console.error('Unknown interval: ' + name);
}
};
metrics.recordAction = function(name) {
- chrome.experimental.metrics.recordUserAction(metrics.convertName_(name));
+ chrome.metricsPrivate.recordUserAction(metrics.convertName_(name));
};
metrics.reportCount = function(name, value) {
- chrome.experimental.metrics.
- recordMediumCount(metrics.convertName_(name), value);
+ chrome.metricsPrivate.recordMediumCount(metrics.convertName_(name), value);
};
metrics.recordEnum = function(name, value, validValues) {
@@ -49,7 +47,7 @@ metrics.recordEnum = function(name, value, validValues) {
// Collect invalid values in the extra bucket at the end.
if (index < 0) index = validValues.length;
- chrome.experimental.metrics.recordValue({
+ chrome.metricsPrivate.recordValue({
'metricName': metrics.convertName_(name),
'type': 'histogram-linear',
'min': 0,
diff --git a/chrome/browser/resources/file_manager/manifest.json b/chrome/browser/resources/file_manager/manifest.json
index a881300..326665e 100644
--- a/chrome/browser/resources/file_manager/manifest.json
+++ b/chrome/browser/resources/file_manager/manifest.json
@@ -13,10 +13,10 @@
"fileBrowserHandler",
"fileBrowserPrivate",
"mediaPlayerPrivate",
+ "metricsPrivate",
"unlimitedStorage",
"chrome://extension-icon/",
"chrome://resources/",
- "experimental",
"tabs"
],
"app": {
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index 2651843..1fb9a7d 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -5164,7 +5164,7 @@
]
},
{
- "namespace": "experimental.metrics",
+ "namespace": "metricsPrivate",
"nodoc": true,
"types": [
{
@@ -5186,39 +5186,6 @@
],
"functions": [
{
- "name": "getEnabled",
- "type": "function",
- "description": "Gets the user preference to send UMA and crash reports to Google.",
- "parameters": [
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {"name": "enabled", "type": "boolean"}
- ]
- }
- ]
- },
- {
- "name": "setEnabled",
- "type": "function",
- "description": "Sets the user preference to send UMA and crash reports to Google.",
- "parameters": [
- {"name": "enabled", "type": "boolean", "description": "True for setting Chrome to actively send UMA and crash reports, false for disabling this."},
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "enabled",
- "type": "boolean",
- "description": "The actual value set. If it is not the one passed in parameter, the value couldn't be changed (e.g. because of security)."
- }
- ]
- }
- ]
- },
- {
"name": "recordUserAction",
"type": "function",
"description": "Records an action performed by the user.",
diff --git a/chrome/common/extensions/extension_permission_set.cc b/chrome/common/extensions/extension_permission_set.cc
index 9182d4a..0e36ed4 100644
--- a/chrome/common/extensions/extension_permission_set.cc
+++ b/chrome/common/extensions/extension_permission_set.cc
@@ -333,6 +333,9 @@ ExtensionPermissionsInfo::ExtensionPermissionsInfo()
RegisterPermission(
ExtensionAPIPermission::kMediaPlayerPrivate, "mediaPlayerPrivate", 0,
ExtensionPermissionMessage::kNone, component_only);
+ RegisterPermission(
+ ExtensionAPIPermission::kMetricsPrivate, "metricsPrivate", 0,
+ ExtensionPermissionMessage::kNone, component_only);
// Full url access permissions.
RegisterPermission(
diff --git a/chrome/common/extensions/extension_permission_set.h b/chrome/common/extensions/extension_permission_set.h
index 9a2b5cd..09e255a 100644
--- a/chrome/common/extensions/extension_permission_set.h
+++ b/chrome/common/extensions/extension_permission_set.h
@@ -113,6 +113,7 @@ class ExtensionAPIPermission {
kInputMethodPrivate,
kManagement,
kMediaPlayerPrivate,
+ kMetricsPrivate,
kNotification,
kPlugin,
kProxy,
diff --git a/chrome/common/extensions/extension_permission_set_unittest.cc b/chrome/common/extensions/extension_permission_set_unittest.cc
index 57826cc..aeea1be 100644
--- a/chrome/common/extensions/extension_permission_set_unittest.cc
+++ b/chrome/common/extensions/extension_permission_set_unittest.cc
@@ -172,6 +172,7 @@ TEST(ExtensionAPIPermissionTest, ComponentOnlyPermissions) {
private_perms.insert(ExtensionAPIPermission::kChromeosInfoPrivate);
private_perms.insert(ExtensionAPIPermission::kFileBrowserPrivate);
private_perms.insert(ExtensionAPIPermission::kMediaPlayerPrivate);
+ private_perms.insert(ExtensionAPIPermission::kMetricsPrivate);
private_perms.insert(ExtensionAPIPermission::kWebstorePrivate);
ExtensionAPIPermissionSet perms = info->GetAll();
@@ -183,7 +184,7 @@ TEST(ExtensionAPIPermissionTest, ComponentOnlyPermissions) {
info->GetByID(*i)->is_component_only());
}
- EXPECT_EQ(5, count);
+ EXPECT_EQ(6, count);
}
TEST(ExtensionPermissionSetTest, EffectiveHostPermissions) {
@@ -639,6 +640,7 @@ TEST(ExtensionPermissionSetTest, PermissionMessages) {
skip.insert(ExtensionAPIPermission::kWebstorePrivate);
skip.insert(ExtensionAPIPermission::kFileBrowserPrivate);
skip.insert(ExtensionAPIPermission::kMediaPlayerPrivate);
+ skip.insert(ExtensionAPIPermission::kMetricsPrivate);
skip.insert(ExtensionAPIPermission::kChromeAuthPrivate);
skip.insert(ExtensionAPIPermission::kChromePrivate);
skip.insert(ExtensionAPIPermission::kChromeosInfoPrivate);
diff --git a/chrome/test/data/extensions/api_test/metrics/manifest.json b/chrome/test/data/extensions/api_test/metrics/manifest.json
index 6ef2d86..9f49e7d 100644
--- a/chrome/test/data/extensions/api_test/metrics/manifest.json
+++ b/chrome/test/data/extensions/api_test/metrics/manifest.json
@@ -1,7 +1,8 @@
{
+ "key": "MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDJ5+2VmV02HP3jkMhxbp2yuyzf4K4JsffgCf8zsPljLVV2A+JXGj0TbvzvDP3RDCKC5qPMprQkoYlKVW2b6H0kQ8dNmZsjxMqEz/ZDx4Z6/VvbMaz8pP+dENs5Io5XlG5Op2nsJF+y+LqbX6qbff9D/s4fTWyqKillpJN+48qs0wIBIw==",
"name": "chrome.metrics",
"version": "0.1",
- "description": "end-to-end browser test for chrome.metrics API",
+ "description": "end-to-end browser test for chrome.metricsPrivate API",
"background_page": "test.html",
- "permissions": ["experimental"]
+ "permissions": ["metricsPrivate"]
}
diff --git a/chrome/test/data/extensions/api_test/metrics/test.js b/chrome/test/data/extensions/api_test/metrics/test.js
index 787d49f..4083e94 100644
--- a/chrome/test/data/extensions/api_test/metrics/test.js
+++ b/chrome/test/data/extensions/api_test/metrics/test.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -9,40 +9,19 @@
// with the checks done in IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Metrics).
// See extension_metrics_apitest.cc.
chrome.test.runTests([
- function getSetEnabled() {
- var pass = chrome.test.callbackPass;
- var metrics = chrome.experimental.metrics;
- // Try to change the setting and put it back. We use callbacks to ensure
- // all functions are called in order.
- metrics.getEnabled(pass(function(old_enabled) {
- // Verify that it is, indeed, a boolean.
- chrome.test.assertEq(old_enabled, !!old_enabled);
- metrics.setEnabled(!old_enabled, pass(function(new_enabled) {
- chrome.test.assertEq(old_enabled, !new_enabled);
- metrics.getEnabled(pass(function(n) {
- chrome.test.assertEq(n, new_enabled);
-
- metrics.setEnabled(old_enabled, pass(function(o) {
- chrome.test.assertEq(o, old_enabled);
- }));
- }));
- }));
- }));
- },
-
function recordUserAction() {
// Log a metric once.
- chrome.experimental.metrics.recordUserAction('test.ua.1');
+ chrome.metricsPrivate.recordUserAction('test.ua.1');
// Log a metric more than once.
- chrome.experimental.metrics.recordUserAction('test.ua.2');
- chrome.experimental.metrics.recordUserAction('test.ua.2');
+ chrome.metricsPrivate.recordUserAction('test.ua.2');
+ chrome.metricsPrivate.recordUserAction('test.ua.2');
chrome.test.succeed();
},
function recordValue() {
- chrome.experimental.metrics.recordValue({
+ chrome.metricsPrivate.recordValue({
'metricName': 'test.h.1',
'type': 'histogram-log',
'min': 1,
@@ -50,7 +29,7 @@ chrome.test.runTests([
'buckets': 50
}, 42);
- chrome.experimental.metrics.recordValue({
+ chrome.metricsPrivate.recordValue({
'metricName': 'test.h.2',
'type': 'histogram-linear',
'min': 1,
@@ -58,25 +37,24 @@ chrome.test.runTests([
'buckets': 50
}, 42);
- chrome.experimental.metrics.recordPercentage('test.h.3', 42);
- chrome.experimental.metrics.recordPercentage('test.h.3', 42);
+ chrome.metricsPrivate.recordPercentage('test.h.3', 42);
+ chrome.metricsPrivate.recordPercentage('test.h.3', 42);
chrome.test.succeed();
},
function recordTimes() {
- chrome.experimental.metrics.recordTime('test.time', 42);
- chrome.experimental.metrics.recordMediumTime('test.medium.time', 42 * 1000);
- chrome.experimental.metrics.recordLongTime('test.long.time',
- 42 * 1000 * 60);
+ chrome.metricsPrivate.recordTime('test.time', 42);
+ chrome.metricsPrivate.recordMediumTime('test.medium.time', 42 * 1000);
+ chrome.metricsPrivate.recordLongTime('test.long.time', 42 * 1000 * 60);
chrome.test.succeed();
},
function recordCounts() {
- chrome.experimental.metrics.recordCount('test.count', 420000);
- chrome.experimental.metrics.recordMediumCount('test.medium.count', 4200);
- chrome.experimental.metrics.recordSmallCount('test.small.count', 42);
+ chrome.metricsPrivate.recordCount('test.count', 420000);
+ chrome.metricsPrivate.recordMediumCount('test.medium.count', 4200);
+ chrome.metricsPrivate.recordSmallCount('test.small.count', 42);
chrome.test.succeed();
}