dom/indexedDB/test/browserHelpers.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 /**
michael@0 2 * Any copyright is dedicated to the Public Domain.
michael@0 3 * http://creativecommons.org/publicdomain/zero/1.0/
michael@0 4 */
michael@0 5
michael@0 6 let testGenerator = testSteps();
michael@0 7
michael@0 8 let testResult;
michael@0 9 let testException;
michael@0 10
michael@0 11 function testFinishedCallback(result, exception)
michael@0 12 {
michael@0 13 throw new Error("Bad testFinishedCallback!");
michael@0 14 }
michael@0 15
michael@0 16 function runTest()
michael@0 17 {
michael@0 18 testGenerator.next();
michael@0 19 }
michael@0 20
michael@0 21 function finishTestNow()
michael@0 22 {
michael@0 23 if (testGenerator) {
michael@0 24 testGenerator.close();
michael@0 25 testGenerator = undefined;
michael@0 26 }
michael@0 27 }
michael@0 28
michael@0 29 function finishTest()
michael@0 30 {
michael@0 31 setTimeout(finishTestNow, 0);
michael@0 32 setTimeout(testFinishedCallback, 0, testResult, testException);
michael@0 33 }
michael@0 34
michael@0 35 function grabEventAndContinueHandler(event)
michael@0 36 {
michael@0 37 testGenerator.send(event);
michael@0 38 }
michael@0 39
michael@0 40 function errorHandler(event)
michael@0 41 {
michael@0 42 throw new Error("indexedDB error, code " + event.target.error.name);
michael@0 43 }
michael@0 44
michael@0 45 function continueToNextStep()
michael@0 46 {
michael@0 47 SimpleTest.executeSoon(function() {
michael@0 48 testGenerator.next();
michael@0 49 });
michael@0 50 }

mercurial