michael@0: // Tests for the test functions in head.js michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: runTests(); michael@0: } michael@0: michael@0: gTests.push({ michael@0: desc: "task sanity check", michael@0: run: function() { michael@0: let sum2plus2 = yield asyncSum(2, 2); michael@0: ok(sum2plus2 == 4, "asyncSum responded 2+2=4"); michael@0: michael@0: function asyncSum(a, b) { michael@0: var defd = Promise.defer(); michael@0: setTimeout(function(){ michael@0: defd.resolve(a+b); michael@0: }, 25); michael@0: return defd.promise; michael@0: } michael@0: } michael@0: }); michael@0: michael@0: gTests.push({ michael@0: desc: "addTab", michael@0: run: function testAddTab() { michael@0: let tab = yield addTab("http://example.com/"); michael@0: is(tab, Browser.selectedTab, "The new tab is selected"); michael@0: } michael@0: });