Bug 1260160 - Refactor 2 debugger tests to use Task.spawn. r=jlong a=kwierso
authorJason Laster <jlaster@mozilla.com>
Thu, 31 Mar 2016 16:18:12 -0700
changeset 291271 8a8cd8d35d0141f95c2b0b00cba1449d3cccf204
parent 291270 a15b5e6efd30491de81c36691e46398abee99172
child 291272 1ac6445b00251dd50863942dd6901eff76ebfaa6
push id74545
push userkwierso@gmail.com
push dateFri, 01 Apr 2016 23:05:42 +0000
treeherdermozilla-inbound@c410d4e20586 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlong, kwierso
bugs1260160
milestone48.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 1260160 - Refactor 2 debugger tests to use Task.spawn. r=jlong a=kwierso * browser_dbg_search-sources-01.js * browser_dbg_auto-pretty-print-02.js MozReview-Commit-ID: KtUbMYU3pt9
devtools/client/debugger/test/mochitest/browser_dbg_auto-pretty-print-02.js
devtools/client/debugger/test/mochitest/browser_dbg_search-sources-01.js
--- a/devtools/client/debugger/test/mochitest/browser_dbg_auto-pretty-print-02.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_auto-pretty-print-02.js
@@ -17,103 +17,107 @@ var gEditor, gSources, gPrefs, gOptions,
 var gFirstSourceLabel = "code_ugly-6.js";
 var gSecondSourceLabel = "code_ugly-7.js";
 
 var gOriginalPref = Services.prefs.getBoolPref("devtools.debugger.auto-pretty-print");
 Services.prefs.setBoolPref("devtools.debugger.auto-pretty-print", true);
 
 function test(){
   initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
-    gTab = aTab;
-    gDebuggee = aDebuggee;
-    gPanel = aPanel;
-    gDebugger = gPanel.panelWin;
-    gEditor = gDebugger.DebuggerView.editor;
-    gSources = gDebugger.DebuggerView.Sources;
-    gPrefs = gDebugger.Prefs;
-    gOptions = gDebugger.DebuggerView.Options;
-    gView = gDebugger.DebuggerView;
+    const gTab = aTab;
+    const gDebuggee = aDebuggee;
+    const gPanel = aPanel;
+    const gDebugger = gPanel.panelWin;
+    const gEditor = gDebugger.DebuggerView.editor;
+    const gSources = gDebugger.DebuggerView.Sources;
+    const gPrefs = gDebugger.Prefs;
+    const gOptions = gDebugger.DebuggerView.Options;
+    const gView = gDebugger.DebuggerView;
 
     // Should be on by default.
     testAutoPrettyPrintOn();
 
-    waitForSourceShown(gPanel, gFirstSourceLabel)
-      .then(testSourceIsUgly)
-      .then(() => waitForSourceShown(gPanel, gFirstSourceLabel))
-      .then(testSourceIsPretty)
-      .then(testPrettyPrintButtonOn)
-      .then(() => {
-        // Switch to the second source.
-        let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN, 2);
-        gSources.selectedIndex = 1;
-        return finished;
-      })
-      .then(testSecondSourceLabel)
-      .then(() => {
-        // Switch back to first source.
-        let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN);
-        gSources.selectedIndex = 0;
-        return finished;
-      })
-      .then(testFirstSourceLabel)
-      .then(testPrettyPrintButtonOn)
+    Task.spawn(function*() {
+
+      yield waitForSourceShown(gPanel, gFirstSourceLabel);
+      testSourceIsUgly();
+
+      yield waitForSourceShown(gPanel, gFirstSourceLabel);
+      testSourceIsPretty();
+      testPrettyPrintButtonOn();
+
+      // select second source
+      yield selectSecondSource();
+      testSecondSourceLabel();
+
+      // select first source
+      yield selectFirstSource();
+      testFirstSourceLabel();
+      testPrettyPrintButtonOn();
+
       // Disable auto pretty printing so it does not affect the following tests.
-      .then(disableAutoPrettyPrint)
-      .then(() => closeDebuggerAndFinish(gPanel))
-      .then(null, aError => {
-        ok(false, "Got an error: " + DevToolsUtils.safeErrorString(aError));
-      })
+      yield disableAutoPrettyPrint();
+
+      closeDebuggerAndFinish(gPanel)
+        .then(null, aError => {
+          ok(false, "Got an error: " + DevToolsUtils.safeErrorString(aError));
+        })
+    });
+
+    function selectSecondSource() {
+      let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN, 2);
+      gSources.selectedIndex = 1;
+      return finished;
+    }
+
+    function selectFirstSource() {
+      let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN);
+      gSources.selectedIndex = 0;
+      return finished;
+    }
+
+    function testSourceIsUgly() {
+      ok(!gEditor.getText().includes("\n  "),
+        "The source shouldn't be pretty printed yet.");
+    }
+
+    function testFirstSourceLabel(){
+      let source = gSources.selectedItem.attachment.source;
+      ok(source.url === EXAMPLE_URL + gFirstSourceLabel,
+        "First source url is correct.");
+    }
+
+    function testSecondSourceLabel(){
+      let source = gSources.selectedItem.attachment.source;
+      ok(source.url === EXAMPLE_URL + gSecondSourceLabel,
+        "Second source url is correct.");
+    }
+
+    function testAutoPrettyPrintOn(){
+      is(gPrefs.autoPrettyPrint, true,
+        "The auto-pretty-print pref should be on.");
+      is(gOptions._autoPrettyPrint.getAttribute("checked"), "true",
+        "The Auto pretty print menu item should be checked.");
+    }
+
+    function testPrettyPrintButtonOn(){
+      is(gDebugger.document.getElementById("pretty-print").checked, true,
+        "The button should be checked when the source is selected.");
+    }
+
+    function disableAutoPrettyPrint(){
+      gOptions._autoPrettyPrint.setAttribute("checked", "false");
+      gOptions._toggleAutoPrettyPrint();
+      gOptions._onPopupHidden();
+      info("Disabled auto pretty printing.");
+    }
+
+    function testSourceIsPretty() {
+      ok(gEditor.getText().includes("\n  "),
+        "The source should be pretty printed.")
+    }
+
+    registerCleanupFunction(function() {
+      Services.prefs.setBoolPref("devtools.debugger.auto-pretty-print", gOriginalPref);
+    });
+
   });
 }
-
-function testSourceIsUgly() {
-  ok(!gEditor.getText().includes("\n  "),
-    "The source shouldn't be pretty printed yet.");
-}
-
-function testFirstSourceLabel(){
-  let source = gSources.selectedItem.attachment.source;
-  ok(source.url === EXAMPLE_URL + gFirstSourceLabel,
-    "First source url is correct.");
-}
-
-function testSecondSourceLabel(){
-  let source = gSources.selectedItem.attachment.source;
-  ok(source.url === EXAMPLE_URL + gSecondSourceLabel,
-    "Second source url is correct.");
-}
-
-function testAutoPrettyPrintOn(){
-  is(gPrefs.autoPrettyPrint, true,
-    "The auto-pretty-print pref should be on.");
-  is(gOptions._autoPrettyPrint.getAttribute("checked"), "true",
-    "The Auto pretty print menu item should be checked.");
-}
-
-function testPrettyPrintButtonOn(){
-  is(gDebugger.document.getElementById("pretty-print").checked, true,
-    "The button should be checked when the source is selected.");
-}
-
-function disableAutoPrettyPrint(){
-  gOptions._autoPrettyPrint.setAttribute("checked", "false");
-  gOptions._toggleAutoPrettyPrint();
-  gOptions._onPopupHidden();
-  info("Disabled auto pretty printing.");
-}
-
-function testSourceIsPretty() {
-  ok(gEditor.getText().includes("\n  "),
-    "The source should be pretty printed.")
-}
-
-registerCleanupFunction(function() {
-  gTab = null;
-  gDebuggee = null;
-  gPanel = null;
-  gDebugger = null;
-  gEditor = null;
-  gSources = null;
-  gOptions = null;
-  gPrefs = null;
-  gView = null;
-  Services.prefs.setBoolPref("devtools.debugger.auto-pretty-print", gOriginalPref);
-});
--- a/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-01.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-01.js
@@ -4,232 +4,227 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests basic functionality of sources filtering (file search).
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
 
-var gTab, gPanel, gDebugger;
-var gSources, gSearchView, gSearchBox;
-
 function test() {
   // Debug test slaves are a bit slow at this test.
   requestLongerTimeout(3);
 
   initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
-    gTab = aTab;
-    gPanel = aPanel;
-    gDebugger = gPanel.panelWin;
-    gSources = gDebugger.DebuggerView.Sources;
-    gSearchView = gDebugger.DebuggerView.Filtering.FilteredSources;
-    gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
+    const gTab = aTab;
+    const gPanel = aPanel;
+    const gDebugger = gPanel.panelWin;
+    const gSources = gDebugger.DebuggerView.Sources;
+    const gSearchView = gDebugger.DebuggerView.Filtering.FilteredSources;
+    const gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
+
+    Task.spawn(function*() {
+      // move searches to yields
+      // not sure what to do with the error...
+
+      yield waitForSourceShown(gPanel, "-01.js");
+      yield bogusSearch();
+      yield firstSearch();
+      yield secondSearch();
+      yield thirdSearch();
+      yield fourthSearch();
+      yield fifthSearch();
+      yield sixthSearch();
+      yield seventhSearch();
+
+      return closeDebuggerAndFinish(gPanel)
+        .then(null, aError => {
+          ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
+        });
+    });
+
+    function bogusSearch() {
+      let finished = promise.all([
+        ensureSourceIs(gPanel, "-01.js"),
+        ensureCaretAt(gPanel, 1),
+        waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_NOT_FOUND)
+      ]);
+
+      setText(gSearchBox, "BOGUS");
+
+      return finished.then(() => promise.all([
+        ensureSourceIs(gPanel, "-01.js"),
+        ensureCaretAt(gPanel, 1),
+        verifyContents({ itemCount: 0, hidden: true })
+      ]));
+    }
+
+    function firstSearch() {
+      let finished = promise.all([
+        ensureSourceIs(gPanel, "-01.js"),
+        ensureCaretAt(gPanel, 1),
+        once(gDebugger, "popupshown"),
+        waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
+        waitForSourceShown(gPanel, "-02.js")
+      ]);
+
+      setText(gSearchBox, "-02.js");
+
+      return finished.then(() => promise.all([
+        ensureSourceIs(gPanel, "-02.js"),
+        ensureCaretAt(gPanel, 1),
+        verifyContents({ itemCount: 1, hidden: false })
+      ]));
+    }
+
+    function secondSearch() {
+      let finished = promise.all([
+        once(gDebugger, "popupshown"),
+        waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
+        waitForSourceShown(gPanel, "-01.js")
+      ])
+      .then(() => {
+        let finished = promise.all([
+          once(gDebugger, "popupshown"),
+          waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
+          waitForCaretUpdated(gPanel, 5)
+        ])
+        .then(() => promise.all([
+          ensureSourceIs(gPanel, "-01.js"),
+          ensureCaretAt(gPanel, 5),
+          verifyContents({ itemCount: 1, hidden: false })
+        ]));
+
+        typeText(gSearchBox, ":5");
+        return finished;
+      });
+
+      setText(gSearchBox, ".*-01\.js");
+      return finished;
+    }
+
+    function thirdSearch() {
+      let finished = promise.all([
+        once(gDebugger, "popupshown"),
+        waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
+        waitForSourceShown(gPanel, "-02.js")
+      ])
+      .then(() => {
+        let finished = promise.all([
+          once(gDebugger, "popupshown"),
+          waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
+          waitForCaretUpdated(gPanel, 6, 6)
+        ])
+        .then(() => promise.all([
+          ensureSourceIs(gPanel, "-02.js"),
+          ensureCaretAt(gPanel, 6, 6),
+          verifyContents({ itemCount: 1, hidden: false })
+        ]));
 
-    waitForSourceShown(gPanel, "-01.js")
-      .then(bogusSearch)
-      .then(firstSearch)
-      .then(secondSearch)
-      .then(thirdSearch)
-      .then(fourthSearch)
-      .then(fifthSearch)
-      .then(sixthSearch)
-      .then(seventhSearch)
-      .then(() => closeDebuggerAndFinish(gPanel))
-      .then(null, aError => {
-        ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
+        typeText(gSearchBox, "#deb");
+        return finished;
+      });
+
+      setText(gSearchBox, ".*-02\.js");
+      return finished;
+    }
+
+    function fourthSearch() {
+      let finished = promise.all([
+        once(gDebugger, "popupshown"),
+        waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
+        waitForSourceShown(gPanel, "-01.js")
+      ])
+      .then(() => {
+        let finished = promise.all([
+          once(gDebugger, "popupshown"),
+          waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
+          waitForCaretUpdated(gPanel, 2, 9),
+        ])
+        .then(() => promise.all([
+          ensureSourceIs(gPanel, "-01.js"),
+          ensureCaretAt(gPanel, 2, 9),
+          verifyContents({ itemCount: 1, hidden: false })
+          // ...because we simply searched for ":" in the current file.
+        ]));
+
+        typeText(gSearchBox, "#:"); // # has precedence.
+        return finished;
       });
+
+      setText(gSearchBox, ".*-01\.js");
+      return finished;
+    }
+
+    function fifthSearch() {
+      let finished = promise.all([
+        once(gDebugger, "popupshown"),
+        waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
+        waitForSourceShown(gPanel, "-02.js")
+      ])
+      .then(() => {
+        let finished = promise.all([
+          once(gDebugger, "popuphidden"),
+          waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_NOT_FOUND),
+          waitForCaretUpdated(gPanel, 1, 3)
+        ])
+        .then(() => promise.all([
+          ensureSourceIs(gPanel, "-02.js"),
+          ensureCaretAt(gPanel, 1, 3),
+          verifyContents({ itemCount: 0, hidden: true })
+          // ...because the searched label includes ":5", so nothing is found.
+        ]));
+
+        typeText(gSearchBox, ":5#*"); // # has precedence.
+        return finished;
+      });
+
+      setText(gSearchBox, ".*-02\.js");
+      return finished;
+    }
+
+    function sixthSearch() {
+      let finished = promise.all([
+        ensureSourceIs(gPanel, "-02.js"),
+        ensureCaretAt(gPanel, 1, 3),
+        once(gDebugger, "popupshown"),
+        waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
+        waitForCaretUpdated(gPanel, 5)
+      ]);
+
+      backspaceText(gSearchBox, 2);
+
+      return finished.then(() => promise.all([
+        ensureSourceIs(gPanel, "-02.js"),
+        ensureCaretAt(gPanel, 5),
+        verifyContents({ itemCount: 1, hidden: false })
+      ]));
+    }
+
+    function seventhSearch() {
+      let finished = promise.all([
+        ensureSourceIs(gPanel, "-02.js"),
+        ensureCaretAt(gPanel, 5),
+        once(gDebugger, "popupshown"),
+        waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
+        waitForSourceShown(gPanel, "-01.js"),
+      ]);
+
+      backspaceText(gSearchBox, 6);
+
+      return finished.then(() => promise.all([
+        ensureSourceIs(gPanel, "-01.js"),
+        ensureCaretAt(gPanel, 1),
+        verifyContents({ itemCount: 2, hidden: false })
+      ]));
+    }
+
+    function verifyContents(aArgs) {
+      is(gSources.visibleItems.length, 2,
+        "The unmatched sources in the widget should not be hidden.");
+      is(gSearchView.itemCount, aArgs.itemCount,
+        "No sources should be displayed in the sources container after a bogus search.");
+      is(gSearchView.hidden, aArgs.hidden,
+        "No sources should be displayed in the sources container after a bogus search.");
+    }
+
   });
 }
-
-function bogusSearch() {
-  let finished = promise.all([
-    ensureSourceIs(gPanel, "-01.js"),
-    ensureCaretAt(gPanel, 1),
-    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_NOT_FOUND)
-  ]);
-
-  setText(gSearchBox, "BOGUS");
-
-  return finished.then(() => promise.all([
-    ensureSourceIs(gPanel, "-01.js"),
-    ensureCaretAt(gPanel, 1),
-    verifyContents({ itemCount: 0, hidden: true })
-  ]));
-}
-
-function firstSearch() {
-  let finished = promise.all([
-    ensureSourceIs(gPanel, "-01.js"),
-    ensureCaretAt(gPanel, 1),
-    once(gDebugger, "popupshown"),
-    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
-    waitForSourceShown(gPanel, "-02.js")
-  ]);
-
-  setText(gSearchBox, "-02.js");
-
-  return finished.then(() => promise.all([
-    ensureSourceIs(gPanel, "-02.js"),
-    ensureCaretAt(gPanel, 1),
-    verifyContents({ itemCount: 1, hidden: false })
-  ]));
-}
-
-function secondSearch() {
-  let finished = promise.all([
-    once(gDebugger, "popupshown"),
-    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
-    waitForSourceShown(gPanel, "-01.js")
-  ])
-  .then(() => {
-    let finished = promise.all([
-      once(gDebugger, "popupshown"),
-      waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
-      waitForCaretUpdated(gPanel, 5)
-    ])
-    .then(() => promise.all([
-      ensureSourceIs(gPanel, "-01.js"),
-      ensureCaretAt(gPanel, 5),
-      verifyContents({ itemCount: 1, hidden: false })
-    ]));
-
-    typeText(gSearchBox, ":5");
-    return finished;
-  });
-
-  setText(gSearchBox, ".*-01\.js");
-  return finished;
-}
-
-function thirdSearch() {
-  let finished = promise.all([
-    once(gDebugger, "popupshown"),
-    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
-    waitForSourceShown(gPanel, "-02.js")
-  ])
-  .then(() => {
-    let finished = promise.all([
-      once(gDebugger, "popupshown"),
-      waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
-      waitForCaretUpdated(gPanel, 6, 6)
-    ])
-    .then(() => promise.all([
-      ensureSourceIs(gPanel, "-02.js"),
-      ensureCaretAt(gPanel, 6, 6),
-      verifyContents({ itemCount: 1, hidden: false })
-    ]));
-
-    typeText(gSearchBox, "#deb");
-    return finished;
-  });
-
-  setText(gSearchBox, ".*-02\.js");
-  return finished;
-}
-
-function fourthSearch() {
-  let finished = promise.all([
-    once(gDebugger, "popupshown"),
-    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
-    waitForSourceShown(gPanel, "-01.js")
-  ])
-  .then(() => {
-    let finished = promise.all([
-      once(gDebugger, "popupshown"),
-      waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
-      waitForCaretUpdated(gPanel, 2, 9),
-    ])
-    .then(() => promise.all([
-      ensureSourceIs(gPanel, "-01.js"),
-      ensureCaretAt(gPanel, 2, 9),
-      verifyContents({ itemCount: 1, hidden: false })
-      // ...because we simply searched for ":" in the current file.
-    ]));
-
-    typeText(gSearchBox, "#:"); // # has precedence.
-    return finished;
-  });
-
-  setText(gSearchBox, ".*-01\.js");
-  return finished;
-}
-
-function fifthSearch() {
-  let finished = promise.all([
-    once(gDebugger, "popupshown"),
-    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
-    waitForSourceShown(gPanel, "-02.js")
-  ])
-  .then(() => {
-    let finished = promise.all([
-      once(gDebugger, "popuphidden"),
-      waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_NOT_FOUND),
-      waitForCaretUpdated(gPanel, 1, 3)
-    ])
-    .then(() => promise.all([
-      ensureSourceIs(gPanel, "-02.js"),
-      ensureCaretAt(gPanel, 1, 3),
-      verifyContents({ itemCount: 0, hidden: true })
-      // ...because the searched label includes ":5", so nothing is found.
-    ]));
-
-    typeText(gSearchBox, ":5#*"); // # has precedence.
-    return finished;
-  });
-
-  setText(gSearchBox, ".*-02\.js");
-  return finished;
-}
-
-function sixthSearch() {
-  let finished = promise.all([
-    ensureSourceIs(gPanel, "-02.js"),
-    ensureCaretAt(gPanel, 1, 3),
-    once(gDebugger, "popupshown"),
-    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
-    waitForCaretUpdated(gPanel, 5)
-  ]);
-
-  backspaceText(gSearchBox, 2);
-
-  return finished.then(() => promise.all([
-    ensureSourceIs(gPanel, "-02.js"),
-    ensureCaretAt(gPanel, 5),
-    verifyContents({ itemCount: 1, hidden: false })
-  ]));
-}
-
-function seventhSearch() {
-  let finished = promise.all([
-    ensureSourceIs(gPanel, "-02.js"),
-    ensureCaretAt(gPanel, 5),
-    once(gDebugger, "popupshown"),
-    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND),
-    waitForSourceShown(gPanel, "-01.js"),
-  ]);
-
-  backspaceText(gSearchBox, 6);
-
-  return finished.then(() => promise.all([
-    ensureSourceIs(gPanel, "-01.js"),
-    ensureCaretAt(gPanel, 1),
-    verifyContents({ itemCount: 2, hidden: false })
-  ]));
-}
-
-function verifyContents(aArgs) {
-  is(gSources.visibleItems.length, 2,
-    "The unmatched sources in the widget should not be hidden.");
-  is(gSearchView.itemCount, aArgs.itemCount,
-    "No sources should be displayed in the sources container after a bogus search.");
-  is(gSearchView.hidden, aArgs.hidden,
-    "No sources should be displayed in the sources container after a bogus search.");
-}
-
-registerCleanupFunction(function() {
-  gTab = null;
-  gPanel = null;
-  gDebugger = null;
-  gSources = null;
-  gSearchView = null;
-  gSearchBox = null;
-});