DevTools/mochitests coding standards: Difference between revisions

Jump to navigation Jump to search
Removing the custom asyncTest function with the native add_task
(Removing the custom asyncTest function with the native add_task)
(Removing the custom asyncTest function with the native add_task)
Line 58: Line 58:
* Base URLs for support files: TEST_URL_ROOT. This avoids having to duplicate the http://example.com/browser/browser/devtools/styleinspector/ URL fragment in all tests,
* Base URLs for support files: TEST_URL_ROOT. This avoids having to duplicate the http://example.com/browser/browser/devtools/styleinspector/ URL fragment in all tests,
* waitForExplicitFinish() is called in head.js once and for all. All tests are asynchronous, so there's no need to call it again in each and every test,
* waitForExplicitFinish() is called in head.js once and for all. All tests are asynchronous, so there's no need to call it again in each and every test,
* asyncTest(function*(){...}) this function makes it easy to define an asynchronous test that can yield promises,
* auto-cleanup: the toolbox is closed automatically and all tabs are closed,
* auto-cleanup: the toolbox is closed automatically and all tabs are closed,
* tab addTab(url)
* tab addTab(url)
Line 78: Line 77:
   const TEST_URL = TEST_URL_ROOT + "doc_some_test_page.html";
   const TEST_URL = TEST_URL_ROOT + "doc_some_test_page.html";
    
    
   let test = asyncTest(function*() {
   add_task(function*() {
     yield addTab(TEST_URL_ROOT);
     yield addTab(TEST_URL_ROOT);
     let {toolbox, inspector, view} = yield openRuleView();
     let {toolbox, inspector, view} = yield openRuleView();
130

edits

Navigation menu