blob: 01ec60645081307f1b04758fc8de8d606368270c (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
function done()
{
isSuccessfullyParsed();
if (window.layoutTestController)
layoutTestController.notifyDone()
}
function verifyEventCommon(event)
{
shouldBeTrue("'source' in event");
shouldBeTrue("event.source != null");
shouldBeTrue("'onsuccess' in event.target");
shouldBeTrue("'onerror' in event.target");
shouldBeTrue("'readyState' in event.target");
shouldBe("event.target.readyState", "event.target.DONE");
debug("");
}
function verifyErrorEvent(event)
{
debug("Error event fired:");
shouldBeFalse("'result' in event");
shouldBeTrue("'code' in event");
shouldBeTrue("'message' in event");
verifyEventCommon(event);
}
function verifySuccessEvent(event)
{
debug("Success event fired:");
shouldBeTrue("'result' in event");
shouldBeFalse("'code' in event");
shouldBeFalse("'message' in event");
verifyEventCommon(event);
}
function verifyAbortEvent(event)
{
debug("Abort event fired:");
shouldBeEqualToString("event.type", "abort");
}
function verifyCompleteEvent(event)
{
debug("Complete event fired:");
shouldBeEqualToString("event.type", "complete");
}
function verifyResult(result)
{
shouldBeTrue("'onsuccess' in result");
shouldBeTrue("'onerror' in result");
shouldBeTrue("'readyState' in result");
debug("An event should fire shortly...");
debug("");
}
function unexpectedSuccessCallback()
{
testFailed("Success function called unexpectedly.");
debug("");
verifySuccessEvent(event);
done();
}
function unexpectedErrorCallback()
{
testFailed("Error function called unexpectedly: (" + event.code + ") " + event.message);
debug("");
verifyErrorEvent(event);
done();
}
function unexpectedAbortCallback()
{
testFailed("Abort function called unexpectedly!");
debug("");
verifyAbortEvent(event);
done();
}
function unexpectedCompleteCallback()
{
testFailed("oncomplete function called unexpectedly!");
debug("");
verifyCompleteEvent(event);
done();
}
// FIXME: remove the onfinished parameter.
function deleteAllObjectStores(db, onfinished)
{
while (db.objectStores.length)
db.removeObjectStore(db.objectStores.item(0));
debug("Deleted all object stores.");
onfinished();
}
|