Bug 1173775 - Tests for bug 1173775. r=vporof
authorJordan Santell <jsantell@mozilla.com>
Tue, 06 Oct 2015 15:50:19 -0700
changeset 267038 0fdc8212f08f462da10158e50f2e43e352993258
parent 267037 e24bd21c18fb439386a18d53d9f2a6bcc142d178
child 267039 bcebde1a43a2b34db8c29f84cd0b9c7392cef31a
push id15613
push userjsantell@mozilla.com
push dateFri, 09 Oct 2015 17:38:18 +0000
treeherderfx-team@0fdc8212f08f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvporof
bugs1173775
milestone44.0a1
Bug 1173775 - Tests for bug 1173775. r=vporof
devtools/client/performance/test/browser_profiler_tree-view-06.js
--- a/devtools/client/performance/test/browser_profiler_tree-view-06.js
+++ b/devtools/client/performance/test/browser_profiler_tree-view-06.js
@@ -17,22 +17,38 @@ function* spawnTest() {
 
   let container = document.createElement("vbox");
   treeRoot.attachTo(container);
 
   let A = treeRoot.getChild();
   let B = A.getChild();
   let D = B.getChild();
 
-  let receivedLinkEvent = treeRoot.once("link");
+  let linkEvent = null;
+  let handler = (_, e) => linkEvent = e;
+
+  treeRoot.on("link", handler);
+
+  // Fire the right click
+  EventUtils.synthesizeMouseAtCenter(D.target.querySelector(".call-tree-url"), { button: 2, type: "mousedown" }, window);
+
+  // Wait 200ms
+  yield idleWait(50);
+
+  // Ensure link was not called for right click
+  ok(!linkEvent, "`link` event not fired for right click")
+
+  // Fire left click
   EventUtils.sendMouseEvent({ type: "mousedown" }, D.target.querySelector(".call-tree-url"));
 
-  let eventItem = yield receivedLinkEvent;
-  is(eventItem, D, "The 'link' event target is correct.");
+  // Wait until linkEvent is true, should occur quickly, if not synchronously
+  yield waitUntil(() => linkEvent);
+  is(linkEvent, D, "The 'link' event target is correct.");
 
+  treeRoot.off("link", handler);
   finish();
 }
 
 var gThread = synthesizeProfileForTest([{
   time: 5,
   frames: [
     { category: 8,  location: "(root)" },
     { category: 8,  location: "A (http://foo/bar/baz:12)" },