Bug 80664

Summary: IndexedDB layout tests: factor out prefix-handling-code
Product: WebKit Reporter: David Grogan <dgrogan>
Component: New BugsAssignee: David Grogan <dgrogan>
Status: RESOLVED FIXED    
Severity: Normal CC: 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-03-08 18:28:39 PST
IndexedDB layout test refactor: factor prefix-handling-code
Comment 1 David Grogan 2012-03-08 18:29:18 PST
Created attachment 130945 [details]
Patch
Comment 2 David Grogan 2012-03-12 16:03:08 PDT
Created attachment 131433 [details]
Patch
Comment 3 David Grogan 2012-03-12 16:17:07 PDT
Created attachment 131439 [details]
Patch
Comment 4 David Grogan 2012-03-12 16:29:49 PDT
Created attachment 131444 [details]
Patch
Comment 5 David Grogan 2012-03-12 17:30:13 PDT
Created attachment 131467 [details]
Patch
Comment 6 David Grogan 2012-03-12 17:38:20 PDT
Josh, could you look at this?

The prefix lines were moved to a function, dealWithPrefixes, in shared.js that each test now calls.

With apologies to any non-googlers who might be reading this, it might be easier to look at the expectation changes here:
http://emmy/chrome/layout-test-results/results.html
Comment 7 Joshua Bell 2012-03-13 12:28:37 PDT
Comment on attachment 131467 [details]
Patch

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

> LayoutTests/ChangeLog:15
> +        * storage/indexeddb/basics-workers-expected.txt:

Was basics-shared-workers-expected.txt missed?

> LayoutTests/ChangeLog:54
> +        * storage/indexeddb/database-quota.html:

Looks like database-quota-expected.txt wasn't updated?

> LayoutTests/storage/indexeddb/resources/shared.js:27
> +function dealWithPrefixes()

I'm not thrilled with the name... how about "removeVendorPrefixes" ?

> LayoutTests/storage/indexeddb/resources/shared.js:41
> +    shouldBeFalse("indexedDB == null");

Some of the tests had shouldBeFalse("IDBTransaction == null") removed; maybe add shouldBeTrue("Boolean(indexedDB && IDBCursor && IDBDatabase && ...)"); ?
Comment 8 David Grogan 2012-03-13 13:21:34 PDT
Created attachment 131701 [details]
Patch
Comment 9 David Grogan 2012-03-13 13:29:52 PDT
(In reply to comment #7)
> (From update of attachment 131467 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=131467&action=review
> 
> > LayoutTests/ChangeLog:15
> > +        * storage/indexeddb/basics-workers-expected.txt:
> 
> Was basics-shared-workers-expected.txt missed?
> 
> > LayoutTests/ChangeLog:54
> > +        * storage/indexeddb/database-quota.html:
> 
> Looks like database-quota-expected.txt wasn't updated?

Ah yes, these two were missed because new-run-webkit-tests doesn't run them.  Updated.

> 
> > LayoutTests/storage/indexeddb/resources/shared.js:27
> > +function dealWithPrefixes()
> 
> I'm not thrilled with the name... how about "removeVendorPrefixes" ?

Thanks, I meant to revisit that.  removeVendorPrefixes works.

> 
> > LayoutTests/storage/indexeddb/resources/shared.js:41
> > +    shouldBeFalse("indexedDB == null");
> 
> Some of the tests had shouldBeFalse("IDBTransaction == null") removed; maybe add shouldBeTrue("Boolean(indexedDB && IDBCursor && IDBDatabase && ...)"); ?

Changed.

But why does the single Boolean function call work?  I expected to have to add that function call to each object that was incompatible with &&.  It's as if && accepts more types if it knows it's going to be passed to Boolean.  What's going on here that I'm misunderstanding?
Comment 10 Joshua Bell 2012-03-13 16:55:14 PDT
(In reply to comment #9)
> > 
> > Some of the tests had shouldBeFalse("IDBTransaction == null") removed; maybe add shouldBeTrue("Boolean(indexedDB && IDBCursor && IDBDatabase && ...)"); ?
> 
> Changed.
> 
> But why does the single Boolean function call work?  I expected to have to add that function call to each object that was incompatible with &&.  It's as if && accepts more types if it knows it's going to be passed to Boolean.  What's going on here that I'm misunderstanding?

(x && y) will return x (if x is falsy) or y. It doesn't coerce the result to an actual boolean like the comparison operators do.

The Boolean(expr) is just so that what pops out is actually a JS boolean value (true or false), rather than just the last item in the (a && b && c) chain. Boolean(expr) does the same thing as !!expr. !!(a && b && c ...) would work just as well.
Comment 11 David Grogan 2012-03-13 17:14:15 PDT
(In reply to comment #10)
> (In reply to comment #9)
Thanks for the explanation, I get it now.

Do you have any more comments on this patch or should I send it off to tony?
Comment 12 Joshua Bell 2012-03-13 17:15:54 PDT
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> Thanks for the explanation, I get it now.
> 
> Do you have any more comments on this patch or should I send it off to tony?

Nope, lgtm!
Comment 13 David Grogan 2012-03-13 17:45:58 PDT
Tony, could you review this?  Sorry about the huge patch size.

I looked at every new baseline.
Comment 14 Tony Chang 2012-03-14 12:01:38 PDT
Comment on attachment 131701 [details]
Patch

rs=me
Comment 15 WebKit Review Bot 2012-03-14 14:21:25 PDT
Comment on attachment 131701 [details]
Patch

Clearing flags on attachment: 131701

Committed r110750: <http://trac.webkit.org/changeset/110750>
Comment 16 WebKit Review Bot 2012-03-14 14:21:31 PDT
All reviewed patches have been landed.  Closing bug.