diff options
author | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 21:19:34 +0000 |
---|---|---|
committer | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 21:19:34 +0000 |
commit | cf25e4d9a950ed087bb580b5c07b5d175c17599e (patch) | |
tree | c06a8925f30720d9b50ec86b96b0e29f44222b95 | |
parent | 27b09143a4ccf84b761689a0de4102d52e7086c4 (diff) | |
download | chromium_src-cf25e4d9a950ed087bb580b5c07b5d175c17599e.zip chromium_src-cf25e4d9a950ed087bb580b5c07b5d175c17599e.tar.gz chromium_src-cf25e4d9a950ed087bb580b5c07b5d175c17599e.tar.bz2 |
Move metrics api to the experimental name space.
BUG=0
TEST=n/a
Review URL: http://codereview.chromium.org/899003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41487 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/extension_apitest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_function_dispatcher.cc | 22 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_metrics_apitest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_metrics_module.h | 18 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rwxr-xr-x | chrome/common/extensions/api/extension_api.json | 2 | ||||
-rw-r--r-- | chrome/renderer/resources/renderer_extension_bindings.js | 2 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/metrics/manifest.json | 3 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/metrics/test.js | 27 | ||||
-rw-r--r-- | chrome_frame/chrome_launcher.cc | 1 |
11 files changed, 40 insertions, 47 deletions
diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index a842c97..081a092 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -7,7 +7,6 @@ #include "chrome/browser/browser.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/profile.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/notification_registrar.h" #include "chrome/test/ui_test_utils.h" @@ -116,7 +115,4 @@ Extension* ExtensionApiTest::GetSingleLoadedExtension() { void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { ExtensionBrowserTest::SetUpCommandLine(command_line); test_data_dir_ = test_data_dir_.AppendASCII("api_test"); - - // Needed for metrics extension API tests. - command_line->AppendSwitch(switches::kEnableMetricsExtensionApi); } diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index fb380a1..02facbd 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -35,7 +35,6 @@ #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages.h" #include "chrome/common/result_codes.h" #include "chrome/common/url_constants.h" @@ -172,18 +171,15 @@ void FactoryRegistry::ResetFunctions() { RegisterFunction<GetProcessForTabFunction>(); // Metrics. - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableMetricsExtensionApi)) { - RegisterFunction<MetricsRecordUserActionFunction>(); - RegisterFunction<MetricsRecordValueFunction>(); - RegisterFunction<MetricsRecordPercentageFunction>(); - RegisterFunction<MetricsRecordCountFunction>(); - RegisterFunction<MetricsRecordSmallCountFunction>(); - RegisterFunction<MetricsRecordMediumCountFunction>(); - RegisterFunction<MetricsRecordTimeFunction>(); - RegisterFunction<MetricsRecordMediumTimeFunction>(); - RegisterFunction<MetricsRecordLongTimeFunction>(); - } + RegisterFunction<MetricsRecordUserActionFunction>(); + RegisterFunction<MetricsRecordValueFunction>(); + RegisterFunction<MetricsRecordPercentageFunction>(); + RegisterFunction<MetricsRecordCountFunction>(); + RegisterFunction<MetricsRecordSmallCountFunction>(); + RegisterFunction<MetricsRecordMediumCountFunction>(); + RegisterFunction<MetricsRecordTimeFunction>(); + RegisterFunction<MetricsRecordMediumTimeFunction>(); + RegisterFunction<MetricsRecordLongTimeFunction>(); // Test. RegisterFunction<ExtensionTestPassFunction>(); diff --git a/chrome/browser/extensions/extension_metrics_apitest.cc b/chrome/browser/extensions/extension_metrics_apitest.cc index 39d342a..5a91e9f 100644 --- a/chrome/browser/extensions/extension_metrics_apitest.cc +++ b/chrome/browser/extensions/extension_metrics_apitest.cc @@ -7,6 +7,7 @@ #include "base/histogram.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_apitest.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/notification_registrar.h" @@ -139,6 +140,9 @@ 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_; diff --git a/chrome/browser/extensions/extension_metrics_module.h b/chrome/browser/extensions/extension_metrics_module.h index c2ffdd2..81e12be 100644 --- a/chrome/browser/extensions/extension_metrics_module.h +++ b/chrome/browser/extensions/extension_metrics_module.h @@ -12,7 +12,7 @@ class MetricsRecordUserActionFunction : public SyncExtensionFunction { virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("metrics.recordUserAction") + DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordUserAction") }; class MetricsHistogramHelperFunction : public SyncExtensionFunction { @@ -24,42 +24,42 @@ class MetricsHistogramHelperFunction : public SyncExtensionFunction { class MetricsRecordValueFunction : public MetricsHistogramHelperFunction { virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("metrics.recordValue") + DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordValue") }; class MetricsRecordPercentageFunction : public MetricsHistogramHelperFunction { virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("metrics.recordPercentage") + DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordPercentage") }; class MetricsRecordCountFunction : public MetricsHistogramHelperFunction { virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("metrics.recordCount") + DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordCount") }; class MetricsRecordSmallCountFunction : public MetricsHistogramHelperFunction { virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("metrics.recordSmallCount") + DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordSmallCount") }; class MetricsRecordMediumCountFunction : public MetricsHistogramHelperFunction { virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("metrics.recordMediumCount") + DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordMediumCount") }; class MetricsRecordTimeFunction : public MetricsHistogramHelperFunction { virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("metrics.recordTime") + DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordTime") }; class MetricsRecordMediumTimeFunction : public MetricsHistogramHelperFunction { virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("metrics.recordMediumTime") + DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordMediumTime") }; class MetricsRecordLongTimeFunction : public MetricsHistogramHelperFunction { virtual bool RunImpl(); - DECLARE_EXTENSION_FUNCTION_NAME("metrics.recordLongTime") + DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordLongTime") }; #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_METRICS_MODULE_H__ diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index ad82c6f..309c4ee 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -217,9 +217,6 @@ const char kEnableBenchmarking[] = "enable-benchmarking"; const char kEnableExperimentalExtensionApis[] = "enable-experimental-extension-apis"; -// Enable metrics extension API. -const char kEnableMetricsExtensionApi[] = "enable-metrics-extension-api"; - // Enable experimental WebGL support. const char kEnableExperimentalWebGL[] = "enable-webgl"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index e7df656..3947388 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -77,7 +77,6 @@ extern const char kDomAutomationController[]; extern const char kDumpHistogramsOnExit[]; extern const char kEnableBenchmarking[]; extern const char kEnableExperimentalExtensionApis[]; -extern const char kEnableMetricsExtensionApi[]; extern const char kEnableExperimentalWebGL[]; extern const char kEnableExtensionApps[]; extern const char kEnableExtensionTimelineApi[]; diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 901cfc1..c0042c0 100755 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -2278,7 +2278,7 @@ "events": [] }, { - "namespace": "metrics", + "namespace": "experimental.metrics", "nodoc": true, "types": [ { diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js index 654a619..e34285b 100644 --- a/chrome/renderer/resources/renderer_extension_bindings.js +++ b/chrome/renderer/resources/renderer_extension_bindings.js @@ -248,9 +248,9 @@ var chrome = chrome || {}; "experimental.bookmarkManager", "experimental.extension", "experimental.history", + "experimental.metrics", "experimental.popup", "experimental.processes", - "metrics", "pageAction", "pageActions", "tabs", diff --git a/chrome/test/data/extensions/api_test/metrics/manifest.json b/chrome/test/data/extensions/api_test/metrics/manifest.json index 1c45fbd..6ef2d86 100644 --- a/chrome/test/data/extensions/api_test/metrics/manifest.json +++ b/chrome/test/data/extensions/api_test/metrics/manifest.json @@ -2,5 +2,6 @@ "name": "chrome.metrics", "version": "0.1", "description": "end-to-end browser test for chrome.metrics API", - "background_page": "test.html" + "background_page": "test.html", + "permissions": ["experimental"] } diff --git a/chrome/test/data/extensions/api_test/metrics/test.js b/chrome/test/data/extensions/api_test/metrics/test.js index 2de7ba4..a4108f8 100644 --- a/chrome/test/data/extensions/api_test/metrics/test.js +++ b/chrome/test/data/extensions/api_test/metrics/test.js @@ -11,17 +11,17 @@ chrome.test.runTests([ function recordUserAction() { // Log a metric once. - chrome.metrics.recordUserAction('test.ua.1'); + chrome.experimental.metrics.recordUserAction('test.ua.1'); // Log a metric more than once. - chrome.metrics.recordUserAction('test.ua.2'); - chrome.metrics.recordUserAction('test.ua.2'); + chrome.experimental.metrics.recordUserAction('test.ua.2'); + chrome.experimental.metrics.recordUserAction('test.ua.2'); chrome.test.succeed(); }, function recordValue() { - chrome.metrics.recordValue({ + chrome.experimental.metrics.recordValue({ 'metricName': 'test.h.1', 'type': 'histogram-log', 'min': 1, @@ -29,7 +29,7 @@ chrome.test.runTests([ 'buckets': 50 }, 42); - chrome.metrics.recordValue({ + chrome.experimental.metrics.recordValue({ 'metricName': 'test.h.2', 'type': 'histogram-linear', 'min': 1, @@ -37,24 +37,25 @@ chrome.test.runTests([ 'buckets': 50 }, 42); - chrome.metrics.recordPercentage('test.h.3', 42); - chrome.metrics.recordPercentage('test.h.3', 42); + chrome.experimental.metrics.recordPercentage('test.h.3', 42); + chrome.experimental.metrics.recordPercentage('test.h.3', 42); chrome.test.succeed(); }, function recordTimes() { - chrome.metrics.recordTime('test.time', 42); - chrome.metrics.recordMediumTime('test.medium.time', 42 * 1000); - chrome.metrics.recordLongTime('test.long.time', 42 * 1000 * 60); + 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.test.succeed(); }, function recordCounts() { - chrome.metrics.recordCount('test.count', 420000); - chrome.metrics.recordMediumCount('test.medium.count', 4200); - chrome.metrics.recordSmallCount('test.small.count', 42); + chrome.experimental.metrics.recordCount('test.count', 420000); + chrome.experimental.metrics.recordMediumCount('test.medium.count', 4200); + chrome.experimental.metrics.recordSmallCount('test.small.count', 42); chrome.test.succeed(); } diff --git a/chrome_frame/chrome_launcher.cc b/chrome_frame/chrome_launcher.cc index 374f47f..484c6de 100644 --- a/chrome_frame/chrome_launcher.cc +++ b/chrome_frame/chrome_launcher.cc @@ -25,7 +25,6 @@ const char* kAllowedSwitches[] = { switches::kDisableMetrics, switches::kEnableRendererAccessibility, switches::kEnableExperimentalExtensionApis, - switches::kEnableMetricsExtensionApi, switches::kNoErrorDialogs, switches::kNoFirstRun, switches::kUserDataDir, |