Diff
Modified: trunk/LayoutTests/ChangeLog (205038 => 205039)
--- trunk/LayoutTests/ChangeLog 2016-08-26 20:54:19 UTC (rev 205038)
+++ trunk/LayoutTests/ChangeLog 2016-08-26 20:59:01 UTC (rev 205039)
@@ -1,3 +1,15 @@
+2016-08-25 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: Modernize inspector/indexeddb tests
+ https://bugs.webkit.org/show_bug.cgi?id=161113
+
+ Reviewed by Brian Burg.
+
+ * inspector/indexeddb/deleteDatabaseNamesWithSpace-expected.txt:
+ * inspector/indexeddb/deleteDatabaseNamesWithSpace.html:
+ * inspector/indexeddb/requestDatabaseNames-expected.txt:
+ * inspector/indexeddb/requestDatabaseNames.html:
+
2016-08-26 Jiewen Tan <jiewen_...@apple.com>
Unreviewed, rebase iOS simulator WK1 http tests
Modified: trunk/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace-expected.txt (205038 => 205039)
--- trunk/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace-expected.txt 2016-08-26 20:54:19 UTC (rev 205038)
+++ trunk/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace-expected.txt 2016-08-26 20:59:01 UTC (rev 205039)
@@ -1,10 +1,15 @@
-CONSOLE MESSAGE: line 11: Created Database 'Database With Space'
+CONSOLE MESSAGE: line 9: Created Database 'Database With Space'
-PASS: No IndexedDB databases should exist initially
-[]
-Created Database 'Database With Space'
-PASS: A single IndexedDB database should exist
+== Running test suite: IndexedDB.requestDatabaseNames.spaces
+-- Running test case: ClearDatabases
+-- Running test case: EnsureNoDatabases
+PASS: No IndexedDB databases should exist initially.
+
+-- Running test case: CreateDatabaseWithSpacesInName
+PASS: A single IndexedDB database should exist.
["Database With Space"]
-PASS: No IndexedDB databases should exist at the end because we just deleted them
+
+-- Running test case: DeleteDatabaseWithSpacesInName
+PASS: No IndexedDB databases should exist because we just deleted them.
[]
Modified: trunk/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html (205038 => 205039)
--- trunk/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html 2016-08-26 20:54:19 UTC (rev 205038)
+++ trunk/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html 2016-08-26 20:59:01 UTC (rev 205039)
@@ -3,83 +3,76 @@
<head>
<script src=""
<script>
-function createDatabase(name)
-{
+function createDatabase(name) {
let request = window.indexedDB.open(name, 1);
request.addEventListener('success', function(event) {
+ console.log(`Created Database '${name}'`);
event.target.result.close();
- console.log(`Created Database '${name}'`);
});
}
-function deleteDatabaseNames(names)
-{
+function deleteDatabaseNames(names) {
for (let name of names)
- var request = window.indexedDB.deleteDatabase(name);
+ window.indexedDB.deleteDatabase(name);
}
function test()
{
- var steps = [
- {
- action: function() {
- // 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(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
- InspectorTest.evaluateInPage("deleteDatabaseNames(" + JSON.stringify(names) + ")");
- next();
- });
- }
- },
- {
- action: function() {
- IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
- InspectorTest.expectNoError(error);
- InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist initially");
- InspectorTest.log(JSON.stringify(names));
- InspectorTest.evaluateInPage("createDatabase('Database With Space')");
- });
- }
- },
- {
- action: function() {
- IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
- InspectorTest.expectNoError(error);
- InspectorTest.expectThat(names.length === 1, "A single IndexedDB database should exist");
- InspectorTest.log(JSON.stringify(names));
- InspectorTest.evaluateInPage("deleteDatabaseNames(['Database With Space'])");
- next();
- });
- }
- },
- {
- action: function() {
- IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
- InspectorTest.expectNoError(error);
- InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist at the end because we just deleted them");
- InspectorTest.log(JSON.stringify(names));
- next();
- });
- }
- },
- ];
+ let suite = InspectorTest.createAsyncSuite("IndexedDB.requestDatabaseNames.spaces");
- function next() {
- let step = steps.shift();
- if (!step) {
- InspectorTest.completeTest();
- return;
+ 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(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+ InspectorTest.evaluateInPage("deleteDatabaseNames(" + JSON.stringify(names) + ")", resolve);
+ });
}
- step.action();
- }
+ });
- WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function(event) {
- InspectorTest.log(event.data.message.messageText);
- next();
+ suite.addTestCase({
+ name: "EnsureNoDatabases",
+ description: "Ensure no databases exist at the start.",
+ test: (resolve, reject) => {
+ IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+ InspectorTest.expectNoError(error);
+ InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist initially.");
+ resolve();
+ });
+ }
});
- InspectorTest.log("");
- next();
+ suite.addTestCase({
+ name: "CreateDatabaseWithSpacesInName",
+ description: "Create a database with spaces in the name.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("createDatabase('Database With Space')");
+ IndexedDBAgent.requestDatabaseNames(WebInspector.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();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "DeleteDatabaseWithSpacesInName",
+ description: "Delete the database.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("deleteDatabaseNames(['Database With Space'])");
+ IndexedDBAgent.requestDatabaseNames(WebInspector.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>
Modified: trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames-expected.txt (205038 => 205039)
--- trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames-expected.txt 2016-08-26 20:54:19 UTC (rev 205038)
+++ trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames-expected.txt 2016-08-26 20:59:01 UTC (rev 205039)
@@ -1,20 +1,26 @@
-CONSOLE MESSAGE: line 10: Created Database 'Database1'
-CONSOLE MESSAGE: line 10: Created Database 'Database2'
-CONSOLE MESSAGE: line 10: Created Database 'ቍ'
-CONSOLE MESSAGE: line 10: Created Database '𐍆'
+CONSOLE MESSAGE: line 9: Created Database 'Database1'
+CONSOLE MESSAGE: line 9: Created Database 'Database2'
+CONSOLE MESSAGE: line 9: Created Database 'ቍ'
+CONSOLE MESSAGE: line 9: Created Database '𐍆'
-PASS: No IndexedDB databases should exist initially
-[]
-Created Database 'Database1'
-PASS: A single IndexedDB database should exist
+== Running test suite: IndexedDB.requestDatabaseNames
+-- Running test case: ClearDatabases
+-- Running test case: EnsureNoDatabases
+PASS: No IndexedDB databases should exist initially.
+
+-- Running test case: CreateDatabase1
+PASS: A single IndexedDB database should exist.
["Database1"]
-Created Database 'Database2'
-PASS: Two IndexedDB databases should exist
+
+-- Running test case: CreateDatabase2
+PASS: Two IndexedDB databases should exist.
["Database1","Database2"]
-Created Database 'ቍ'
-PASS: Two IndexedDB databases should exist
+
+-- Running test case: CreateDatabase3
+PASS: Three IndexedDB databases should exist.
["Database1","Database2","ቍ"]
-Created Database '𐍆'
-PASS: Four IndexedDB databases should exist
+
+-- Running test case: CreateDatabase4
+PASS: Four IndexedDB databases should exist.
["Database1","Database2","ቍ","𐍆"]
Modified: trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames.html (205038 => 205039)
--- trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames.html 2016-08-26 20:54:19 UTC (rev 205038)
+++ trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames.html 2016-08-26 20:59:01 UTC (rev 205039)
@@ -3,16 +3,15 @@
<head>
<script src=""
<script>
-function createDatabase(name)
-{
+function createDatabase(name) {
let request = window.indexedDB.open(name, 1);
- request.addEventListener('success', function() {
+ request.addEventListener('success', function(event) {
console.log(`Created Database '${name}'`);
+ event.target.result.close();
});
}
-function deleteDatabaseNames(names)
-{
+function deleteDatabaseNames(names) {
for (let name of names)
window.indexedDB.deleteDatabase(name);
}
@@ -19,85 +18,89 @@
function test()
{
- var steps = [
- {
- action: function() {
- // 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(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
- InspectorTest.evaluateInPage("deleteDatabaseNames(" + JSON.stringify(names) + ")");
- next();
- });
- }
- },
- {
- action: function() {
- IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
- InspectorTest.expectNoError(error);
- InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist initially");
- InspectorTest.log(JSON.stringify(names));
- InspectorTest.evaluateInPage("createDatabase('Database1')");
- });
- }
- },
- {
- action: function() {
- IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
- InspectorTest.expectNoError(error);
- InspectorTest.expectThat(names.length === 1, "A single IndexedDB database should exist");
- InspectorTest.log(JSON.stringify(names));
- InspectorTest.evaluateInPage("createDatabase('Database2')");
- });
- }
- },
- {
- action: function() {
- IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
- InspectorTest.expectNoError(error);
- InspectorTest.expectThat(names.length === 2, "Two IndexedDB databases should exist");
- InspectorTest.log(JSON.stringify(names));
- InspectorTest.evaluateInPage("createDatabase('\u124d')");
- });
- }
- },
- {
- action: function() {
- IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
- InspectorTest.expectNoError(error);
- InspectorTest.expectThat(names.length === 3, "Two IndexedDB databases should exist");
- InspectorTest.log(JSON.stringify(names));
- InspectorTest.evaluateInPage("createDatabase('\ud800\udf46')");
- });
- }
- },
- {
- action: function() {
- IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, function(error, names) {
- InspectorTest.expectNoError(error);
- InspectorTest.expectThat(names.length === 4, "Four IndexedDB databases should exist");
- InspectorTest.log(JSON.stringify(names));
- next();
- });
- }
+ let suite = InspectorTest.createAsyncSuite("IndexedDB.requestDatabaseNames");
+
+ 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(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+ InspectorTest.evaluateInPage("deleteDatabaseNames(" + JSON.stringify(names) + ")", resolve);
+ });
}
- ];
+ });
- function next() {
- let step = steps.shift();
- if (!step) {
- InspectorTest.completeTest();
- return;
+ suite.addTestCase({
+ name: "EnsureNoDatabases",
+ description: "Ensure no databases exist at the start.",
+ test: (resolve, reject) => {
+ IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+ InspectorTest.expectNoError(error);
+ InspectorTest.expectThat(names.length === 0, "No IndexedDB databases should exist initially.");
+ resolve();
+ });
}
- step.action();
- }
+ });
- WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function(event) {
- InspectorTest.log(event.data.message.messageText);
- next();
+ suite.addTestCase({
+ name: "CreateDatabase1",
+ description: "Create a first database.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("createDatabase('Database1')");
+ IndexedDBAgent.requestDatabaseNames(WebInspector.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.log("");
- next();
+ suite.addTestCase({
+ name: "CreateDatabase2",
+ description: "Create a second database.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("createDatabase('Database2')");
+ IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+ InspectorTest.expectNoError(error);
+ InspectorTest.expectThat(names.length === 2, "Two IndexedDB databases should exist.");
+ InspectorTest.log(JSON.stringify(names));
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "CreateDatabase3",
+ description: "Create a third database with a unicode name.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("createDatabase('\u124d')");
+ IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+ InspectorTest.expectNoError(error);
+ InspectorTest.expectThat(names.length === 3, "Three IndexedDB databases should exist.");
+ InspectorTest.log(JSON.stringify(names));
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "CreateDatabase4",
+ description: "Create a fourth database with a unicode name.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("createDatabase('\ud800\udf46')");
+ IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) => {
+ InspectorTest.expectNoError(error);
+ InspectorTest.expectThat(names.length === 4, "Four IndexedDB databases should exist.");
+ InspectorTest.log(JSON.stringify(names));
+ resolve();
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
}
</script>
</head>