Changeset 122262 in webkit


Ignore:
Timestamp:
Jul 10, 2012 2:21:34 PM (12 years ago)
Author:
jsbell@chromium.org
Message:

[Chromium] IndexedDB: Need test of Typed Arrays
https://bugs.webkit.org/show_bug.cgi?id=81979

Reviewed by Tony Chang.

Verify storage of Typed Arrays (Uint8Array and friends). Checks that
these types are stored and read back with types and data intact. Also
add an index to the object store, so that key paths are evaluated
against each type on every write operation.

  • storage/indexeddb/structured-clone-expected.txt:
  • storage/indexeddb/structured-clone.html:
Location:
trunk/LayoutTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r122256 r122262  
     12012-07-10  Joshua Bell  <jsbell@chromium.org>
     2
     3        [Chromium] IndexedDB: Need test of Typed Arrays
     4        https://bugs.webkit.org/show_bug.cgi?id=81979
     5
     6        Reviewed by Tony Chang.
     7
     8        Verify storage of Typed Arrays (Uint8Array and friends). Checks that
     9        these types are stored and read back with types and data intact. Also
     10        add an index to the object store, so that key paths are evaluated
     11        against each type on every write operation.
     12
     13        * storage/indexeddb/structured-clone-expected.txt:
     14        * storage/indexeddb/structured-clone.html:
     15
    1162012-07-10  Adam Barth  <abarth@webkit.org>
    217
  • trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt

    r116337 r122262  
    1313PASS db.version is ""
    1414db.setVersion('1')
    15 db.createObjectStore('storeName')
     15store = db.createObjectStore('storeName')
     16This index is not used, but evaluating key path on each put() call will exercise (de)serialization:
     17store.createIndex('indexName', 'dummyKeyPath')
    1618
    1719Running tests...
     
    581583PASS test_data["bar"] is result["bar"]
    582584PASS test_data[""] is result[""]
     585
     586Testing TypedArray
     587value = new Uint8Array([])
     588transaction = db.transaction('storeName', 'readwrite')
     589store = transaction.objectStore('storeName')
     590store.put(value, 'key')
     591store.get('key')
     592PASS test_data !== result is true
     593PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
     594PASS test_data.length === result.length is true
     595
     596value = new Uint8Array([0, 1, 254, 255])
     597transaction = db.transaction('storeName', 'readwrite')
     598store = transaction.objectStore('storeName')
     599store.put(value, 'key')
     600store.get('key')
     601PASS test_data !== result is true
     602PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
     603PASS test_data.length === result.length is true
     604PASS is(test_data[0], result[0]) is true
     605PASS is(test_data[1], result[1]) is true
     606PASS is(test_data[2], result[2]) is true
     607PASS is(test_data[3], result[3]) is true
     608
     609value = new Uint16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])
     610transaction = db.transaction('storeName', 'readwrite')
     611store = transaction.objectStore('storeName')
     612store.put(value, 'key')
     613store.get('key')
     614PASS test_data !== result is true
     615PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
     616PASS test_data.length === result.length is true
     617PASS is(test_data[0], result[0]) is true
     618PASS is(test_data[1], result[1]) is true
     619PASS is(test_data[2], result[2]) is true
     620PASS is(test_data[3], result[3]) is true
     621
     622value = new Uint32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])
     623transaction = db.transaction('storeName', 'readwrite')
     624store = transaction.objectStore('storeName')
     625store.put(value, 'key')
     626store.get('key')
     627PASS test_data !== result is true
     628PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
     629PASS test_data.length === result.length is true
     630PASS is(test_data[0], result[0]) is true
     631PASS is(test_data[1], result[1]) is true
     632PASS is(test_data[2], result[2]) is true
     633PASS is(test_data[3], result[3]) is true
     634
     635value = new Int8Array([0, 1, 254, 255])
     636transaction = db.transaction('storeName', 'readwrite')
     637store = transaction.objectStore('storeName')
     638store.put(value, 'key')
     639store.get('key')
     640PASS test_data !== result is true
     641PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
     642PASS test_data.length === result.length is true
     643PASS is(test_data[0], result[0]) is true
     644PASS is(test_data[1], result[1]) is true
     645PASS is(test_data[2], result[2]) is true
     646PASS is(test_data[3], result[3]) is true
     647
     648value = new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])
     649transaction = db.transaction('storeName', 'readwrite')
     650store = transaction.objectStore('storeName')
     651store.put(value, 'key')
     652store.get('key')
     653PASS test_data !== result is true
     654PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
     655PASS test_data.length === result.length is true
     656PASS is(test_data[0], result[0]) is true
     657PASS is(test_data[1], result[1]) is true
     658PASS is(test_data[2], result[2]) is true
     659PASS is(test_data[3], result[3]) is true
     660
     661value = new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])
     662transaction = db.transaction('storeName', 'readwrite')
     663store = transaction.objectStore('storeName')
     664store.put(value, 'key')
     665store.get('key')
     666PASS test_data !== result is true
     667PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
     668PASS test_data.length === result.length is true
     669PASS is(test_data[0], result[0]) is true
     670PASS is(test_data[1], result[1]) is true
     671PASS is(test_data[2], result[2]) is true
     672PASS is(test_data[3], result[3]) is true
     673
     674value = new Uint8ClampedArray([0, 1, 254, 255])
     675transaction = db.transaction('storeName', 'readwrite')
     676store = transaction.objectStore('storeName')
     677store.put(value, 'key')
     678store.get('key')
     679PASS test_data !== result is true
     680PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
     681PASS test_data.length === result.length is true
     682PASS is(test_data[0], result[0]) is true
     683PASS is(test_data[1], result[1]) is true
     684PASS is(test_data[2], result[2]) is true
     685PASS is(test_data[3], result[3]) is true
     686
     687value = new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN])
     688transaction = db.transaction('storeName', 'readwrite')
     689store = transaction.objectStore('storeName')
     690store.put(value, 'key')
     691store.get('key')
     692PASS test_data !== result is true
     693PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
     694PASS test_data.length === result.length is true
     695PASS is(test_data[0], result[0]) is true
     696PASS is(test_data[1], result[1]) is true
     697PASS is(test_data[2], result[2]) is true
     698PASS is(test_data[3], result[3]) is true
     699PASS is(test_data[4], result[4]) is true
     700PASS is(test_data[5], result[5]) is true
     701PASS is(test_data[6], result[6]) is true
     702PASS is(test_data[7], result[7]) is true
     703PASS is(test_data[8], result[8]) is true
     704PASS is(test_data[9], result[9]) is true
     705
     706value = new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0, Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN])
     707transaction = db.transaction('storeName', 'readwrite')
     708store = transaction.objectStore('storeName')
     709store.put(value, 'key')
     710store.get('key')
     711PASS test_data !== result is true
     712PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
     713PASS test_data.length === result.length is true
     714PASS is(test_data[0], result[0]) is true
     715PASS is(test_data[1], result[1]) is true
     716PASS is(test_data[2], result[2]) is true
     717PASS is(test_data[3], result[3]) is true
     718PASS is(test_data[4], result[4]) is true
     719PASS is(test_data[5], result[5]) is true
     720PASS is(test_data[6], result[6]) is true
     721PASS is(test_data[7], result[7]) is true
     722
    583723
    584724
  • trunk/LayoutTests/storage/indexeddb/structured-clone.html

    r121492 r122262  
    4141            request.onerror = unexpectedErrorCallback;
    4242            request.onsuccess = function(e) {
    43                 evalAndLog("db.createObjectStore('storeName')");
     43                evalAndLog("store = db.createObjectStore('storeName')");
     44                debug("This index is not used, but evaluating key path on each put() call will exercise (de)serialization:");
     45                evalAndLog("store.createIndex('indexName', 'dummyKeyPath')");
    4446                var trans = request.result;
    4547                trans.onerror = unexpectedErrorCallback;
     
    7173        testFileList,
    7274        testArray,
    73         testObject
     75        testObject,
     76        testTypedArray
    7477    ];
    7578
     
    506509}
    507510
     511function testTypedArray(callback) {
     512    debug("Testing TypedArray");
     513
     514    function testTypedArrayValue(string, callback) {
     515        evalAndLog("value = " + string);
     516        test_data = value;
     517        testValue(test_data, function(result) {
     518            self.result = result;
     519            shouldBeTrue("test_data !== result");
     520            shouldBe("Object.prototype.toString.call(result)", "Object.prototype.toString.call(test_data)");
     521            shouldBeTrue("test_data.length === result.length");
     522            for (i = 0; i < test_data.length; ++i) {
     523                shouldBeTrue("is(test_data[" + i + "], result[" + i + "])");
     524            }
     525            debug("");
     526            callback();
     527        });
     528    }
     529
     530    forEachWithCallback(testTypedArrayValue, [
     531        "new Uint8Array([])",
     532        "new Uint8Array([0, 1, 254, 255])",
     533        "new Uint16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])",
     534        "new Uint32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])",
     535        "new Int8Array([0, 1, 254, 255])",
     536        "new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])",
     537        "new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])",
     538        "new Uint8ClampedArray([0, 1, 254, 255])",
     539        "new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN])",
     540        "new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0, Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN])"
     541    ], callback);
     542}
     543
    508544function testBadTypes()
    509545{
Note: See TracChangeset for help on using the changeset viewer.