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

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 // Tests for the test functions in head.js
michael@0 2
michael@0 3 function test() {
michael@0 4 waitForExplicitFinish();
michael@0 5 runTests();
michael@0 6 }
michael@0 7
michael@0 8 gTests.push({
michael@0 9 desc: "task sanity check",
michael@0 10 run: function() {
michael@0 11 let sum2plus2 = yield asyncSum(2, 2);
michael@0 12 ok(sum2plus2 == 4, "asyncSum responded 2+2=4");
michael@0 13
michael@0 14 function asyncSum(a, b) {
michael@0 15 var defd = Promise.defer();
michael@0 16 setTimeout(function(){
michael@0 17 defd.resolve(a+b);
michael@0 18 }, 25);
michael@0 19 return defd.promise;
michael@0 20 }
michael@0 21 }
michael@0 22 });
michael@0 23
michael@0 24 gTests.push({
michael@0 25 desc: "addTab",
michael@0 26 run: function testAddTab() {
michael@0 27 let tab = yield addTab("http://example.com/");
michael@0 28 is(tab, Browser.selectedTab, "The new tab is selected");
michael@0 29 }
michael@0 30 });

mercurial