Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: LayoutTests/storage/execute-sql-args.html

Issue 598034: Refactor a database test such that its code can be shared between the documen... (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/storage/execute-sql-args.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/storage/execute-sql-args.html
===================================================================
--- LayoutTests/storage/execute-sql-args.html (revision 55036)
+++ LayoutTests/storage/execute-sql-args.html (working copy)
@@ -1,108 +1,28 @@
<html>
<head>
+<script src="execute-sql-args.js"></script>
<script>
-var throwOnToStringObject = { };
-throwOnToStringObject.toString = function () { throw "Cannot call toString on this object." };
-
-var throwOnGetLengthObject = { };
-throwOnGetLengthObject.__defineGetter__("length", function () { throw "Cannot get length of this object."; });
-
-var throwOnGetZeroObject = { length: 1 };
-throwOnGetZeroObject.__defineGetter__("0", function () { throw "Cannot get 0 property of this object."; });
-
-var expectNoException = [
- 'null',
- 'undefined',
- '0',
- '""',
- '"", null',
- '"", undefined',
- '"", []',
- '"", [ "arg0" ]',
- '"", { }',
- '"", { length: 0 }',
- '"", { length: 1, 0: "arg0" }',
- '"", null, null',
- '"", null, undefined',
- '"", null, { }',
- '"", null, null, null',
- '"", null, null, undefined',
- '"", null, null, { }',
-];
-
-var expectException = [
- '',
- 'throwOnToStringObject',
- '"", throwOnGetLengthObject',
- '"", throwOnGetZeroObject',
- '"", [ throwOnToStringObject ]',
- '"", 0',
- '"", ""',
- '"", null, 0',
- '"", null, ""',
- '"", null, null, 0',
- '"", null, null, ""',
-];
-
-function writeMessageToLog(message)
+function log(message)
{
document.getElementById("console").innerText += message + "\n";
}
-function tryExecuteSql(transaction, parameterList)
+function setupAndRunTest()
{
- try {
- eval('transaction.executeSql(' + parameterList + ')');
- return null;
- } catch (exception) {
- return exception;
- }
-}
-
-function runTransactionTest(transaction, parameterList, expectException)
-{
- var exception = tryExecuteSql(transaction, parameterList);
- if (expectException) {
- if (exception)
- writeMessageToLog("PASS. executeSql(" + parameterList + ") threw an exception as expected.");
- else
- writeMessageToLog("*FAIL*. executeSql(" + parameterList + ") did not throw an exception");
- } else {
- if (exception)
- writeMessageToLog("*FAIL*. executeSql(" + parameterList + ") threw an exception: " + exception);
- else
- writeMessageToLog("PASS. executeSql(" + parameterList + ") did not throw an exception");
- }
-}
-
-function runTransactionTests(transaction)
-{
- for (i in expectNoException)
- runTransactionTest(transaction, expectNoException[i], false);
- for (i in expectException)
- runTransactionTest(transaction, expectException[i], true);
-
- if (window.layoutTestController)
- layoutTestController.notifyDone();
-}
-
-function runTest()
-{
if (window.layoutTestController) {
+ layoutTestController.clearAllDatabases();
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
-
- var db = openDatabase("ExecuteSQLArgsTest", "1.0", "Test of handling of the arguments to SQLTransaction.executeSql", 1);
- db.transaction(runTransactionTests);
+ runTest();
}
</script>
</head>
-<body onload="runTest()">
+<body onload="setupAndRunTest()">
<pre id="console"></pre>
</body>
« no previous file with comments | « no previous file | LayoutTests/storage/execute-sql-args.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698