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