Bug 1278838 - move workers/performance tests in dom/performance/tests, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 09 Jun 2016 19:05:16 +0200
changeset 301382 cc09ba8c5e5fef04b164c281ddc3485609f91c7b
parent 301381 6b1139b4cbf5cd0574e548da0b5ae4dec5b7e367
child 301383 9537a19f366562ea685c13f79dc2608d0d77d7bd
push id30333
push usercbook@mozilla.com
push dateFri, 10 Jun 2016 13:39:58 +0000
treeherdermozilla-central@52679ce4756c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1278838
milestone50.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 1278838 - move workers/performance tests in dom/performance/tests, r=smaug
dom/performance/PerformanceWorker.h
dom/performance/tests/mochitest.ini
dom/performance/tests/sharedworker_performance_user_timing.js
dom/performance/tests/test_sharedWorker_performance_user_timing.html
dom/performance/tests/test_worker_observer.html
dom/performance/tests/test_worker_performance_now.html
dom/performance/tests/test_worker_performance_now.js
dom/performance/tests/test_worker_user_timing.html
dom/performance/tests/worker_performance_observer.html
dom/performance/tests/worker_performance_observer.js
dom/performance/tests/worker_performance_user_timing.js
dom/workers/test/mochitest.ini
dom/workers/test/performance_observer.html
dom/workers/test/sharedworker_performance_user_timing.js
dom/workers/test/test_performance_observer.html
dom/workers/test/test_performance_user_timing.html
dom/workers/test/test_sharedWorker_performance_user_timing.html
dom/workers/test/test_worker_performance_now.html
dom/workers/test/test_worker_performance_now.js
dom/workers/test/worker_performance_observer.js
dom/workers/test/worker_performance_user_timing.js
--- a/dom/performance/PerformanceWorker.h
+++ b/dom/performance/PerformanceWorker.h
@@ -14,17 +14,17 @@ namespace dom {
 
 namespace workers {
 class WorkerPrivate;
 }
 
 class PerformanceWorker final : public Performance
 {
 public:
-  PerformanceWorker(workers::WorkerPrivate* aWorkerPrivate);
+  explicit PerformanceWorker(workers::WorkerPrivate* aWorkerPrivate);
 
   // Performance WebIDL methods
   DOMHighResTimeStamp Now() const override;
 
   virtual PerformanceTiming* Timing() override
   {
     MOZ_CRASH("This should not be called on workers.");
     return nullptr;
--- a/dom/performance/tests/mochitest.ini
+++ b/dom/performance/tests/mochitest.ini
@@ -1,8 +1,17 @@
 [DEFAULT]
 support-files =
   performance_observer.html
   test_performance_observer.js
   test_performance_user_timing.js
+  test_worker_performance_now.js
+  worker_performance_user_timing.js
+  worker_performance_observer.js
+  sharedworker_performance_user_timing.js
+  worker_performance_observer.html
 
 [test_performance_observer.html]
 [test_performance_user_timing.html]
+[test_worker_user_timing.html]
+[test_worker_observer.html]
+[test_sharedWorker_performance_user_timing.html]
+[test_worker_performance_now.html]
rename from dom/workers/test/sharedworker_performance_user_timing.js
rename to dom/performance/tests/sharedworker_performance_user_timing.js
--- a/dom/workers/test/sharedworker_performance_user_timing.js
+++ b/dom/performance/tests/sharedworker_performance_user_timing.js
@@ -10,17 +10,17 @@ function is(a, b, msg) {
   port.postMessage({type: 'status', status: a === b, msg: a + " === " + b + ": " + msg });
 }
 
 function isnot(a, b, msg) {
   dump("ISNOT: " + (a===b) + "  =>  " + a + " | " + b + " " + msg + "\n");
   port.postMessage({type: 'status', status: a != b, msg: a + " != " + b + ": " + msg });
 }
 
-importScripts('../../../dom/performance/tests/test_performance_user_timing.js');
+importScripts('test_performance_user_timing.js');
 
 onconnect = function(evt) {
   port = evt.ports[0];
 
   for (var i = 0; i < steps.length; ++i) {
     performance.clearMarks();
     performance.clearMeasures();
     steps[i]();
rename from dom/workers/test/test_sharedWorker_performance_user_timing.html
rename to dom/performance/tests/test_sharedWorker_performance_user_timing.html
rename from dom/workers/test/test_performance_observer.html
rename to dom/performance/tests/test_worker_observer.html
--- a/dom/workers/test/test_performance_observer.html
+++ b/dom/performance/tests/test_worker_observer.html
@@ -7,11 +7,11 @@
 <title>Test for performance observer in worker</title>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <div id=log></div>
 <script>
 'use strict';
 SpecialPowers.pushPrefEnv({"set": [["dom.enable_performance_observer", true]]},
                           function() {
-                            window.open("performance_observer.html");
+                            window.open("worker_performance_observer.html");
                           });
 </script>
rename from dom/workers/test/test_worker_performance_now.html
rename to dom/performance/tests/test_worker_performance_now.html
--- a/dom/workers/test/test_worker_performance_now.html
+++ b/dom/performance/tests/test_worker_performance_now.html
@@ -1,16 +1,32 @@
 <!-- Any copyright is dedicated to the Public Domain.
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Validate Interfaces Exposed to Workers</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-  <script type="text/javascript" src="worker_driver.js"></script>
 </head>
 <body>
 <script class="testbody" type="text/javascript">
-workerTestExec("test_worker_performance_now.js");
+
+SimpleTest.waitForExplicitFinish();
+var worker = new Worker('test_worker_performance_now.js');
+worker.onmessage = function(event) {
+  if (event.data.type == 'finish') {
+    SimpleTest.finish();
+
+  } else if (event.data.type == 'status') {
+    ok(event.data.status, event.data.msg);
+
+  } else if (event.data.type == 'getOSCPU') {
+    worker.postMessage({
+      type: 'returnOSCPU',
+      result: navigator.oscpu
+    });
+  }
+}
+
 </script>
 </body>
 </html>
rename from dom/workers/test/test_worker_performance_now.js
rename to dom/performance/tests/test_worker_performance_now.js
--- a/dom/workers/test/test_worker_performance_now.js
+++ b/dom/performance/tests/test_worker_performance_now.js
@@ -1,8 +1,30 @@
+function ok(a, msg) {
+  dump("OK: " + !!a + "  =>  " + a + ": " + msg + "\n");
+  postMessage({type: 'status', status: !!a, msg: a + ": " + msg });
+}
+
+function workerTestDone() {
+  postMessage({ type: 'finish' });
+}
+
+function workerTestGetOSCPU(cb) {
+  addEventListener('message', function workerTestGetOSCPUCB(e) {
+    if (e.data.type !== 'returnOSCPU') {
+      return;
+    }
+    removeEventListener('message', workerTestGetOSCPUCB);
+    cb(e.data.result);
+  });
+  postMessage({
+    type: 'getOSCPU'
+  });
+}
+
 ok(self.performance, "Performance object should exist.");
 ok(typeof self.performance.now == 'function', "Performance object should have a 'now' method.");
 var n = self.performance.now(), d = Date.now();
 ok(n >= 0, "The value of now() should be equal to or greater than 0.");
 ok(self.performance.now() >= n, "The value of now() should monotonically increase.");
 
 // The spec says performance.now() should have micro-second resolution, but allows 1ms if the platform doesn't support it.
 // Our implementation does provide micro-second resolution, except for windows XP combined with some HW properties
rename from dom/workers/test/test_performance_user_timing.html
rename to dom/performance/tests/test_worker_user_timing.html
rename from dom/workers/test/performance_observer.html
rename to dom/performance/tests/worker_performance_observer.html
rename from dom/workers/test/worker_performance_observer.js
rename to dom/performance/tests/worker_performance_observer.js
--- a/dom/workers/test/worker_performance_observer.js
+++ b/dom/performance/tests/worker_performance_observer.js
@@ -1,4 +1,4 @@
 importScripts(['/resources/testharness.js']);
-importScripts(['../../../dom/performance/tests/test_performance_observer.js']);
+importScripts(['test_performance_observer.js']);
 
 done();
rename from dom/workers/test/worker_performance_user_timing.js
rename to dom/performance/tests/worker_performance_user_timing.js
--- a/dom/workers/test/worker_performance_user_timing.js
+++ b/dom/performance/tests/worker_performance_user_timing.js
@@ -8,17 +8,17 @@ function is(a, b, msg) {
   postMessage({type: 'status', status: a === b, msg: a + " === " + b + ": " + msg });
 }
 
 function isnot(a, b, msg) {
   dump("ISNOT: " + (a===b) + "  =>  " + a + " | " + b + " " + msg + "\n");
   postMessage({type: 'status', status: a != b, msg: a + " != " + b + ": " + msg });
 }
 
-importScripts(['../../../dom/performance/tests/test_performance_user_timing.js']);
+importScripts(['test_performance_user_timing.js']);
 
 for (var i = 0; i < steps.length; ++i) {
   performance.clearMarks();
   performance.clearMeasures();
   steps[i]();
 }
 
 postMessage({type: 'finish'});
--- a/dom/workers/test/mochitest.ini
+++ b/dom/workers/test/mochitest.ini
@@ -100,32 +100,27 @@ support-files =
   xhr_headers_server.sjs
   xhr_cors_redirect.js
   url_exceptions_worker.js
   urlSearchParams_worker.js
   subdir/relativeLoad_sub_worker.js
   subdir/relativeLoad_sub_worker2.js
   subdir/relativeLoad_sub_import.js
   test_worker_interfaces.js
-  test_worker_performance_now.js
   worker_driver.js
   worker_wrapper.js
   bug1060621_worker.js
   bug1062920_worker.js
   webSocket_sharedWorker.js
   bug1104064_worker.js
   worker_consoleAndBlobs.js
   bug1132395_sharedWorker.js
   bug1132924_worker.js
   empty.html
-  worker_performance_user_timing.js
-  worker_performance_observer.js
-  sharedworker_performance_user_timing.js
   referrer.sjs
-  performance_observer.html
   sharedWorker_ports.js
   sharedWorker_lifetime.js
   worker_referrer.js
   websocket_https.html
   websocket_https_worker.js
   worker_fileReader.js
   fileapi_chromeScript.js
   importScripts_3rdParty_worker.js
@@ -141,18 +136,16 @@ support-files =
   !/dom/base/test/file_websocket_http_resource.txt
   !/dom/base/test/file_websocket_permessage_deflate_disabled_wsh.py
   !/dom/base/test/file_websocket_permessage_deflate_params_wsh.py
   !/dom/base/test/file_websocket_permessage_deflate_rejected_wsh.py
   !/dom/base/test/file_websocket_permessage_deflate_wsh.py
   !/dom/base/test/file_websocket_wsh.py
   !/dom/base/test/test_XHR_system.html
   !/dom/base/test/test_XHR_timeout.js
-  !/dom/performance/tests/test_performance_observer.js
-  !/dom/performance/tests/test_performance_user_timing.js
   !/dom/base/test/websocket_helpers.js
   !/dom/base/test/websocket_tests.js
   !/dom/tests/mochitest/notification/MockServices.js
   !/dom/tests/mochitest/notification/NotificationTest.js
 
 [test_404.html]
 [test_atob.html]
 [test_blobConstructor.html]
@@ -210,29 +203,26 @@ skip-if = (toolkit == 'gonk' && debug) #
 [test_navigator_languages.html]
 skip-if = buildapp == 'mulet'
 [test_newError.html]
 [test_notification.html]
 [test_notification_child.html]
 [test_notification_permission.html]
 [test_onLine.html]
 skip-if = (toolkit == 'gonk' && debug) #debug-only failure
-[test_performance_user_timing.html]
-[test_performance_observer.html]
 [test_promise.html]
 [test_promise_resolved_with_string.html]
 [test_recursion.html]
 [test_recursiveOnerror.html]
 [test_relativeLoad.html]
 skip-if = buildapp == 'b2g' # b2g(Failed to load script: relativeLoad_import.js) b2g-debug(Failed to load script: relativeLoad_import.js) b2g-desktop(Failed to load script: relativeLoad_import.js)
 [test_resolveWorker.html]
 [test_resolveWorker-assignment.html]
 [test_rvals.html]
 [test_sharedWorker.html]
-[test_sharedWorker_performance_user_timing.html]
 skip-if = (toolkit == 'gonk' && debug) # Bug 1176223
 [test_simpleThread.html]
 [test_suspend.html]
 [test_terminate.html]
 [test_terminateSyncXHR.html]
 [test_threadErrors.html]
 [test_threadTimeouts.html]
 [test_throwingOnerror.html]
@@ -256,17 +246,16 @@ skip-if = buildapp == 'b2g' || toolkit =
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828
 [test_websocket_https.html]
 skip-if = buildapp == 'b2g' # no https on b2g
 [test_websocket_loadgroup.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828
 [test_webSocket_sharedWorker.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828
 [test_worker_interfaces.html]
-[test_worker_performance_now.html]
 [test_workersDisabled.html]
 [test_xhr.html]
 [test_xhr2.html]
 [test_xhr_3rdparty.html]
 [test_xhr_headers.html]
 [test_xhr_implicit_cancel.html]
 [test_xhr_parameters.html]
 skip-if = buildapp == 'b2g'