dom/indexedDB/test/chromeHelpers.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/indexedDB/test/chromeHelpers.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +/**
     1.5 + * Any copyright is dedicated to the Public Domain.
     1.6 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.7 + */
     1.8 +
     1.9 +const { 'classes': Cc, 'interfaces': Ci, 'utils': Cu } = Components;
    1.10 +
    1.11 +let testGenerator = testSteps();
    1.12 +
    1.13 +if (!window.runTest) {
    1.14 +  window.runTest = function()
    1.15 +  {
    1.16 +    Cu.importGlobalProperties(["indexedDB"]);
    1.17 +
    1.18 +    SimpleTest.waitForExplicitFinish();
    1.19 +
    1.20 +    testGenerator.next();
    1.21 +  }
    1.22 +}
    1.23 +
    1.24 +function finishTest()
    1.25 +{
    1.26 +  SimpleTest.executeSoon(function() {
    1.27 +    testGenerator.close();
    1.28 +    SimpleTest.finish();
    1.29 +  });
    1.30 +}
    1.31 +
    1.32 +function grabEventAndContinueHandler(event)
    1.33 +{
    1.34 +  testGenerator.send(event);
    1.35 +}
    1.36 +
    1.37 +function continueToNextStep()
    1.38 +{
    1.39 +  SimpleTest.executeSoon(function() {
    1.40 +    testGenerator.next();
    1.41 +  });
    1.42 +}
    1.43 +
    1.44 +function errorHandler(event)
    1.45 +{
    1.46 +  throw new Error("indexedDB error, code " + event.target.error.name);
    1.47 +}

mercurial