Bug 222198

Summary: [LayoutTests] Convert http/tests/loading convert PHP to Python
Product: WebKit Reporter: Chris Gambrell <cgambrell>
Component: Tools / TestsAssignee: Chris Gambrell <cgambrell>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, ews-watchlist, hi, jbedard, ryanhaddad, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=220749
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Chris Gambrell 2021-02-19 14:02:51 PST
Replacing PHP with equivalent Python CGI scripts
Comment 1 Radar WebKit Bug Importer 2021-02-19 14:03:11 PST
<rdar://problem/74536576>
Comment 2 Chris Gambrell 2021-02-23 14:19:18 PST
Created attachment 421349 [details]
Patch
Comment 3 Chris Gambrell 2021-02-23 15:01:59 PST
Created attachment 421355 [details]
Patch
Comment 4 Chris Gambrell 2021-02-24 08:04:11 PST
Created attachment 421411 [details]
Patch
Comment 5 Chris Gambrell 2021-02-24 10:01:10 PST
Created attachment 421419 [details]
Patch
Comment 6 Jonathan Bedard 2021-02-25 11:19:40 PST
Comment on attachment 421419 [details]
Patch

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

> LayoutTests/http/tests/loading/authentication-after-redirect-stores-wrong-credentials/resources/wrong-credential-1-redirect-to-auth.php:-3
> -// That is important, and the next page has to be loaded using 127.0.0.1.

I think you should retain this comment in the python code, even though it isn't in the request

> LayoutTests/http/tests/loading/resourceLoadStatistics/resources/set-cookie.php:-9
> -</script>

This file is being removed, but not replaced. Is it not used anywhere? If not, it's fine to remove it (it's a resource, so it is not itself a test)

> LayoutTests/http/tests/loading/resources/imported-stylesheet-varying-according-domain.css.py:10
> +color = ''

You can do this in a one-liner:

color = 'green' if host == domain else 'red'

> LayoutTests/http/tests/loading/resources/imported-stylesheet-varying-according-domain.css.py:19
> +    'body {{ background-color: {};}}'.format(color)

You may actually consider putting the one-liner as the format argument

> LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-1.py:6
> +today = time.time()

Nit: I'd call this variable "now" since it isn't just the day

> LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-2.py:6
> +today = time.time()

Nit: I'd call this variable "now" since it isn't just the day

> LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-3.py:6
> +today = time.time()

Nit: I'd call this variable "now" since it isn't just the day
Comment 7 Chris Gambrell 2021-03-01 09:39:34 PST
Created attachment 421835 [details]
Patch
Comment 8 Chris Gambrell 2021-03-01 09:40:17 PST
(In reply to Jonathan Bedard from comment #6)
> Comment on attachment 421419 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=421419&action=review
> 
> > LayoutTests/http/tests/loading/authentication-after-redirect-stores-wrong-credentials/resources/wrong-credential-1-redirect-to-auth.php:-3
> > -// That is important, and the next page has to be loaded using 127.0.0.1.
> 
> I think you should retain this comment in the python code, even though it
> isn't in the request
> 
> > LayoutTests/http/tests/loading/resourceLoadStatistics/resources/set-cookie.php:-9
> > -</script>
> 
> This file is being removed, but not replaced. Is it not used anywhere? If
> not, it's fine to remove it (it's a resource, so it is not itself a test)
> 
> > LayoutTests/http/tests/loading/resources/imported-stylesheet-varying-according-domain.css.py:10
> > +color = ''
> 
> You can do this in a one-liner:
> 
> color = 'green' if host == domain else 'red'
> 
> > LayoutTests/http/tests/loading/resources/imported-stylesheet-varying-according-domain.css.py:19
> > +    'body {{ background-color: {};}}'.format(color)
> 
> You may actually consider putting the one-liner as the format argument
> 
> > LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-1.py:6
> > +today = time.time()
> 
> Nit: I'd call this variable "now" since it isn't just the day
> 
> > LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-2.py:6
> > +today = time.time()
> 
> Nit: I'd call this variable "now" since it isn't just the day
> 
> > LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-3.py:6
> > +today = time.time()
> 
> Nit: I'd call this variable "now" since it isn't just the day

Fixed in comment 7
Comment 9 Chris Gambrell 2021-03-01 10:34:53 PST
Created attachment 421842 [details]
Patch
Comment 10 EWS 2021-03-01 13:16:25 PST
Committed r273685: <https://commits.webkit.org/r273685>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 421842 [details].
Comment 11 Chris Gambrell 2021-03-31 19:08:59 PDT
Reopening for the second pass
Comment 12 Chris Gambrell 2021-03-31 19:25:39 PDT
Created attachment 424865 [details]
Patch
Comment 13 Chris Gambrell 2021-04-01 19:09:09 PDT
Created attachment 424974 [details]
Patch
Comment 14 Jonathan Bedard 2021-04-02 11:48:53 PDT
Comment on attachment 424974 [details]
Patch

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

> LayoutTests/http/tests/loading/resources/redirect-methods-result.py:24
> +    header_cookies = os.environ['HTTP_COOKIE']

Any reason not to use get_cookies()?
Comment 15 Chris Gambrell 2021-04-02 12:14:09 PDT
Created attachment 425038 [details]
Patch
Comment 16 EWS 2021-04-06 11:00:37 PDT
Committed r275533: <https://commits.webkit.org/r275533>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 425038 [details].