blob: 5b1fe64c047e8c7f64f3de5d07229e7e2738f51e [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script src="resources/utilities.js"></script>
<script>
function test()
{
let suite = InspectorTest.createAsyncSuite("IndexedDB.requestDatabaseNames.spaces");
suite.addTestCase({
name: "ClearDatabases",
description: "Remove any existing IndexedDB databases.",
test(resolve, reject) {
// FIXME: Remove any existing IndexedDB databases that might exist to workaround:
// <https://webkit.org/b/148006> Each test should run with its own clean data store
IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
InspectorTest.evaluateInPage("deleteDatabaseNames(" + JSON.stringify(names) + ")", resolve);
});
}
});
suite.addTestCase({
name: "EnsureNoDatabases",
description: "Ensure no databases exist at the start.",
test(resolve, reject) {
IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
InspectorTest.expectNoError(error);
InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist initially.");
resolve();
});
}
});
suite.addTestCase({
name: "CreateDatabaseWithSpacesInName",
description: "Create a database with spaces in the name.",
test(resolve, reject) {
InspectorTest.awaitEvent("DatabaseCreated")
.then((event) => {
IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
InspectorTest.expectNoError(error);
InspectorTest.expectThat(names.length === 1, "A single IndexedDB database should exist.");
InspectorTest.log(JSON.stringify(names));
resolve();
});
});
InspectorTest.evaluateInPage("createEmptyDatabase('Database With Space')");
}
});
suite.addTestCase({
name: "DeleteDatabaseWithSpacesInName",
description: "Delete the database.",
test(resolve, reject) {
InspectorTest.evaluateInPage("deleteDatabaseNames(['Database With Space'])");
IndexedDBAgent.requestDatabaseNames(WI.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
InspectorTest.expectNoError(error);
InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist because we just deleted them.");
InspectorTest.log(JSON.stringify(names));
resolve();
});
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
</body>
</html>