Bug 1293211 - part4: ide all tooltips before tests ending;r=bgrins
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 05 Aug 2016 15:12:48 +0200
changeset 308586 a3fb4eb11fcf840b9e0d65a06be6cf64584add08
parent 308585 05ec8a8570372d94067ef178f0f1737ca107b86d
child 308759 613fec9a571e48c64918ebd0a8153096300ff992
push id20265
push userjdescottes@mozilla.com
push dateTue, 09 Aug 2016 12:02:41 +0000
treeherderfx-team@a3fb4eb11fcf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1293211
milestone51.0a1
Bug 1293211 - part4: ide all tooltips before tests ending;r=bgrins MozReview-Commit-ID: 6Wjbu4LrkGF
devtools/client/inspector/rules/test/browser_rules_colorpicker-multiple-changes.js
devtools/client/inspector/rules/test/browser_rules_eyedropper.js
devtools/client/inspector/rules/test/head.js
--- a/devtools/client/inspector/rules/test/browser_rules_colorpicker-multiple-changes.js
+++ b/devtools/client/inspector/rules/test/browser_rules_colorpicker-multiple-changes.js
@@ -85,17 +85,17 @@ function* testComplexMultipleColorChange
     yield simulateColorPickerChange(ruleView, picker, rgba, {
       selector: "body",
       name: "background-color",
       value: computed
     });
   }
 
   info("Closing the color picker");
-  yield hideTooltipAndWaitForRuleViewChanged(picker.tooltip, ruleView);
+  yield hideTooltipAndWaitForRuleViewChanged(picker, ruleView);
 }
 
 function* testOverriddenMultipleColorChanges(inspector, ruleView) {
   yield selectNode("p", inspector);
 
   info("Getting the <body> tag's color property");
   let swatch = getRuleViewProperty(ruleView, "body", "color").valueSpan
     .querySelector(".ruleview-colorswatch");
--- a/devtools/client/inspector/rules/test/browser_rules_eyedropper.js
+++ b/devtools/client/inspector/rules/test/browser_rules_eyedropper.js
@@ -54,16 +54,21 @@ add_task(function* () {
   info("Test that pressing escape dismisses the eyedropper");
   yield testESC(swatch, inspector, testActor);
 
   info("Open the eyedropper again");
   yield openEyedropper(view, swatch);
 
   info("Test that a color can be selected with the eyedropper");
   yield testSelect(view, swatch, inspector, testActor);
+
+  let onHidden = tooltip.once("hidden");
+  tooltip.hide();
+  yield onHidden;
+  ok(!tooltip.isVisible(), "color picker tooltip is closed");
 });
 
 function* testESC(swatch, inspector, testActor) {
   info("Press escape");
   let onCanceled = new Promise(resolve => {
     inspector.inspector.once("color-pick-canceled", resolve);
   });
   yield testActor.synthesizeKey({key: "VK_ESCAPE", options: {}});
--- a/devtools/client/inspector/rules/test/head.js
+++ b/devtools/client/inspector/rules/test/head.js
@@ -172,23 +172,25 @@ var focusEditableField = Task.async(func
 });
 
 /**
  * When a tooltip is closed, this ends up "commiting" the value changed within
  * the tooltip (e.g. the color in case of a colorpicker) which, in turn, ends up
  * setting the value of the corresponding css property in the rule-view.
  * Use this function to close the tooltip and make sure the test waits for the
  * ruleview-changed event.
- * @param {Tooltip} tooltip
+ * @param {SwatchBasedEditorTooltip} editorTooltip
  * @param {CSSRuleView} view
  */
-function* hideTooltipAndWaitForRuleViewChanged(tooltip, view) {
+function* hideTooltipAndWaitForRuleViewChanged(editorTooltip, view) {
   let onModified = view.once("ruleview-changed");
-  tooltip.hide();
+  let onHidden = editorTooltip.tooltip.once("hidden");
+  editorTooltip.hide();
   yield onModified;
+  yield onHidden;
 }
 
 /**
  * Polls a given generator function waiting for it to return true.
  *
  * @param {Function} validatorFn
  *        A validator generator function that returns a boolean.
  *        This is called every few milliseconds to check if the result is true.