Changeset 106392 in webkit


Ignore:
Timestamp:
Jan 31, 2012 2:05:31 PM (12 years ago)
Author:
dgrogan@chromium.org
Message:

IndexedDB: refactor basics layout test so that it can be run on workers.
https://bugs.webkit.org/show_bug.cgi?id=76683

Reviewed by Tony Chang.

  • storage/indexeddb/basics-workers-expected.txt: Added.
  • storage/indexeddb/basics-workers.html: Added.
  • storage/indexeddb/basics.html:
  • storage/indexeddb/resources/basics.js: Copied from LayoutTests/storage/indexeddb/basics.html.

(test):
(openCallback):

  • storage/indexeddb/resources/idb-worker-common.js: Added.

(debug):
(finishJSTest):
(description):
(testPassed):
(testFailed):

Location:
trunk/LayoutTests
Files:
3 added
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r106390 r106392  
     12012-01-31  David Grogan  <dgrogan@chromium.org>
     2
     3        IndexedDB: refactor basics layout test so that it can be run on workers.
     4        https://bugs.webkit.org/show_bug.cgi?id=76683
     5
     6        Reviewed by Tony Chang.
     7
     8        * storage/indexeddb/basics-workers-expected.txt: Added.
     9        * storage/indexeddb/basics-workers.html: Added.
     10        * storage/indexeddb/basics.html:
     11        * storage/indexeddb/resources/basics.js: Copied from LayoutTests/storage/indexeddb/basics.html.
     12        (test):
     13        (openCallback):
     14        * storage/indexeddb/resources/idb-worker-common.js: Added.
     15        (debug):
     16        (finishJSTest):
     17        (description):
     18        (testPassed):
     19        (testFailed):
     20
    1212012-01-31  Eric Seidel  <eric@webkit.org>
    222
  • trunk/LayoutTests/storage/indexeddb/basics-expected.txt

    r79458 r106392  
    44
    55
    6 PASS 'webkitIndexedDB' in window is true
     6PASS 'webkitIndexedDB' in self is true
    77PASS webkitIndexedDB == null is false
    8 PASS 'webkitIDBCursor' in window is true
     8PASS 'webkitIDBCursor' in self is true
    99PASS webkitIDBCursor == null is false
    1010webkitIndexedDB.open('basics')
  • trunk/LayoutTests/storage/indexeddb/basics.html

    r99258 r106392  
    77<p id="description"></p>
    88<div id="console"></div>
    9 <script>
    10 
    11 description("Test IndexedDB's basics.");
    12 if (window.layoutTestController)
    13     layoutTestController.waitUntilDone();
    14 
    15 function test()
    16 {
    17     shouldBeTrue("'webkitIndexedDB' in window");
    18     shouldBeFalse("webkitIndexedDB == null");
    19 
    20     shouldBeTrue("'webkitIDBCursor' in window");
    21     shouldBeFalse("webkitIDBCursor == null");
    22 
    23     request = evalAndLog("webkitIndexedDB.open('basics')");
    24     shouldBeTrue("'result' in request");
    25     evalAndExpectException("request.result", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
    26     shouldBeTrue("'errorCode' in request");
    27     evalAndExpectException("request.errorCode", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
    28     shouldBeTrue("'webkitErrorMessage' in request");
    29     evalAndExpectException("request.webkitErrorMessage", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
    30     shouldBeTrue("'source' in request");
    31     shouldBe("request.source", "webkitIndexedDB");
    32     shouldBeTrue("'transaction' in request");
    33     shouldBeNull("request.transaction");
    34     shouldBeTrue("'readyState' in request");
    35     shouldBe("request.readyState", "webkitIDBRequest.LOADING");
    36     shouldBeTrue("'onsuccess' in request");
    37     shouldBeNull("request.onsuccess");
    38     shouldBeTrue("'onerror' in request");
    39     shouldBeNull("request.onerror");
    40     shouldBe("request.LOADING", "1");
    41     shouldBe("request.DONE", "2");
    42     request.onsuccess = openCallback;
    43     request.onerror = unexpectedErrorCallback;
    44 }
    45 
    46 function openCallback()
    47 {
    48     shouldBeTrue("'result' in event.target");
    49     shouldBeTrue("!!event.target.result");
    50     shouldBeTrue("'errorCode' in event.target");
    51     shouldBe("event.target.errorCode", "0");
    52     shouldBeTrue("'webkitErrorMessage' in event.target");
    53     shouldBeUndefined("event.target.webkitErrorMessage");
    54     shouldBeTrue("'source' in event.target");
    55     shouldBe("request.source", "webkitIndexedDB");
    56     shouldBeTrue("'transaction' in event.target");
    57     shouldBeNull("event.target.transaction");
    58     shouldBeTrue("'readyState' in request");
    59     shouldBe("event.target.readyState", "webkitIDBRequest.DONE");
    60     shouldBeTrue("'onsuccess' in event.target");
    61     shouldBeTrue("'onerror' in event.target");
    62     shouldBe("event.target.LOADING", "1");
    63     shouldBe("event.target.DONE", "2");
    64 
    65     done();
    66 }
    67 
    68 test();
    69 
    70 
    71 </script>
     9<script src="resources/basics.js"></script>
     10<script src="../../fast/js/resources/js-test-post.js"></script>
    7211</body>
    7312</html>
  • trunk/LayoutTests/storage/indexeddb/resources/basics.js

    r106391 r106392  
    1 <html>
    2 <head>
    3 <script src="../../fast/js/resources/js-test-pre.js"></script>
    4 <script src="resources/shared.js"></script>
    5 </head>
    6 <body>
    7 <p id="description"></p>
    8 <div id="console"></div>
    9 <script>
     1if (this.importScripts) {
     2    // FIXME: Change js-test-pre.js to use self in place of window where
     3    // possible, so we can remove the next line.  http://webkit.org/b/76762
     4    window = self;
     5    importScripts('../../../fast/js/resources/js-test-pre.js');
     6    importScripts('idb-worker-common.js');
     7    importScripts('shared.js');
     8}
    109
    1110description("Test IndexedDB's basics.");
    12 if (window.layoutTestController)
    13     layoutTestController.waitUntilDone();
    1411
    1512function test()
    1613{
    17     shouldBeTrue("'webkitIndexedDB' in window");
     14    shouldBeTrue("'webkitIndexedDB' in self");
    1815    shouldBeFalse("webkitIndexedDB == null");
    1916
    20     shouldBeTrue("'webkitIDBCursor' in window");
     17    shouldBeTrue("'webkitIDBCursor' in self");
    2118    shouldBeFalse("webkitIDBCursor == null");
    2219
     
    4441}
    4542
    46 function openCallback()
     43function openCallback(evt)
    4744{
     45    event = evt;
    4846    shouldBeTrue("'result' in event.target");
    4947    shouldBeTrue("!!event.target.result");
     
    6361    shouldBe("event.target.DONE", "2");
    6462
    65     done();
     63    finishJSTest();
    6664}
    6765
    6866test();
    69 
    70 
    71 </script>
    72 </body>
    73 </html>
  • trunk/LayoutTests/storage/indexeddb/resources/shared.js

    r85153 r106392  
     1var jsTestIsAsync = true;
     2
    13function done()
    24{
Note: See TracChangeset for help on using the changeset viewer.