Bug 1380659 - Test SpecialPowers API to dump/reset coverage counters with a mochitest. r=jmaher
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Fri, 14 Jul 2017 11:02:50 +0200
changeset 419211 5b5f72590fc265bb341fda3fb12fe1ae075ec48b
parent 419210 9a4c5050b1a67ecd185ca63a9eaaa9f759db8c6d
child 419212 97f0052a4bf942cefef28b1c90e7889e7af432be
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1380659
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1380659 - Test SpecialPowers API to dump/reset coverage counters with a mochitest. r=jmaher
tools/code-coverage/moz.build
tools/code-coverage/tests/mochitest.ini
tools/code-coverage/tests/test_coverage_specialpowers.html
--- a/tools/code-coverage/moz.build
+++ b/tools/code-coverage/moz.build
@@ -24,10 +24,11 @@ if CONFIG['MOZ_CODE_COVERAGE']:
     LOCAL_INCLUDES += [
         '/ipc/chromium/src',
         '/xpcom/base',
     ]
 
     include('/ipc/chromium/chromium-config.mozbuild')
 
     XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell.ini']
+    MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
 
     FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/tools/code-coverage/tests/mochitest.ini
@@ -0,0 +1,3 @@
+[DEFAULT]
+
+[test_coverage_specialpowers.html]
new file mode 100644
--- /dev/null
+++ b/tools/code-coverage/tests/test_coverage_specialpowers.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1380659
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 123456</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="application/javascript">
+
+  /** Test for Bug 1380659 **/
+
+  SimpleTest.waitForExplicitFinish();
+
+  SpecialPowers.requestDumpCoverageCounters();
+  SimpleTest.ok(true, "Counters dumped.");
+
+  SpecialPowers.requestResetCoverageCounters();
+  SimpleTest.ok(true, "Counters reset.");
+
+  SimpleTest.finish();
+
+  </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1380659">Mozilla Bug 1380659</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>