browser/metro/base/tests/mochitest/browser_test.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/metro/base/tests/mochitest/browser_test.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     1.4 +// Tests for the test functions in head.js
     1.5 +
     1.6 +function test() {
     1.7 +  waitForExplicitFinish();
     1.8 +  runTests();
     1.9 +}
    1.10 +
    1.11 +gTests.push({
    1.12 +  desc: "task sanity check",
    1.13 +  run: function() {
    1.14 +    let sum2plus2 = yield asyncSum(2, 2);
    1.15 +    ok(sum2plus2 == 4, "asyncSum responded 2+2=4");
    1.16 +
    1.17 +    function asyncSum(a, b) {
    1.18 +      var defd = Promise.defer();
    1.19 +      setTimeout(function(){
    1.20 +        defd.resolve(a+b);
    1.21 +      }, 25);
    1.22 +      return defd.promise;
    1.23 +    }
    1.24 +  }
    1.25 +});
    1.26 +
    1.27 +gTests.push({
    1.28 +  desc: "addTab",
    1.29 +  run: function testAddTab() {
    1.30 +    let tab = yield addTab("http://example.com/");
    1.31 +    is(tab, Browser.selectedTab, "The new tab is selected");
    1.32 +  }
    1.33 +});

mercurial