summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/data/extensions/api_test/metrics/manifest.json6
-rw-r--r--chrome/test/data/extensions/api_test/metrics/test.html1
-rw-r--r--chrome/test/data/extensions/api_test/metrics/test.js62
-rw-r--r--chrome/test/test_launcher/out_of_proc_test_runner.cc10
4 files changed, 77 insertions, 2 deletions
diff --git a/chrome/test/data/extensions/api_test/metrics/manifest.json b/chrome/test/data/extensions/api_test/metrics/manifest.json
new file mode 100644
index 0000000..1c45fbd
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/metrics/manifest.json
@@ -0,0 +1,6 @@
+{
+ "name": "chrome.metrics",
+ "version": "0.1",
+ "description": "end-to-end browser test for chrome.metrics API",
+ "background_page": "test.html"
+}
diff --git a/chrome/test/data/extensions/api_test/metrics/test.html b/chrome/test/data/extensions/api_test/metrics/test.html
new file mode 100644
index 0000000..46f4d74
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/metrics/test.html
@@ -0,0 +1 @@
+<script src="test.js"></script>
diff --git a/chrome/test/data/extensions/api_test/metrics/test.js b/chrome/test/data/extensions/api_test/metrics/test.js
new file mode 100644
index 0000000..2de7ba4
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/metrics/test.js
@@ -0,0 +1,62 @@
+// Copyright (c) 2010 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.
+
+// metrics api test
+// browser_tests.exe --gtest_filter=ExtensionApiTest.Metrics
+
+// Any changes to the logging done in these functions should be matched
+// with the checks done in IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Metrics).
+// See extension_metrics_apitest.cc.
+chrome.test.runTests([
+ function recordUserAction() {
+ // Log a metric once.
+ chrome.metrics.recordUserAction('test.ua.1');
+
+ // Log a metric more than once.
+ chrome.metrics.recordUserAction('test.ua.2');
+ chrome.metrics.recordUserAction('test.ua.2');
+
+ chrome.test.succeed();
+ },
+
+ function recordValue() {
+ chrome.metrics.recordValue({
+ 'metricName': 'test.h.1',
+ 'type': 'histogram-log',
+ 'min': 1,
+ 'max': 100,
+ 'buckets': 50
+ }, 42);
+
+ chrome.metrics.recordValue({
+ 'metricName': 'test.h.2',
+ 'type': 'histogram-linear',
+ 'min': 1,
+ 'max': 200,
+ 'buckets': 50
+ }, 42);
+
+ chrome.metrics.recordPercentage('test.h.3', 42);
+ chrome.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.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.test.succeed();
+ }
+]);
+
diff --git a/chrome/test/test_launcher/out_of_proc_test_runner.cc b/chrome/test/test_launcher/out_of_proc_test_runner.cc
index 32fb66c..98bdeca 100644
--- a/chrome/test/test_launcher/out_of_proc_test_runner.cc
+++ b/chrome/test/test_launcher/out_of_proc_test_runner.cc
@@ -84,7 +84,7 @@ class OutOfProcTestRunnerFactory : public tests::TestRunnerFactory {
void PrintUsage() {
fprintf(stdout, "Runs tests using the gtest framework, each test being run in"
" its own process.\nAny gtest flags can be specified.\n"
- " --single-process\n Runs the tests and the launcher in the same "
+ " --single_process\n Runs the tests and the launcher in the same "
"process. Useful for debugging a\n specific test in a debugger\n "
"--help\n Shows this message.\n --gtest_help\n Shows the gtest "
"help message\n");
@@ -101,6 +101,12 @@ int main(int argc, char** argv) {
return 0;
}
+ if (command_line->HasSwitch(kSingleProcessFlag)) {
+ fprintf(stdout,
+ "\n Did you mean --%s instead? (note underscore)\n\n",
+ kSingleProcessAltFlag);
+ }
+
if (command_line->HasSwitch(kChildProcessFlag) ||
command_line->HasSwitch(kSingleProcessFlag) ||
command_line->HasSwitch(kSingleProcessAltFlag) ||
@@ -112,7 +118,7 @@ int main(int argc, char** argv) {
fprintf(stdout,
"Starting tests...\nIMPORTANT DEBUGGING NOTE: each test is run inside"
" its own process.\nFor debugging a test inside a debugger, use the "
- "--single-process and\n--gtest_filter=<your_test_name> flags.\n");
+ "--single_process and\n--gtest_filter=<your_test_name> flags.\n");
OutOfProcTestRunnerFactory test_runner_factory;
return tests::RunTests(test_runner_factory) ? 0 : 1;
}