summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/ajax/lib/AJAX_setup.js
blob: e94531db062b1fa151a548625873a3681f83b990 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var AJAXtests = [];

function runAJAXTest() {
  if (AJAXtests.length == 0) {
    SimpleTest.finish();
    return;
  }

  var test = AJAXtests.shift();
  var testframe = document.getElementById("testframe");
  testframe.src = test;
}

function onManifestLoad(manifest) {
  if (manifest.testcases) {
    AJAXtests = manifest.testcases;
    runAJAXTest();
  } else {
    ok(false, "manifest check", "no manifest!?!");
    SimpleTest.finish();
  }
}

function fetchManifest() {
  var d = loadJSONDoc("manifest.json");
  d.addBoth(onManifestLoad);
}

// Double timeout duration. Since this test case takes longer than 300 seconds
// on B2G emulator.
// See bug 968783.
SimpleTest.requestLongerTimeout(2);

SimpleTest.waitForExplicitFinish();
addLoadEvent(fetchManifest);