Bug 76683

Summary: IndexedDB: refactor basics layout test so that it can be run on workers.
Product: WebKit Reporter: David Grogan <dgrogan>
Component: New BugsAssignee: David Grogan <dgrogan>
Status: RESOLVED FIXED    
Severity: Normal CC: dglazkov, jsbell, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description David Grogan 2012-01-19 20:16:43 PST
IndexedDB: refactor basics layout test so that it can be run on workers.
Comment 1 David Grogan 2012-01-19 20:18:04 PST
Created attachment 123247 [details]
Patch
Comment 2 WebKit Review Bot 2012-01-19 22:17:52 PST
Comment on attachment 123247 [details]
Patch

Attachment 123247 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/11298324

New failing tests:
storage/indexeddb/basics-workers.html
Comment 3 David Grogan 2012-01-20 14:04:11 PST
Created attachment 123374 [details]
Patch
Comment 4 David Grogan 2012-01-20 14:31:24 PST
Created attachment 123380 [details]
Patch
Comment 5 David Grogan 2012-01-20 14:37:55 PST
Created attachment 123383 [details]
Patch
Comment 6 David Grogan 2012-01-20 14:53:26 PST
Josh, could you take a look at this?

https://chromiumcodereview.appspot.com/9269021 runs this as a ui test.

I'm going to convert more (all of the?) layout tests to run on workers after taking a look at integrating idb-worker-common.js and fs-worker-test-util.js into js-test-pre.js.
Comment 7 Joshua Bell 2012-01-27 15:50:38 PST
Comment on attachment 123383 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=123383&action=review

overall lgtm, with a few questions

> LayoutTests/storage/indexeddb/basics-workers.html:11
> +<script src="../../fast/js/resources/js-test-post.js"></script>

We were removing js-test-post.js from other IDB layout tests - is it still necessary here?

> LayoutTests/storage/indexeddb/basics.html:10
> +<script src="../../fast/js/resources/js-test-post.js"></script>

We were removing js-test-post.js from other IDB layout tests - is it still necessary here?

> LayoutTests/storage/indexeddb/resources/basics.js:2
> +    window = self;

I assume this is necessary because some of the shared code (from fast/js?) refers to window? If so, perhaps add a FIXME (here) to change those references to "self" if they're truly agnostic between running in a window and in a worker.

If it's only code in this test (e.g. "'webkitIndexedDB' in window") then I'd just change them to self (which should be safe either way...)

> LayoutTests/storage/indexeddb/resources/basics.js:12
> +    shouldBeTrue("'webkitIndexedDB' in window");

s/window/self/ per above?

> LayoutTests/storage/indexeddb/resources/basics.js:15
> +    shouldBeTrue("'webkitIDBCursor' in window");

s/window/self/ per above?
Comment 8 David Grogan 2012-01-27 18:12:31 PST
Comment on attachment 123383 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=123383&action=review

>> LayoutTests/storage/indexeddb/basics-workers.html:11
>> +<script src="../../fast/js/resources/js-test-post.js"></script>
> 
> We were removing js-test-post.js from other IDB layout tests - is it still necessary here?

Yeah, it calls layoutTestController.waitUntilDone() when jsTestIsAsync == true.

>> LayoutTests/storage/indexeddb/resources/basics.js:2
>> +    window = self;
> 
> I assume this is necessary because some of the shared code (from fast/js?) refers to window? If so, perhaps add a FIXME (here) to change those references to "self" if they're truly agnostic between running in a window and in a worker.
> 
> If it's only code in this test (e.g. "'webkitIndexedDB' in window") then I'd just change them to self (which should be safe either way...)

Good idea.  FIXME added.

>> LayoutTests/storage/indexeddb/resources/basics.js:12
>> +    shouldBeTrue("'webkitIndexedDB' in window");
> 
> s/window/self/ per above?

Done.

>> LayoutTests/storage/indexeddb/resources/basics.js:15
>> +    shouldBeTrue("'webkitIDBCursor' in window");
> 
> s/window/self/ per above?

Done.
Comment 9 David Grogan 2012-01-27 18:13:21 PST
Created attachment 124414 [details]
Patch
Comment 10 David Grogan 2012-01-27 18:37:43 PST
Created attachment 124422 [details]
Patch
Comment 11 David Grogan 2012-01-27 18:39:10 PST
Tony, could you review this?
Comment 12 Tony Chang 2012-01-29 18:25:20 PST
Comment on attachment 124422 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=124422&action=review

> LayoutTests/storage/indexeddb/resources/basics.js:2
> +if (this.importScripts) {
> +    // FIXME: Change js-test-pre.js to use self in place of window where

Should this file go in resources or script-tests?  If this file is only used by basics.html, then it probably should go in script-tests.

> LayoutTests/storage/indexeddb/resources/idb-worker-common.js:1
> +function debug(message)

Is this file used or is it just used when run in Chrome?
Comment 13 David Grogan 2012-01-30 18:12:01 PST
Comment on attachment 124422 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=124422&action=review

>> LayoutTests/storage/indexeddb/resources/basics.js:2
>> +    // FIXME: Change js-test-pre.js to use self in place of window where
> 
> Should this file go in resources or script-tests?  If this file is only used by basics.html, then it probably should go in script-tests.

Also in basics-workers.html.  Should I still put it in script-tests?  I thought script-tests/make-script-test-wrappers was obsolete for tests outside of fast/js.

>> LayoutTests/storage/indexeddb/resources/idb-worker-common.js:1
>> +function debug(message)
> 
> Is this file used or is it just used when run in Chrome?

It's used in DRT as well.  DRT started running dedicated workers sometime in December.
Comment 14 Tony Chang 2012-01-31 12:01:19 PST
Comment on attachment 124422 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=124422&action=review

LGTM

>>> LayoutTests/storage/indexeddb/resources/basics.js:2
>>> +    // FIXME: Change js-test-pre.js to use self in place of window where
>> 
>> Should this file go in resources or script-tests?  If this file is only used by basics.html, then it probably should go in script-tests.
> 
> Also in basics-workers.html.  Should I still put it in script-tests?  I thought script-tests/make-script-test-wrappers was obsolete for tests outside of fast/js.

Ah, you can keep it here since it's used by 2 files.
Comment 15 WebKit Review Bot 2012-01-31 14:05:49 PST
Comment on attachment 124422 [details]
Patch

Clearing flags on attachment: 124422

Committed r106392: <http://trac.webkit.org/changeset/106392>
Comment 16 WebKit Review Bot 2012-01-31 14:05:54 PST
All reviewed patches have been landed.  Closing bug.