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

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

mercurial