Commit Graph

7 Commits (master)

Author SHA1 Message Date
Ariya Hidayat b36da277e9 Port the user agent test.
https://github.com/ariya/phantomjs/issues/12439
2014-09-17 21:57:42 -07:00
Zack Weinberg 3d4f89b41e Bug fixes to test-server Python response hook support.
* correctly fake a package to hold all the response-hook modules
* use StringIO correctly in the response hooks
* prevent .py(c) files in test/www/ from being accessed directly
* prevent test/www/__init__ from being treated as a response hook
* add a test case that makes sure the existing hooks _can_ return 200 OK

(issue #12439; buggy commit 4d60e94)
2014-09-16 20:56:27 +00:00
Ariya Hidayat 2e8f0e8f68 Minor test runner clean-up.
Unused imports are removed.
Ensure that the correct reference is used.

https://github.com/ariya/phantomjs/issues/12439
2014-09-15 21:38:36 -07:00
Zack Weinberg 4d60e9450d Support Python scripts in test/www/.
Rather than add all the special URLs we'll ever want to run-tests.py,
the embedded HTTP server now supports scripts in test/www/.  If you
try to load http://localhost:9180/path and test/www/path doesn't exist
but test/www/path.py does, then test/www/path.py is loaded as a module.
That module must export one function, handle_request(), which is called
to produce the response.

handle_request() has the same semantics as
SimpleHTTPRequestHandler.send_head().  That is, it takes one argument,
the SimpleHTTPRequestHandler object, conventionally named 'req'.
It should call the send_response(), send_header(), and end_headers()
methods of that object as appropriate.  And it should return a readable
filelike whose contents are taken as the body of the response.

If either module import or handle_request() throws any exception, the
HTTP response will be a 500 Internal Server Error with body provided
by cgitb.

Ongoing work on issue #12439.
2014-09-15 16:21:17 +00:00
Ariya Hidayat d52df7a1cf Port the test to abort network request.
https://github.com/ariya/phantomjs/issues/12439
2014-09-11 09:57:03 -07:00
Ariya Hidayat f29b76bb7f Port the test for resource request error handling.
https://github.com/ariya/phantomjs/issues/12439
2014-09-09 23:08:16 -07:00
Ariya Hidayat 784a06c3a7 The test runner also launches an HTTP server.
The server runs on port 9180 and serves the content from test/www
directory. Any tests can use this base URL to load test content and
to exercise certain PhantomJS API.

https://github.com/ariya/phantomjs/issues/12439
2014-09-05 21:31:38 -07:00