Commit 56512597 authored by Keita Suzuki's avatar Keita Suzuki Committed by Commit Bot

Replace pywebsocket with pywebsocket3 in //net

This commit replaces the original pywebsocket with pywebsocket3 on //net
tests, and removes any deprecated features. This also tweaks some of the
websocket handlers that used the old API to use new ones.

Change-Id: I6b77d0ed524c3ff279aa659b2ca6c4048e5da95e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2054125Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarDavid Benjamin <davidben@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarAdam Rice <ricea@chromium.org>
Commit-Queue: Keita Suzuki <suzukikeita@google.com>
Cr-Commit-Position: refs/heads/master@{#747618}
parent e83bd826
......@@ -508,6 +508,7 @@ check_targets = [
"//third_party/pystache/*",
"//third_party/py_trace_event/*",
"//third_party/pywebsocket/*",
"//third_party/pywebsocket3/*",
"//third_party/qcms/*",
"//third_party/quic_trace/*",
"//third_party/qunit/*",
......
......@@ -819,7 +819,7 @@ if (!is_android) {
"//testing/test_env.py",
"//third_party/mocha/mocha.js",
"//third_party/polymer/v1_0/components-chromium/iron-test-helpers/mock-interactions.js",
"//third_party/pywebsocket/src/mod_pywebsocket/",
"//third_party/pywebsocket3/src/mod_pywebsocket/",
"//third_party/simplejson/",
"//third_party/tlslite/",
"//ui/webui/resources/",
......@@ -3666,7 +3666,7 @@ test("unit_tests") {
"//extensions/test/data/",
"//google_apis/test/data/",
"//net/tools/testserver/",
"//third_party/pywebsocket/src/mod_pywebsocket/",
"//third_party/pywebsocket3/src/mod_pywebsocket/",
"//third_party/tlslite/",
"//third_party/zlib/google/test/data/",
"//tools/metrics/histograms/enums.xml",
......@@ -5795,7 +5795,7 @@ if (!is_android) {
"//ppapi/tests/test_page.css.mock-http-headers",
"//third_party/mocha/mocha.js",
"//third_party/polymer/v1_0/components-chromium/iron-test-helpers/mock-interactions.js",
"//third_party/pywebsocket/src/mod_pywebsocket/",
"//third_party/pywebsocket3/src/mod_pywebsocket/",
"//third_party/tlslite/",
"//third_party/zlib/google/test/data/",
"//tools/metrics/histograms/enums.xml",
......@@ -6381,7 +6381,7 @@ if (!is_fuchsia && !is_android) {
data = [
"//chrome/test/data/sync/",
"//net/tools/testserver/",
"//third_party/pywebsocket/src/mod_pywebsocket/",
"//third_party/pywebsocket3/src/mod_pywebsocket/",
"//third_party/tlslite/",
"//testing/xvfb.py",
]
......
......@@ -1274,7 +1274,7 @@ test("content_browsertests") {
"//ppapi/tests/test_case.html",
"//ppapi/tests/test_page.css",
"//ppapi/tests/test_url_loader_data/",
"//third_party/pywebsocket/src/mod_pywebsocket/",
"//third_party/pywebsocket3/src/mod_pywebsocket/",
"//third_party/tlslite/",
]
}
......
......@@ -241,7 +241,7 @@ test("extensions_browsertests") {
data = [
"//extensions/test/data/",
"//net/tools/testserver/",
"//third_party/pywebsocket/src/mod_pywebsocket/",
"//third_party/pywebsocket3/src/mod_pywebsocket/",
"//third_party/tlslite/",
"$root_out_dir/extensions_shell_and_test.pak",
]
......
......@@ -641,7 +641,7 @@ test("headless_browsertests") {
"$root_out_dir/headless_lib.pak",
"//net/tools/testserver/",
"//third_party/blink/web_tests/http/tests/inspector-protocol/",
"//third_party/pywebsocket/",
"//third_party/pywebsocket3/",
"//third_party/tlslite/",
"test/data/",
]
......
......@@ -4568,16 +4568,16 @@ test("net_unittests") {
if (is_linux || is_mac || is_win || is_fuchsia) {
deps += [
"//third_party/pywebsocket/",
"//third_party/pywebsocket3/",
"//third_party/tlslite/",
]
data_deps += [
"//third_party/pywebsocket/",
"//third_party/pywebsocket3/",
"//third_party/tlslite/",
]
data += [
"tools/testserver/",
"//third_party/pywebsocket/src/mod_pywebsocket/",
"//third_party/pywebsocket3/src/mod_pywebsocket/",
"//third_party/tlslite/",
]
}
......
......@@ -7,12 +7,11 @@
# It is used by test case WebSocketEndToEndTest.HeaderContinuations.
from mod_pywebsocket import handshake
from mod_pywebsocket.handshake.hybi import compute_accept
from mod_pywebsocket.handshake.hybi import compute_accept_from_unicode
def web_socket_do_extra_handshake(request):
accept = compute_accept(
request.headers_in['Sec-WebSocket-Key'].encode('UTF-8'))[0]
accept = compute_accept_from_unicode(request.headers_in['Sec-WebSocket-Key'])
message = (b'HTTP/1.1 101 Switching Protocols\r\n'
b'Upgrade: websocket\r\n'
b'Connection: Upgrade\r\n'
......
......@@ -7,12 +7,11 @@
# It is used by test case WebSocketEndToEndTest.TrailingWhitespace.
from mod_pywebsocket import handshake
from mod_pywebsocket.handshake.hybi import compute_accept
from mod_pywebsocket.handshake.hybi import compute_accept_from_unicode
def web_socket_do_extra_handshake(request):
accept = compute_accept(
request.headers_in['Sec-WebSocket-Key'].encode('UTF-8'))[0]
accept = compute_accept_from_unicode(request.headers_in['Sec-WebSocket-Key'])
message = (b'HTTP/1.1 101 Switching Protocols\r\n'
b'Upgrade: websocket\r\n'
b'Connection: Upgrade\r\n'
......
......@@ -177,7 +177,7 @@ base::Optional<std::vector<base::FilePath>> LocalTestServer::GetPythonPath()
std::vector<base::FilePath> ret = {
third_party_dir.AppendASCII("tlslite"),
third_party_dir.AppendASCII("pywebsocket").AppendASCII("src"),
third_party_dir.AppendASCII("pywebsocket3").AppendASCII("src"),
};
// Locate the Python code generated by the protocol buffers compiler.
......
......@@ -42,7 +42,7 @@ ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(BASE_DIR)))
# Insert at the beginning of the path, we want to use our copies of the library
# unconditionally (since they contain modifications from anything that might be
# obtained from e.g. PyPi).
sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party', 'pywebsocket', 'src'))
sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party', 'pywebsocket3', 'src'))
sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party', 'tlslite'))
import mod_pywebsocket.standalone
......@@ -89,17 +89,15 @@ class WebSocketOptions:
self.websock_handlers_map_file = None
self.cgi_directories = []
self.is_executable_method = None
self.allow_draft75 = False
self.strict = True
self.use_tls = False
self.private_key = None
self.certificate = None
self.tls_client_auth = False
self.tls_client_ca = None
self.tls_module = 'ssl'
self.use_basic_auth = False
self.basic_auth_credential = 'Basic ' + base64.b64encode('test:test')
self.basic_auth_credential = 'Basic ' + base64.b64encode(
'test:test').decode()
class RecordingSSLSessionCache(object):
......
# Generated by running:
# build/print_python_deps.py --root net/tools/testserver --output net/tools/testserver/testserver.pydeps --whitelist third_party/tlslite/tlslite/utils net/tools/testserver/testserver.py
../../../third_party/pywebsocket/src/mod_pywebsocket/__init__.py
../../../third_party/pywebsocket/src/mod_pywebsocket/_stream_base.py
../../../third_party/pywebsocket/src/mod_pywebsocket/_stream_hixie75.py
../../../third_party/pywebsocket/src/mod_pywebsocket/_stream_hybi.py
../../../third_party/pywebsocket/src/mod_pywebsocket/common.py
../../../third_party/pywebsocket/src/mod_pywebsocket/dispatch.py
../../../third_party/pywebsocket/src/mod_pywebsocket/extensions.py
../../../third_party/pywebsocket/src/mod_pywebsocket/handshake/__init__.py
../../../third_party/pywebsocket/src/mod_pywebsocket/handshake/_base.py
../../../third_party/pywebsocket/src/mod_pywebsocket/handshake/hybi.py
../../../third_party/pywebsocket/src/mod_pywebsocket/handshake/hybi00.py
../../../third_party/pywebsocket/src/mod_pywebsocket/http_header_util.py
../../../third_party/pywebsocket/src/mod_pywebsocket/memorizingfile.py
../../../third_party/pywebsocket/src/mod_pywebsocket/msgutil.py
../../../third_party/pywebsocket/src/mod_pywebsocket/mux.py
../../../third_party/pywebsocket/src/mod_pywebsocket/standalone.py
../../../third_party/pywebsocket/src/mod_pywebsocket/stream.py
../../../third_party/pywebsocket/src/mod_pywebsocket/util.py
../../../third_party/pywebsocket/src/mod_pywebsocket/xhr_benchmark_handler.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/__init__.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/_stream_exceptions.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/common.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/dispatch.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/extensions.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/handshake/__init__.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/handshake/_base.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/handshake/hybi.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/http_header_util.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/memorizingfile.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/msgutil.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/request_handler.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/server_util.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/standalone.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/stream.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/util.py
../../../third_party/pywebsocket3/src/mod_pywebsocket/websocket_server.py
../../../third_party/tlslite/tlslite/__init__.py
../../../third_party/tlslite/tlslite/api.py
../../../third_party/tlslite/tlslite/basedb.py
......
......@@ -366,7 +366,7 @@ source_set("tests") {
data = [
"//net/tools/testserver/",
"//services/test/data",
"//third_party/pywebsocket/src/mod_pywebsocket/",
"//third_party/pywebsocket3/src/mod_pywebsocket/",
"//third_party/tlslite/",
]
}
......
......@@ -4,7 +4,7 @@
# pwebsocket is a Python program. Depend on this to get the data deps necessary
# to run it in the test environment.
group("pywebsocket") {
group("pywebsocket3") {
# For now, depend on the mod_pywebsocket directory.
data = [ "//third_party/pywebsocket3/src/mod_pywebsocket/" ]
}
......@@ -73,7 +73,7 @@ test("weblayer_browsertests") {
"$root_out_dir/weblayer_shell.pak",
"data/",
"//net/tools/testserver/",
"//third_party/pywebsocket/src/mod_pywebsocket/",
"//third_party/pywebsocket3/src/mod_pywebsocket/",
"//third_party/tlslite/",
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment