Bug 1148893 - Clean up browser_styleeditor_loading.js. r=bgrins
authorSami Jaktholm <sjakthol@outlook.com>
Thu, 02 Apr 2015 21:14:07 +0300
changeset 238156 33153a729f3a897aa6b80f5c94ac27d70d7fb681
parent 238155 2b86cbd8952a6a6617c497a54b205350d026d188
child 238157 0aed01897af112a29cad6d33bddd77d80f149d1e
push id58133
push userryanvm@gmail.com
push dateWed, 08 Apr 2015 16:59:36 +0000
treeherdermozilla-inbound@8911c111a6ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1148893
milestone40.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 1148893 - Clean up browser_styleeditor_loading.js. r=bgrins
browser/devtools/styleeditor/test/browser_styleeditor_loading.js
--- a/browser/devtools/styleeditor/test/browser_styleeditor_loading.js
+++ b/browser/devtools/styleeditor/test/browser_styleeditor_loading.js
@@ -1,37 +1,36 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
+// Test that style editor loads correctly.
 
 const TESTCASE_URI = TEST_BASE_HTTP + "longload.html";
 
-
-function test()
-{
-  waitForExplicitFinish();
-
+add_task(function* () {
   // launch Style Editor right when the tab is created (before load)
   // this checks that the Style Editor still launches correctly when it is opened
   // *while* the page is still loading. The Style Editor should not signal that
   // it is loaded until the accompanying content page is loaded.
+  let tabAdded = addTab(TESTCASE_URI);
+  let target = TargetFactory.forTab(gBrowser.selectedTab);
+  let styleEditorLoaded = gDevTools.showToolbox(target, "styleeditor");
 
-  addTabAndCheckOnStyleEditorAdded(function(panel) {
-    content.location = TESTCASE_URI;
-  }, testEditorAdded);
-}
+  yield Promise.all([tabAdded, styleEditorLoaded]);
 
-function testEditorAdded(event, editor)
-{
-  let root = gPanelWindow.document.querySelector(".splitview-root");
+  let toolbox = gDevTools.getToolbox(target);
+  let panel = toolbox.getPanel("styleeditor");
+  let { panelWindow } = panel;
+
+  let root = panelWindow.document.querySelector(".splitview-root");
   ok(!root.classList.contains("loading"),
      "style editor root element does not have 'loading' class name anymore");
 
-  let button = gPanelWindow.document.querySelector(".style-editor-newButton");
+  let button = panelWindow.document.querySelector(".style-editor-newButton");
   ok(!button.hasAttribute("disabled"),
      "new style sheet button is enabled");
 
-  button = gPanelWindow.document.querySelector(".style-editor-importButton");
+  button = panelWindow.document.querySelector(".style-editor-importButton");
   ok(!button.hasAttribute("disabled"),
      "import button is enabled");
-
-  finish();
-}
+});