|
24 | 24 | name: "CreateAndRequestEmptyDatabase", |
25 | 25 | test: (resolve, reject) => { |
26 | 26 | InspectorTest.evaluateInPage("createEmptyDatabase('EmptyDatabase', 123)"); |
27 | | - IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "EmptyDatabase", (error, databaseWithObjectStores) => { |
28 | | - InspectorTest.expectNoError(error); |
29 | | - InspectorTest.expectThat(databaseWithObjectStores.name === "EmptyDatabase", "Database name should be 'EmptyDatabase'."); |
30 | | - InspectorTest.expectThat(databaseWithObjectStores.version === 123, "Database version should be 123."); |
31 | | - InspectorTest.expectThat(databaseWithObjectStores.objectStores.length === 0, "Database should not have any object stores."); |
32 | | - resolve(); |
| 27 | + InspectorTest.singleFireEventListener("DatabaseCreated", (event) => { |
| 28 | + IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "EmptyDatabase", (error, databaseWithObjectStores) => { |
| 29 | + InspectorTest.expectNoError(error); |
| 30 | + InspectorTest.expectThat(databaseWithObjectStores.name === "EmptyDatabase", "Database name should be 'EmptyDatabase'."); |
| 31 | + InspectorTest.expectThat(databaseWithObjectStores.version === 123, "Database version should be 123."); |
| 32 | + InspectorTest.expectThat(databaseWithObjectStores.objectStores.length === 0, "Database should not have any object stores."); |
| 33 | + resolve(); |
| 34 | + }); |
33 | 35 | }); |
34 | 36 | } |
35 | 37 | }); |
|
38 | 40 | name: "CreateAndRequestDatabaseWithStores", |
39 | 41 | test: (resolve, reject) => { |
40 | 42 | InspectorTest.evaluateInPage("createDatabaseWithStores('CompleteDatabase', 456)"); |
41 | | - IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "CompleteDatabase", (error, databaseWithObjectStores) => { |
42 | | - InspectorTest.expectNoError(error); |
43 | | - let objectStores = databaseWithObjectStores.objectStores; |
44 | | - InspectorTest.expectThat(databaseWithObjectStores.name === "CompleteDatabase", "Database name should be 'EmptyDatabase'."); |
45 | | - InspectorTest.expectThat(databaseWithObjectStores.version === 456, "Database version should be 456."); |
46 | | - InspectorTest.expectThat(databaseWithObjectStores.objectStores.length === 3, "Database should have 3 object stores."); |
| 43 | + InspectorTest.singleFireEventListener("DatabaseCreated", (event) => { |
| 44 | + IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, "CompleteDatabase", (error, databaseWithObjectStores) => { |
| 45 | + InspectorTest.expectNoError(error); |
| 46 | + let objectStores = databaseWithObjectStores.objectStores; |
| 47 | + InspectorTest.expectThat(databaseWithObjectStores.name === "CompleteDatabase", "Database name should be 'EmptyDatabase'."); |
| 48 | + InspectorTest.expectThat(databaseWithObjectStores.version === 456, "Database version should be 456."); |
| 49 | + InspectorTest.expectThat(databaseWithObjectStores.objectStores.length === 3, "Database should have 3 object stores."); |
47 | 50 |
|
48 | | - InspectorTest.expectThat(objectStores[0].name === "Empty", "Object store should have name 'Empty'."); |
49 | | - InspectorTest.expectThat(objectStores[0].keyPath.type === "null", "Object store keypath is null."); |
50 | | - InspectorTest.expectThat(!objectStores[0].autoIncrement, "Object store should not autoIncrement."); |
51 | | - InspectorTest.expectThat(!objectStores[0].indexes.length, "Object store should have no indexes."); |
| 51 | + InspectorTest.expectThat(objectStores[0].name === "Empty", "Object store should have name 'Empty'."); |
| 52 | + InspectorTest.expectThat(objectStores[0].keyPath.type === "null", "Object store keypath is null."); |
| 53 | + InspectorTest.expectThat(!objectStores[0].autoIncrement, "Object store should not autoIncrement."); |
| 54 | + InspectorTest.expectThat(!objectStores[0].indexes.length, "Object store should have no indexes."); |
52 | 55 |
|
53 | | - InspectorTest.expectThat(objectStores[1].name === "Reviewers", "Object store should have name 'Reviewers'."); |
54 | | - InspectorTest.expectThat(objectStores[1].keyPath.type === "null", "Object store keypath is null."); |
55 | | - InspectorTest.expectThat(objectStores[1].autoIncrement, "Object store should autoIncrement."); |
56 | | - InspectorTest.expectThat(objectStores[1].indexes.length === 2, "Object store should have 2 indexes."); |
57 | | - InspectorTest.log("INDEX: " + JSON.stringify(objectStores[1].indexes[0])); |
58 | | - InspectorTest.log("INDEX: " + JSON.stringify(objectStores[1].indexes[1])); |
| 56 | + InspectorTest.expectThat(objectStores[1].name === "Reviewers", "Object store should have name 'Reviewers'."); |
| 57 | + InspectorTest.expectThat(objectStores[1].keyPath.type === "null", "Object store keypath is null."); |
| 58 | + InspectorTest.expectThat(objectStores[1].autoIncrement, "Object store should autoIncrement."); |
| 59 | + InspectorTest.expectThat(objectStores[1].indexes.length === 2, "Object store should have 2 indexes."); |
| 60 | + InspectorTest.log("INDEX: " + JSON.stringify(objectStores[1].indexes[0])); |
| 61 | + InspectorTest.log("INDEX: " + JSON.stringify(objectStores[1].indexes[1])); |
59 | 62 |
|
60 | | - InspectorTest.expectThat(objectStores[2].name === "Stats", "Object store should have name 'Stats'."); |
61 | | - InspectorTest.expectThat(objectStores[2].keyPath.type === "string", "Object store keypath is string type."); |
62 | | - InspectorTest.expectThat(objectStores[2].keyPath.string === "name", "Object store keypath is 'name''."); |
63 | | - InspectorTest.expectThat(!objectStores[2].autoIncrement, "Object store should not autoIncrement."); |
64 | | - InspectorTest.expectThat(objectStores[2].indexes.length === 2, "Object store should have 2 indexes."); |
65 | | - InspectorTest.log("INDEX: " + JSON.stringify(objectStores[2].indexes[0])); |
66 | | - InspectorTest.log("INDEX: " + JSON.stringify(objectStores[2].indexes[1])); |
| 63 | + InspectorTest.expectThat(objectStores[2].name === "Stats", "Object store should have name 'Stats'."); |
| 64 | + InspectorTest.expectThat(objectStores[2].keyPath.type === "string", "Object store keypath is string type."); |
| 65 | + InspectorTest.expectThat(objectStores[2].keyPath.string === "name", "Object store keypath is 'name''."); |
| 66 | + InspectorTest.expectThat(!objectStores[2].autoIncrement, "Object store should not autoIncrement."); |
| 67 | + InspectorTest.expectThat(objectStores[2].indexes.length === 2, "Object store should have 2 indexes."); |
| 68 | + InspectorTest.log("INDEX: " + JSON.stringify(objectStores[2].indexes[0])); |
| 69 | + InspectorTest.log("INDEX: " + JSON.stringify(objectStores[2].indexes[1])); |
67 | 70 |
|
68 | | - resolve(); |
| 71 | + resolve(); |
| 72 | + }); |
69 | 73 | }); |
70 | 74 | } |
71 | 75 | }); |
|
0 commit comments