diff options
Diffstat (limited to 'testing/web-platform/tests/tools/third_party/pywebsocket3')
71 files changed, 345 insertions, 1972 deletions
diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/.gitignore b/testing/web-platform/tests/tools/third_party/pywebsocket3/.gitignore deleted file mode 100644 index 70f2867054..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.pyc -build/ -*.egg-info/ -dist/ diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/.travis.yml b/testing/web-platform/tests/tools/third_party/pywebsocket3/.travis.yml deleted file mode 100644 index 2065a644dd..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: python -python: - - 2.7 - - 3.5 - - 3.6 - - 3.7 - - 3.8 - - nightly - -matrix: - allow_failures: - - python: 3.5, nightly -install: - - pip install six yapf -script: - - python test/run_all.py - - yapf --diff --recursive . diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/CONTRIBUTING b/testing/web-platform/tests/tools/third_party/pywebsocket3/CONTRIBUTING deleted file mode 100644 index f975be126f..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/CONTRIBUTING +++ /dev/null @@ -1,30 +0,0 @@ -# How to Contribute - -We'd love to accept your patches and contributions to this project. There are -just a few small guidelines you need to follow. - -## Contributor License Agreement - -Contributions to this project must be accompanied by a Contributor License -Agreement. You (or your employer) retain the copyright to your contribution; -this simply gives us permission to use and redistribute your contributions as -part of the project. Head over to <https://cla.developers.google.com/> to see -your current agreements on file or to sign a new one. - -You generally only need to submit a CLA once, so if you've already submitted one -(even if it was for a different project), you probably don't need to do it -again. - -## Code reviews - -All submissions, including submissions by project members, require review. We -use GitHub pull requests for this purpose. Consult -[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more -information on using pull requests. -For instructions for contributing code, please read: -https://github.com/google/pywebsocket/wiki/CodeReviewInstruction - -## Community Guidelines - -This project follows -[Google's Open Source Community Guidelines](https://opensource.google/conduct/). diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/MANIFEST.in b/testing/web-platform/tests/tools/third_party/pywebsocket3/MANIFEST.in index 19256882c5..116235d18f 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/MANIFEST.in +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/MANIFEST.in @@ -2,5 +2,5 @@ include COPYING include MANIFEST.in include README recursive-include example *.py -recursive-include mod_pywebsocket *.py +recursive-include pywebsocket3 *.py recursive-include test *.py diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/PKG-INFO b/testing/web-platform/tests/tools/third_party/pywebsocket3/PKG-INFO new file mode 100644 index 0000000000..289dfa8649 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/PKG-INFO @@ -0,0 +1,13 @@ +Metadata-Version: 2.1 +Name: pywebsocket3 +Version: 4.0.2 +Summary: Standalone WebSocket Server for testing purposes. +Home-page: https://github.com/GoogleChromeLabs/pywebsocket3 +Author: Yuzo Fujishima +Author-email: yuzo@chromium.org +License: See LICENSE +Requires-Python: >=2.7 +License-File: LICENSE +Requires-Dist: six + +pywebsocket3 is a standalone server for the WebSocket Protocol (RFC 6455). See pywebsocket3/__init__.py for more detail. diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/README.md b/testing/web-platform/tests/tools/third_party/pywebsocket3/README.md index 8684f2cc7e..b46b416735 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/README.md +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/README.md @@ -1,13 +1,14 @@ # pywebsocket3 # -The pywebsocket project aims to provide a [WebSocket](https://tools.ietf.org/html/rfc6455) standalone server. +The pywebsocket3 project aims to provide a [WebSocket](https://tools.ietf.org/html/rfc6455) standalone server. pywebsocket is intended for **testing** or **experimental** purposes. Run this to read the general document: -``` -$ pydoc mod_pywebsocket + +```bash +pydoc pywebsocket3 ``` Please see [Wiki](https://github.com/GoogleChromeLabs/pywebsocket3/wiki) for more details. @@ -15,22 +16,27 @@ Please see [Wiki](https://github.com/GoogleChromeLabs/pywebsocket3/wiki) for mor # INSTALL # To install this package to the system, run this: -``` -$ python setup.py build -$ sudo python setup.py install + +```bash +python setup.py build +sudo python setup.py install ``` To install this package as a normal user, run this instead: +```bash +python setup.py build +python setup.py install --user ``` -$ python setup.py build -$ python setup.py install --user -``` + # LAUNCH # To use pywebsocket as standalone server, run this to read the document: + +```bash +pydoc pywebsocket3.standalone ``` -$ pydoc mod_pywebsocket.standalone -``` + # Disclaimer # + This is not an officially supported Google product diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/abort_handshake_wsh.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/abort_handshake_wsh.py index 1b719ca897..1bad8c02f2 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/abort_handshake_wsh.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/abort_handshake_wsh.py @@ -28,7 +28,8 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from __future__ import absolute_import -from mod_pywebsocket import handshake + +from pywebsocket3 import handshake def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/abort_wsh.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/abort_wsh.py index d4c240bf2c..c0495c7107 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/abort_wsh.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/abort_wsh.py @@ -28,7 +28,8 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from __future__ import absolute_import -from mod_pywebsocket import handshake + +from pywebsocket3 import handshake def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/arraybuffer_benchmark.html b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/arraybuffer_benchmark.html deleted file mode 100644 index 869cd7e1ee..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/arraybuffer_benchmark.html +++ /dev/null @@ -1,134 +0,0 @@ -<!-- -Copyright 2013, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<html> -<head> -<title>ArrayBuffer benchmark</title> -<script src="util.js"></script> -<script> -var PRINT_SIZE = true; - -// Initial size of arrays. -var START_SIZE = 10 * 1024; -// Stops benchmark when the size of an array exceeds this threshold. -var STOP_THRESHOLD = 100000 * 1024; -// If the size of each array is small, write/read the array multiple times -// until the sum of sizes reaches this threshold. -var MIN_TOTAL = 100000 * 1024; -var MULTIPLIERS = [5, 2]; - -// Repeat benchmark for several times to measure performance of optimized -// (such as JIT) run. -var REPEAT_FOR_WARMUP = 3; - -function writeBenchmark(size, minTotal) { - var totalSize = 0; - while (totalSize < minTotal) { - var arrayBuffer = new ArrayBuffer(size); - - // Write 'a's. - fillArrayBuffer(arrayBuffer, 0x61); - - totalSize += size; - } - return totalSize; -} - -function readBenchmark(size, minTotal) { - var totalSize = 0; - while (totalSize < minTotal) { - var arrayBuffer = new ArrayBuffer(size); - - if (!verifyArrayBuffer(arrayBuffer, 0x00)) { - queueLog('Verification failed'); - return -1; - } - - totalSize += size; - } - return totalSize; -} - -function runBenchmark(benchmarkFunction, - size, - stopThreshold, - minTotal, - multipliers, - multiplierIndex) { - while (size <= stopThreshold) { - var maxSpeed = 0; - - for (var i = 0; i < REPEAT_FOR_WARMUP; ++i) { - var startTimeInMs = getTimeStamp(); - - var totalSize = benchmarkFunction(size, minTotal); - - maxSpeed = Math.max(maxSpeed, - calculateSpeedInKB(totalSize, startTimeInMs)); - } - queueLog(formatResultInKiB(size, maxSpeed, PRINT_SIZE)); - - size *= multipliers[multiplierIndex]; - multiplierIndex = (multiplierIndex + 1) % multipliers.length; - } -} - -function runBenchmarks() { - queueLog('Message size in KiB, Speed in kB/s'); - - queueLog('Write benchmark'); - runBenchmark( - writeBenchmark, START_SIZE, STOP_THRESHOLD, MIN_TOTAL, MULTIPLIERS, 0); - queueLog('Finished'); - - queueLog('Read benchmark'); - runBenchmark( - readBenchmark, START_SIZE, STOP_THRESHOLD, MIN_TOTAL, MULTIPLIERS, 0); - addToLog('Finished'); -} - -function init() { - logBox = document.getElementById('log'); - - queueLog(window.navigator.userAgent.toLowerCase()); - - addToLog('Started...'); - - setTimeout(runBenchmarks, 0); -} - -</script> -</head> -<body onload="init()"> -<textarea - id="log" rows="50" style="width: 100%" readonly></textarea> -</body> -</html> diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/bench_wsh.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/bench_wsh.py index 2df50e77db..9ea2f93159 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/bench_wsh.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/bench_wsh.py @@ -35,7 +35,9 @@ value. <count> must be an integer value. """ from __future__ import absolute_import + import time + from six.moves import range diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/benchmark.html b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/benchmark.html deleted file mode 100644 index f1e5c97b3a..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/benchmark.html +++ /dev/null @@ -1,175 +0,0 @@ -<!-- -Copyright 2013, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<html> -<head> -<title>WebSocket benchmark</title> -<script src="util_main.js"></script> -<script src="util.js"></script> -<script src="benchmark.js"></script> -<script> -var addressBox = null; - -function getConfig() { - return { - prefixUrl: addressBox.value, - printSize: getBoolFromCheckBox('printsize'), - numSockets: getIntFromInput('numsockets'), - // Initial size of messages. - numIterations: getIntFromInput('numiterations'), - numWarmUpIterations: getIntFromInput('numwarmupiterations'), - startSize: getIntFromInput('startsize'), - // Stops benchmark when the size of message exceeds this threshold. - stopThreshold: getIntFromInput('stopthreshold'), - // If the size of each message is small, send/receive multiple messages - // until the sum of sizes reaches this threshold. - minTotal: getIntFromInput('mintotal'), - multipliers: getFloatArrayFromInput('multipliers'), - verifyData: getBoolFromCheckBox('verifydata'), - addToLog: addToLog, - addToSummary: addToSummary, - measureValue: measureValue, - notifyAbort: notifyAbort - }; -} - -function onSendBenchmark() { - var config = getConfig(); - doAction(config, getBoolFromCheckBox('worker'), 'sendBenchmark'); -} - -function onReceiveBenchmark() { - var config = getConfig(); - doAction(config, getBoolFromCheckBox('worker'), 'receiveBenchmark'); -} - -function onBatchBenchmark() { - var config = getConfig(); - doAction(config, getBoolFromCheckBox('worker'), 'batchBenchmark'); -} - -function onStop() { - var config = getConfig(); - doAction(config, getBoolFromCheckBox('worker'), 'stop'); -} - -function init() { - addressBox = document.getElementById('address'); - logBox = document.getElementById('log'); - - summaryBox = document.getElementById('summary'); - - var scheme = window.location.protocol == 'https:' ? 'wss://' : 'ws://'; - var defaultAddress = scheme + window.location.host + '/benchmark_helper'; - - addressBox.value = defaultAddress; - - addToLog(window.navigator.userAgent.toLowerCase()); - addToSummary(window.navigator.userAgent.toLowerCase()); - - if (!('WebSocket' in window)) { - addToLog('WebSocket is not available'); - } - - initWorker(''); -} -</script> -</head> -<body onload="init()"> - -<div id="benchmark_div"> - url <input type="text" id="address" size="40"> - <input type="button" value="send" onclick="onSendBenchmark()"> - <input type="button" value="receive" onclick="onReceiveBenchmark()"> - <input type="button" value="batch" onclick="onBatchBenchmark()"> - <input type="button" value="stop" onclick="onStop()"> - - <br/> - - <input type="checkbox" id="printsize" checked> - <label for="printsize">Print size and time per message</label> - <input type="checkbox" id="verifydata" checked> - <label for="verifydata">Verify data</label> - <input type="checkbox" id="worker"> - <label for="worker">Run on worker</label> - - <br/> - - Parameters: - - <br/> - - <table> - <tr> - <td>Num sockets</td> - <td><input type="text" id="numsockets" value="1"></td> - </tr> - <tr> - <td>Number of iterations</td> - <td><input type="text" id="numiterations" value="1"></td> - </tr> - <tr> - <td>Number of warm-up iterations</td> - <td><input type="text" id="numwarmupiterations" value="0"></td> - </tr> - <tr> - <td>Start size</td> - <td><input type="text" id="startsize" value="10240"></td> - </tr> - <tr> - <td>Stop threshold</td> - <td><input type="text" id="stopthreshold" value="102400000"></td> - </tr> - <tr> - <td>Minimum total</td> - <td><input type="text" id="mintotal" value="102400000"></td> - </tr> - <tr> - <td>Multipliers</td> - <td><input type="text" id="multipliers" value="5, 2"></td> - </tr> - </table> -</div> - -<div id="log_div"> - <textarea - id="log" rows="20" style="width: 100%" readonly></textarea> -</div> -<div id="summary_div"> - Summary - <textarea - id="summary" rows="20" style="width: 100%" readonly></textarea> -</div> - -Note: Effect of RTT is not eliminated. - -</body> -</html> diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/benchmark.js b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/benchmark.js deleted file mode 100644 index 2701472a4f..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/benchmark.js +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright 2014, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -if (typeof importScripts !== "undefined") { - // Running on a worker - importScripts('util.js', 'util_worker.js'); -} - -// Namespace for holding globals. -var benchmark = {startTimeInMs: 0}; - -var sockets = []; -var numEstablishedSockets = 0; - -var timerID = null; - -function destroySocket(socket) { - socket.onopen = null; - socket.onmessage = null; - socket.onerror = null; - socket.onclose = null; - socket.close(); -} - -function destroyAllSockets() { - for (var i = 0; i < sockets.length; ++i) { - destroySocket(sockets[i]); - } - sockets = []; -} - -function sendBenchmarkStep(size, config, isWarmUp) { - timerID = null; - - var totalSize = 0; - var totalReplied = 0; - - var onMessageHandler = function(event) { - if (!verifyAcknowledgement(config, event.data, size)) { - destroyAllSockets(); - config.notifyAbort(); - return; - } - - totalReplied += size; - - if (totalReplied < totalSize) { - return; - } - - calculateAndLogResult(config, size, benchmark.startTimeInMs, totalSize, - isWarmUp); - - runNextTask(config); - }; - - for (var i = 0; i < sockets.length; ++i) { - var socket = sockets[i]; - socket.onmessage = onMessageHandler; - } - - var dataArray = []; - - while (totalSize < config.minTotal) { - var buffer = new ArrayBuffer(size); - - fillArrayBuffer(buffer, 0x61); - - dataArray.push(buffer); - totalSize += size; - } - - benchmark.startTimeInMs = getTimeStamp(); - - totalSize = 0; - - var socketIndex = 0; - var dataIndex = 0; - while (totalSize < config.minTotal) { - var command = ['send']; - command.push(config.verifyData ? '1' : '0'); - sockets[socketIndex].send(command.join(' ')); - sockets[socketIndex].send(dataArray[dataIndex]); - socketIndex = (socketIndex + 1) % sockets.length; - - totalSize += size; - ++dataIndex; - } -} - -function receiveBenchmarkStep(size, config, isWarmUp) { - timerID = null; - - var totalSize = 0; - var totalReplied = 0; - - var onMessageHandler = function(event) { - var bytesReceived = event.data.byteLength; - if (bytesReceived != size) { - config.addToLog('Expected ' + size + 'B but received ' + - bytesReceived + 'B'); - destroyAllSockets(); - config.notifyAbort(); - return; - } - - if (config.verifyData && !verifyArrayBuffer(event.data, 0x61)) { - config.addToLog('Response verification failed'); - destroyAllSockets(); - config.notifyAbort(); - return; - } - - totalReplied += bytesReceived; - - if (totalReplied < totalSize) { - return; - } - - calculateAndLogResult(config, size, benchmark.startTimeInMs, totalSize, - isWarmUp); - - runNextTask(config); - }; - - for (var i = 0; i < sockets.length; ++i) { - var socket = sockets[i]; - socket.binaryType = 'arraybuffer'; - socket.onmessage = onMessageHandler; - } - - benchmark.startTimeInMs = getTimeStamp(); - - var socketIndex = 0; - while (totalSize < config.minTotal) { - sockets[socketIndex].send('receive ' + size); - socketIndex = (socketIndex + 1) % sockets.length; - - totalSize += size; - } -} - -function createSocket(config) { - // TODO(tyoshino): Add TCP warm up. - var url = config.prefixUrl; - - config.addToLog('Connect ' + url); - - var socket = new WebSocket(url); - socket.onmessage = function(event) { - config.addToLog('Unexpected message received. Aborting.'); - }; - socket.onerror = function() { - config.addToLog('Error'); - }; - socket.onclose = function(event) { - config.addToLog('Closed'); - config.notifyAbort(); - }; - return socket; -} - -function startBenchmark(config) { - clearTimeout(timerID); - destroyAllSockets(); - - numEstablishedSockets = 0; - - for (var i = 0; i < config.numSockets; ++i) { - var socket = createSocket(config); - socket.onopen = function() { - config.addToLog('Opened'); - - ++numEstablishedSockets; - - if (numEstablishedSockets == sockets.length) { - runNextTask(config); - } - }; - sockets.push(socket); - } -} - -function getConfigString(config) { - return '(WebSocket' + - ', ' + (typeof importScripts !== "undefined" ? 'Worker' : 'Main') + - ', numSockets=' + config.numSockets + - ', numIterations=' + config.numIterations + - ', verifyData=' + config.verifyData + - ', minTotal=' + config.minTotal + - ', numWarmUpIterations=' + config.numWarmUpIterations + - ')'; -} - -function batchBenchmark(config) { - config.addToLog('Batch benchmark'); - config.addToLog(buildLegendString(config)); - - tasks = []; - clearAverageData(); - addTasks(config, sendBenchmarkStep); - addResultReportingTask(config, 'Send Benchmark ' + getConfigString(config)); - addTasks(config, receiveBenchmarkStep); - addResultReportingTask(config, 'Receive Benchmark ' + - getConfigString(config)); - startBenchmark(config); -} - -function cleanup() { - destroyAllSockets(); -} diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/benchmark_helper_wsh.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/benchmark_helper_wsh.py index fc17533335..9ea9f56422 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/benchmark_helper_wsh.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/benchmark_helper_wsh.py @@ -27,7 +27,9 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Handler for benchmark.html.""" + from __future__ import absolute_import + import six diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/close_wsh.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/close_wsh.py index 8f0005ffea..2463bc7b31 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/close_wsh.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/close_wsh.py @@ -28,10 +28,8 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from __future__ import absolute_import -import struct -from mod_pywebsocket import common -from mod_pywebsocket import stream +from pywebsocket3 import common def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/console.html b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/console.html deleted file mode 100644 index ccd6d8f806..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/console.html +++ /dev/null @@ -1,317 +0,0 @@ -<!-- -Copyright 2011, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<!-- -A simple console for testing WebSocket server. - -Type an address into the top text input and click connect to establish -WebSocket. Then, type some message into the bottom text input and click send -to send the message. Received/sent messages and connection state will be shown -on the middle textarea. ---> - -<html> -<head> -<title>WebSocket console</title> -<script> -var socket = null; - -var showTimeStamp = false; - -var addressBox = null; -var protocolsBox = null; -var logBox = null; -var messageBox = null; -var fileBox = null; -var codeBox = null; -var reasonBox = null; - -function getTimeStamp() { - return new Date().getTime(); -} - -function addToLog(log) { - if (showTimeStamp) { - logBox.value += '[' + getTimeStamp() + '] '; - } - logBox.value += log + '\n' - // Large enough to keep showing the latest message. - logBox.scrollTop = 1000000; -} - -function setbinarytype(binaryType) { - if (!socket) { - addToLog('Not connected'); - return; - } - - socket.binaryType = binaryType; - addToLog('Set binaryType to ' + binaryType); -} - -function send() { - if (!socket) { - addToLog('Not connected'); - return; - } - - socket.send(messageBox.value); - addToLog('> ' + messageBox.value); - messageBox.value = ''; -} - -function sendfile() { - if (!socket) { - addToLog('Not connected'); - return; - } - - var files = fileBox.files; - - if (files.length == 0) { - addToLog('File not selected'); - return; - } - - socket.send(files[0]); - addToLog('> Send ' + files[0].name); -} - -function parseProtocols(protocolsText) { - var protocols = protocolsText.split(','); - for (var i = 0; i < protocols.length; ++i) { - protocols[i] = protocols[i].trim(); - } - - if (protocols.length == 0) { - // Don't pass. - protocols = null; - } else if (protocols.length == 1) { - if (protocols[0].length == 0) { - // Don't pass. - protocols = null; - } else { - // Pass as a string. - protocols = protocols[0]; - } - } - - return protocols; -} - -function connect() { - var url = addressBox.value; - var protocols = parseProtocols(protocolsBox.value); - - if ('WebSocket' in window) { - if (protocols) { - socket = new WebSocket(url, protocols); - } else { - socket = new WebSocket(url); - } - } else { - return; - } - - socket.onopen = function () { - var extraInfo = []; - if (('protocol' in socket) && socket.protocol) { - extraInfo.push('protocol = ' + socket.protocol); - } - if (('extensions' in socket) && socket.extensions) { - extraInfo.push('extensions = ' + socket.extensions); - } - - var logMessage = 'Opened'; - if (extraInfo.length > 0) { - logMessage += ' (' + extraInfo.join(', ') + ')'; - } - addToLog(logMessage); - }; - socket.onmessage = function (event) { - if (('ArrayBuffer' in window) && (event.data instanceof ArrayBuffer)) { - addToLog('< Received an ArrayBuffer of ' + event.data.byteLength + - ' bytes') - } else if (('Blob' in window) && (event.data instanceof Blob)) { - addToLog('< Received a Blob of ' + event.data.size + ' bytes') - } else { - addToLog('< ' + event.data); - } - }; - socket.onerror = function () { - addToLog('Error'); - }; - socket.onclose = function (event) { - var logMessage = 'Closed ('; - if ((arguments.length == 1) && ('CloseEvent' in window) && - (event instanceof CloseEvent)) { - logMessage += 'wasClean = ' + event.wasClean; - // code and reason are present only for - // draft-ietf-hybi-thewebsocketprotocol-06 and later - if ('code' in event) { - logMessage += ', code = ' + event.code; - } - if ('reason' in event) { - logMessage += ', reason = ' + event.reason; - } - } else { - logMessage += 'CloseEvent is not available'; - } - addToLog(logMessage + ')'); - }; - - if (protocols) { - addToLog('Connect ' + url + ' (protocols = ' + protocols + ')'); - } else { - addToLog('Connect ' + url); - } -} - -function closeSocket() { - if (!socket) { - addToLog('Not connected'); - return; - } - - if (codeBox.value || reasonBox.value) { - socket.close(codeBox.value, reasonBox.value); - } else { - socket.close(); - } -} - -function printState() { - if (!socket) { - addToLog('Not connected'); - return; - } - - addToLog( - 'url = ' + socket.url + - ', readyState = ' + socket.readyState + - ', bufferedAmount = ' + socket.bufferedAmount); -} - -function init() { - var scheme = window.location.protocol == 'https:' ? 'wss://' : 'ws://'; - var defaultAddress = scheme + window.location.host + '/echo'; - - addressBox = document.getElementById('address'); - protocolsBox = document.getElementById('protocols'); - logBox = document.getElementById('log'); - messageBox = document.getElementById('message'); - fileBox = document.getElementById('file'); - codeBox = document.getElementById('code'); - reasonBox = document.getElementById('reason'); - - addressBox.value = defaultAddress; - - if (!('WebSocket' in window)) { - addToLog('WebSocket is not available'); - } -} -</script> -<style type="text/css"> -form { - margin: 0px; -} - -#connect_div, #log_div, #send_div, #sendfile_div, #close_div, #printstate_div { - padding: 5px; - margin: 5px; - border-width: 0px 0px 0px 10px; - border-style: solid; - border-color: silver; -} -</style> -</head> -<body onload="init()"> - -<div> - -<div id="connect_div"> - <form action="#" onsubmit="connect(); return false;"> - url <input type="text" id="address" size="40"> - <input type="submit" value="connect"> - <br/> - protocols <input type="text" id="protocols" size="20"> - </form> -</div> - -<div id="log_div"> - <textarea id="log" rows="10" cols="40" readonly></textarea> - <br/> - <input type="checkbox" - name="showtimestamp" - value="showtimestamp" - onclick="showTimeStamp = this.checked">Show time stamp -</div> - -<div id="send_div"> - <form action="#" onsubmit="send(); return false;"> - data <input type="text" id="message" size="40"> - <input type="submit" value="send"> - </form> -</div> - -<div id="sendfile_div"> - <form action="#" onsubmit="sendfile(); return false;"> - <input type="file" id="file" size="40"> - <input type="submit" value="send file"> - </form> - - Set binaryType - <input type="radio" - name="binarytype" - value="blob" - onclick="setbinarytype('blob')" checked>blob - <input type="radio" - name="binarytype" - value="arraybuffer" - onclick="setbinarytype('arraybuffer')">arraybuffer -</div> - -<div id="close_div"> - <form action="#" onsubmit="closeSocket(); return false;"> - code <input type="text" id="code" size="10"> - reason <input type="text" id="reason" size="20"> - <input type="submit" value="close"> - </form> -</div> - -<div id="printstate_div"> - <input type="button" value="print state" onclick="printState();"> -</div> - -</div> - -</body> -</html> diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/cookie_wsh.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/cookie_wsh.py index 815209694e..1ca2c84386 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/cookie_wsh.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/cookie_wsh.py @@ -27,6 +27,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from __future__ import absolute_import + from six.moves import urllib diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/echo_client.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/echo_client.py index 2ed60b3b59..5063f00a51 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/echo_client.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/echo_client.py @@ -30,13 +30,13 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Simple WebSocket client named echo_client just because of historical reason. -mod_pywebsocket directory must be in PYTHONPATH. +pywebsocket3 directory must be in PYTHONPATH. Example Usage: # server setup - % cd $pywebsocket - % PYTHONPATH=$cwd/src python ./mod_pywebsocket/standalone.py -p 8880 \ + % cd $pywebsocket3 + % PYTHONPATH=$cwd/src python ./pywebsocket3/standalone.py -p 8880 \ -d $cwd/src/example # run client @@ -47,27 +47,27 @@ Example Usage: from __future__ import absolute_import from __future__ import print_function + +import argparse import base64 import codecs -from hashlib import sha1 import logging -import argparse import os -import random import re -import six import socket import ssl -import struct import sys +from hashlib import sha1 + +import six -from mod_pywebsocket import common -from mod_pywebsocket.extensions import PerMessageDeflateExtensionProcessor -from mod_pywebsocket.extensions import _PerMessageDeflateFramer -from mod_pywebsocket.extensions import _parse_window_bits -from mod_pywebsocket.stream import Stream -from mod_pywebsocket.stream import StreamOptions -from mod_pywebsocket import util +from pywebsocket3 import common, util +from pywebsocket3.extensions import ( + PerMessageDeflateExtensionProcessor, + _PerMessageDeflateFramer, + _parse_window_bits, +) +from pywebsocket3.stream import Stream, StreamOptions _TIMEOUT_SEC = 10 _UNDEFINED_PORT = -1 diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/handler_map.txt b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/handler_map.txt deleted file mode 100644 index 21c4c09aa0..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/handler_map.txt +++ /dev/null @@ -1,11 +0,0 @@ -# websocket handler map file, used by standalone.py -m option. -# A line starting with '#' is a comment line. -# Each line consists of 'alias_resource_path' and 'existing_resource_path' -# separated by spaces. -# Aliasing is processed from the top to the bottom of the line, and -# 'existing_resource_path' must exist before it is aliased. -# For example, -# / /echo -# means that a request to '/' will be handled by handlers for '/echo'. -/ /echo - diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/internal_error_wsh.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/internal_error_wsh.py index 04aa684283..cbc0fd294e 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/internal_error_wsh.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/internal_error_wsh.py @@ -28,7 +28,8 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from __future__ import absolute_import -from mod_pywebsocket import msgutil + +from pywebsocket3 import msgutil def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/performance_test_iframe.html b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/performance_test_iframe.html deleted file mode 100644 index c18b2c08f6..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/performance_test_iframe.html +++ /dev/null @@ -1,37 +0,0 @@ -<!-- -Copyright 2020, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<!DOCTYPE html> -<head> -<script src="util.js"></script> -<script src="performance_test_iframe.js"></script> -<script src="benchmark.js"></script> -</head> diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/performance_test_iframe.js b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/performance_test_iframe.js deleted file mode 100644 index 270409aa6e..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/performance_test_iframe.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2020, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -function perfTestAddToLog(text) { - parent.postMessage({'command': 'log', 'value': text}, '*'); -} - -function perfTestAddToSummary(text) { -} - -function perfTestMeasureValue(value) { - parent.postMessage({'command': 'measureValue', 'value': value}, '*'); -} - -function perfTestNotifyAbort() { - parent.postMessage({'command': 'notifyAbort'}, '*'); -} - -function getConfigForPerformanceTest(dataType, async, - verifyData, numIterations, - numWarmUpIterations) { - - return { - prefixUrl: 'ws://' + location.host + '/benchmark_helper', - printSize: true, - numSockets: 1, - // + 1 is for a warmup iteration by the Telemetry framework. - numIterations: numIterations + numWarmUpIterations + 1, - numWarmUpIterations: numWarmUpIterations, - minTotal: 10240000, - startSize: 10240000, - stopThreshold: 10240000, - multipliers: [2], - verifyData: verifyData, - dataType: dataType, - async: async, - addToLog: perfTestAddToLog, - addToSummary: perfTestAddToSummary, - measureValue: perfTestMeasureValue, - notifyAbort: perfTestNotifyAbort - }; -} - -var data; -onmessage = function(message) { - var action; - if (message.data.command === 'start') { - data = message.data; - initWorker('http://' + location.host); - action = data.benchmarkName; - } else { - action = 'stop'; - } - - var config = getConfigForPerformanceTest(data.dataType, data.async, - data.verifyData, - data.numIterations, - data.numWarmUpIterations); - doAction(config, data.isWorker, action); -}; diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/special_headers.cgi b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/special_headers.cgi deleted file mode 100755 index 703cb7401b..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/special_headers.cgi +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/python - -# Copyright 2014 Google Inc. All rights reserved. -# -# Use of this source code is governed by a BSD-style -# license that can be found in the COPYING file or at -# https://developers.google.com/open-source/licenses/bsd -"""CGI script sample for testing effect of HTTP headers on the origin page. - -Note that CGI scripts don't work on the standalone pywebsocket running in TLS -mode. -""" - -print """Content-type: text/html -Content-Security-Policy: connect-src self - -<html> -<head> -<title></title> -</head> -<body> -<script> -var socket = new WebSocket("ws://example.com"); -</script> -</body> -</html>""" diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/util.js b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/util.js deleted file mode 100644 index 990160cb40..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/util.js +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright 2013, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Utilities for example applications (for both main and worker thread). - -var results = {}; - -function getTimeStamp() { - return Date.now(); -} - -function formatResultInKiB(size, timePerMessageInMs, stddevTimePerMessageInMs, - speed, printSize) { - if (printSize) { - return (size / 1024) + - '\t' + timePerMessageInMs.toFixed(3) + - (stddevTimePerMessageInMs == -1 ? - '' : - '\t' + stddevTimePerMessageInMs.toFixed(3)) + - '\t' + speed.toFixed(3); - } else { - return speed.toString(); - } -} - -function clearAverageData() { - results = {}; -} - -function reportAverageData(config) { - config.addToSummary( - 'Size[KiB]\tAverage time[ms]\tStddev time[ms]\tSpeed[KB/s]'); - for (var size in results) { - var averageTimePerMessageInMs = results[size].sum_t / results[size].n; - var speed = calculateSpeedInKB(size, averageTimePerMessageInMs); - // Calculate sample standard deviation - var stddevTimePerMessageInMs = Math.sqrt( - (results[size].sum_t2 / results[size].n - - averageTimePerMessageInMs * averageTimePerMessageInMs) * - results[size].n / - (results[size].n - 1)); - config.addToSummary(formatResultInKiB( - size, averageTimePerMessageInMs, stddevTimePerMessageInMs, speed, - true)); - } -} - -function calculateSpeedInKB(size, timeSpentInMs) { - return Math.round(size / timeSpentInMs * 1000) / 1000; -} - -function calculateAndLogResult(config, size, startTimeInMs, totalSize, - isWarmUp) { - var timeSpentInMs = getTimeStamp() - startTimeInMs; - var speed = calculateSpeedInKB(totalSize, timeSpentInMs); - var timePerMessageInMs = timeSpentInMs / (totalSize / size); - if (!isWarmUp) { - config.measureValue(timePerMessageInMs); - if (!results[size]) { - results[size] = {n: 0, sum_t: 0, sum_t2: 0}; - } - results[size].n ++; - results[size].sum_t += timePerMessageInMs; - results[size].sum_t2 += timePerMessageInMs * timePerMessageInMs; - } - config.addToLog(formatResultInKiB(size, timePerMessageInMs, -1, speed, - config.printSize)); -} - -function repeatString(str, count) { - var data = ''; - var expChunk = str; - var remain = count; - while (true) { - if (remain % 2) { - data += expChunk; - remain = (remain - 1) / 2; - } else { - remain /= 2; - } - - if (remain == 0) - break; - - expChunk = expChunk + expChunk; - } - return data; -} - -function fillArrayBuffer(buffer, c) { - var i; - - var u32Content = c * 0x01010101; - - var u32Blocks = Math.floor(buffer.byteLength / 4); - var u32View = new Uint32Array(buffer, 0, u32Blocks); - // length attribute is slow on Chrome. Don't use it for loop condition. - for (i = 0; i < u32Blocks; ++i) { - u32View[i] = u32Content; - } - - // Fraction - var u8Blocks = buffer.byteLength - u32Blocks * 4; - var u8View = new Uint8Array(buffer, u32Blocks * 4, u8Blocks); - for (i = 0; i < u8Blocks; ++i) { - u8View[i] = c; - } -} - -function verifyArrayBuffer(buffer, expectedChar) { - var i; - - var expectedU32Value = expectedChar * 0x01010101; - - var u32Blocks = Math.floor(buffer.byteLength / 4); - var u32View = new Uint32Array(buffer, 0, u32Blocks); - for (i = 0; i < u32Blocks; ++i) { - if (u32View[i] != expectedU32Value) { - return false; - } - } - - var u8Blocks = buffer.byteLength - u32Blocks * 4; - var u8View = new Uint8Array(buffer, u32Blocks * 4, u8Blocks); - for (i = 0; i < u8Blocks; ++i) { - if (u8View[i] != expectedChar) { - return false; - } - } - - return true; -} - -function verifyBlob(config, blob, expectedChar, doneCallback) { - var reader = new FileReader(blob); - reader.onerror = function() { - config.addToLog('FileReader Error: ' + reader.error.message); - doneCallback(blob.size, false); - } - reader.onloadend = function() { - var result = verifyArrayBuffer(reader.result, expectedChar); - doneCallback(blob.size, result); - } - reader.readAsArrayBuffer(blob); -} - -function verifyAcknowledgement(config, message, size) { - if (typeof message != 'string') { - config.addToLog('Invalid ack type: ' + typeof message); - return false; - } - var parsedAck = parseInt(message); - if (isNaN(parsedAck)) { - config.addToLog('Invalid ack value: ' + message); - return false; - } - if (parsedAck != size) { - config.addToLog( - 'Expected ack for ' + size + 'B but received one for ' + parsedAck + - 'B'); - return false; - } - - return true; -} - -function cloneConfig(obj) { - var newObj = {}; - for (key in obj) { - newObj[key] = obj[key]; - } - return newObj; -} - -var tasks = []; - -function runNextTask(config) { - var task = tasks.shift(); - if (task == undefined) { - config.addToLog('Finished'); - cleanup(); - return; - } - timerID = setTimeout(task, 0); -} - -function buildLegendString(config) { - var legend = '' - if (config.printSize) - legend = 'Message size in KiB, Time/message in ms, '; - legend += 'Speed in kB/s'; - return legend; -} - -function addTasks(config, stepFunc) { - for (var i = 0; - i < config.numWarmUpIterations + config.numIterations; ++i) { - var multiplierIndex = 0; - for (var size = config.startSize; - size <= config.stopThreshold; - ++multiplierIndex) { - var task = stepFunc.bind( - null, - size, - config, - i < config.numWarmUpIterations); - tasks.push(task); - var multiplier = config.multipliers[ - multiplierIndex % config.multipliers.length]; - if (multiplier <= 1) { - config.addToLog('Invalid multiplier ' + multiplier); - config.notifyAbort(); - throw new Error('Invalid multipler'); - } - size = Math.ceil(size * multiplier); - } - } -} - -function addResultReportingTask(config, title) { - tasks.push(function(){ - timerID = null; - config.addToSummary(title); - reportAverageData(config); - clearAverageData(); - runNextTask(config); - }); -} - -function sendBenchmark(config) { - config.addToLog('Send benchmark'); - config.addToLog(buildLegendString(config)); - - tasks = []; - clearAverageData(); - addTasks(config, sendBenchmarkStep); - addResultReportingTask(config, 'Send Benchmark ' + getConfigString(config)); - startBenchmark(config); -} - -function receiveBenchmark(config) { - config.addToLog('Receive benchmark'); - config.addToLog(buildLegendString(config)); - - tasks = []; - clearAverageData(); - addTasks(config, receiveBenchmarkStep); - addResultReportingTask(config, - 'Receive Benchmark ' + getConfigString(config)); - startBenchmark(config); -} - -function stop(config) { - clearTimeout(timerID); - timerID = null; - tasks = []; - config.addToLog('Stopped'); - cleanup(); -} - -var worker; - -function initWorker(origin) { - worker = new Worker(origin + '/benchmark.js'); -} - -function doAction(config, isWindowToWorker, action) { - if (isWindowToWorker) { - worker.onmessage = function(addToLog, addToSummary, - measureValue, notifyAbort, message) { - if (message.data.type === 'addToLog') - addToLog(message.data.data); - else if (message.data.type === 'addToSummary') - addToSummary(message.data.data); - else if (message.data.type === 'measureValue') - measureValue(message.data.data); - else if (message.data.type === 'notifyAbort') - notifyAbort(); - }.bind(undefined, config.addToLog, config.addToSummary, - config.measureValue, config.notifyAbort); - config.addToLog = undefined; - config.addToSummary = undefined; - config.measureValue = undefined; - config.notifyAbort = undefined; - worker.postMessage({type: action, config: config}); - } else { - if (action === 'sendBenchmark') - sendBenchmark(config); - else if (action === 'receiveBenchmark') - receiveBenchmark(config); - else if (action === 'batchBenchmark') - batchBenchmark(config); - else if (action === 'stop') - stop(config); - } -} diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/util_main.js b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/util_main.js deleted file mode 100644 index 78add48731..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/util_main.js +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2014, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Utilities for example applications (for the main thread only). - -var logBox = null; -var queuedLog = ''; - -var summaryBox = null; - -function queueLog(log) { - queuedLog += log + '\n'; -} - -function addToLog(log) { - logBox.value += queuedLog; - queuedLog = ''; - logBox.value += log + '\n'; - logBox.scrollTop = 1000000; -} - -function addToSummary(log) { - summaryBox.value += log + '\n'; - summaryBox.scrollTop = 1000000; -} - -// value: execution time in milliseconds. -// config.measureValue is intended to be used in Performance Tests. -// Do nothing here in non-PerformanceTest. -function measureValue(value) { -} - -// config.notifyAbort is called when the benchmark failed and aborted, and -// intended to be used in Performance Tests. -// Do nothing here in non-PerformanceTest. -function notifyAbort() { -} - -function getIntFromInput(id) { - return parseInt(document.getElementById(id).value); -} - -function getStringFromRadioBox(name) { - var list = document.getElementById('benchmark_form')[name]; - for (var i = 0; i < list.length; ++i) - if (list.item(i).checked) - return list.item(i).value; - return undefined; -} -function getBoolFromCheckBox(id) { - return document.getElementById(id).checked; -} - -function getIntArrayFromInput(id) { - var strArray = document.getElementById(id).value.split(','); - return strArray.map(function(str) { return parseInt(str, 10); }); -} - -function getFloatArrayFromInput(id) { - var strArray = document.getElementById(id).value.split(','); - return strArray.map(parseFloat); -} diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/util_worker.js b/testing/web-platform/tests/tools/third_party/pywebsocket3/example/util_worker.js deleted file mode 100644 index dd90449a90..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/example/util_worker.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Utilities for example applications (for the worker threads only). - -onmessage = function (message) { - var config = message.data.config; - config.addToLog = function(text) { - postMessage({type: 'addToLog', data: text}); }; - config.addToSummary = function(text) { - postMessage({type: 'addToSummary', data: text}); }; - config.measureValue = function(value) { - postMessage({type: 'measureValue', data: value}); }; - config.notifyAbort = function() { postMessage({type: 'notifyAbort'}); }; - - doAction(config, false, message.data.type); -}; diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/fast_masking.i b/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/fast_masking.i deleted file mode 100644 index ddaad27f53..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/fast_masking.i +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2013, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -%module fast_masking - -%include "cstring.i" - -%{ -#include <cstring> - -#ifdef __SSE2__ -#include <emmintrin.h> -#endif -%} - -%apply (char *STRING, int LENGTH) { - (const char* payload, int payload_length), - (const char* masking_key, int masking_key_length) }; -%cstring_output_allocate_size( - char** result, int* result_length, delete [] *$1); - -%inline %{ - -void mask( - const char* payload, int payload_length, - const char* masking_key, int masking_key_length, - int masking_key_index, - char** result, int* result_length) { - *result = new char[payload_length]; - *result_length = payload_length; - memcpy(*result, payload, payload_length); - - char* cursor = *result; - char* cursor_end = *result + *result_length; - -#ifdef __SSE2__ - while ((cursor < cursor_end) && - (reinterpret_cast<size_t>(cursor) & 0xf)) { - *cursor ^= masking_key[masking_key_index]; - ++cursor; - masking_key_index = (masking_key_index + 1) % masking_key_length; - } - if (cursor == cursor_end) { - return; - } - - const int kBlockSize = 16; - __m128i masking_key_block; - for (int i = 0; i < kBlockSize; ++i) { - *(reinterpret_cast<char*>(&masking_key_block) + i) = - masking_key[masking_key_index]; - masking_key_index = (masking_key_index + 1) % masking_key_length; - } - - while (cursor + kBlockSize <= cursor_end) { - __m128i payload_block = - _mm_load_si128(reinterpret_cast<__m128i*>(cursor)); - _mm_stream_si128(reinterpret_cast<__m128i*>(cursor), - _mm_xor_si128(payload_block, masking_key_block)); - cursor += kBlockSize; - } -#endif - - while (cursor < cursor_end) { - *cursor ^= masking_key[masking_key_index]; - ++cursor; - masking_key_index = (masking_key_index + 1) % masking_key_length; - } -} - -%} diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/PKG-INFO b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/PKG-INFO new file mode 100644 index 0000000000..289dfa8649 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/PKG-INFO @@ -0,0 +1,13 @@ +Metadata-Version: 2.1 +Name: pywebsocket3 +Version: 4.0.2 +Summary: Standalone WebSocket Server for testing purposes. +Home-page: https://github.com/GoogleChromeLabs/pywebsocket3 +Author: Yuzo Fujishima +Author-email: yuzo@chromium.org +License: See LICENSE +Requires-Python: >=2.7 +License-File: LICENSE +Requires-Dist: six + +pywebsocket3 is a standalone server for the WebSocket Protocol (RFC 6455). See pywebsocket3/__init__.py for more detail. diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/SOURCES.txt b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/SOURCES.txt new file mode 100644 index 0000000000..9a74c73196 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/SOURCES.txt @@ -0,0 +1,64 @@ +LICENSE +MANIFEST.in +README.md +setup.py +example/abort_handshake_wsh.py +example/abort_wsh.py +example/bench_wsh.py +example/benchmark_helper_wsh.py +example/close_wsh.py +example/cookie_wsh.py +example/echo_client.py +example/echo_noext_wsh.py +example/echo_wsh.py +example/hsts_wsh.py +example/internal_error_wsh.py +example/origin_check_wsh.py +example/cgi-bin/hi.py +pywebsocket3/__init__.py +pywebsocket3/_stream_exceptions.py +pywebsocket3/common.py +pywebsocket3/dispatch.py +pywebsocket3/extensions.py +pywebsocket3/http_header_util.py +pywebsocket3/memorizingfile.py +pywebsocket3/msgutil.py +pywebsocket3/request_handler.py +pywebsocket3/server_util.py +pywebsocket3/standalone.py +pywebsocket3/stream.py +pywebsocket3/util.py +pywebsocket3/websocket_server.py +pywebsocket3.egg-info/PKG-INFO +pywebsocket3.egg-info/SOURCES.txt +pywebsocket3.egg-info/dependency_links.txt +pywebsocket3.egg-info/requires.txt +pywebsocket3.egg-info/top_level.txt +pywebsocket3/handshake/__init__.py +pywebsocket3/handshake/base.py +pywebsocket3/handshake/hybi.py +test/__init__.py +test/client_for_testing.py +test/mock.py +test/run_all.py +test/set_sys_path.py +test/test_dispatch.py +test/test_endtoend.py +test/test_extensions.py +test/test_handshake.py +test/test_handshake_hybi.py +test/test_http_header_util.py +test/test_memorizingfile.py +test/test_mock.py +test/test_msgutil.py +test/test_stream.py +test/test_util.py +test/testdata/handlers/abort_by_user_wsh.py +test/testdata/handlers/blank_wsh.py +test/testdata/handlers/origin_check_wsh.py +test/testdata/handlers/sub/exception_in_transfer_wsh.py +test/testdata/handlers/sub/no_wsh_at_the_end.py +test/testdata/handlers/sub/non_callable_wsh.py +test/testdata/handlers/sub/plain_wsh.py +test/testdata/handlers/sub/wrong_handshake_sig_wsh.py +test/testdata/handlers/sub/wrong_transfer_sig_wsh.py
\ No newline at end of file diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/dependency_links.txt b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/dependency_links.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/requires.txt b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/requires.txt new file mode 100644 index 0000000000..ffe2fce498 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/requires.txt @@ -0,0 +1 @@ +six diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/top_level.txt b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/top_level.txt new file mode 100644 index 0000000000..db62422f0b --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3.egg-info/top_level.txt @@ -0,0 +1 @@ +pywebsocket3 diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/__init__.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/__init__.py index 28d5f5950f..8f4ade0582 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/__init__.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/__init__.py @@ -28,7 +28,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ A Standalone WebSocket Server for testing purposes -mod_pywebsocket is an API that provides WebSocket functionalities with +pywebsocket3 is an API that provides WebSocket functionalities with a standalone WebSocket server. It is intended for testing or experimental purposes. @@ -37,7 +37,7 @@ Installation 1. Follow standalone server documentation to start running the standalone server. It can be read by running the following command: - $ pydoc mod_pywebsocket.standalone + $ pydoc pywebsocket3.standalone 2. Once the standalone server is launched verify it by accessing http://localhost[:port]/console.html. Include the port number when @@ -96,7 +96,7 @@ Data Transfer web_socket_transfer_data is called after the handshake completed successfully. A handler can receive/send messages from/to the client -using request. mod_pywebsocket.msgutil module provides utilities +using request. pywebsocket3.msgutil module provides utilities for data transfer. You can receive a message by the following statement. diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/_stream_exceptions.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/_stream_exceptions.py index b47878bc4a..b47878bc4a 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/_stream_exceptions.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/_stream_exceptions.py diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/common.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/common.py index 9cb11f15cb..a3321e4c68 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/common.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/common.py @@ -30,7 +30,9 @@ """ from __future__ import absolute_import -from mod_pywebsocket import http_header_util + +from pywebsocket3 import http_header_util + # Additional log level definitions. LOGLEVEL_FINE = 9 diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/dispatch.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/dispatch.py index 56cbb3c8a5..fd35ceab29 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/dispatch.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/dispatch.py @@ -30,17 +30,19 @@ """ from __future__ import absolute_import + import io -import logging import os import re import traceback -from mod_pywebsocket import common -from mod_pywebsocket import handshake -from mod_pywebsocket import msgutil -from mod_pywebsocket import stream -from mod_pywebsocket import util +from pywebsocket3 import ( + common, + handshake, + msgutil, + stream, + util +) _SOURCE_PATH_PATTERN = re.compile(r'(?i)_wsh\.py$') _SOURCE_SUFFIX = '_wsh.py' diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/extensions.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/extensions.py index 314a949d45..4b5b9e8fb2 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/extensions.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/extensions.py @@ -28,9 +28,9 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from __future__ import absolute_import -from mod_pywebsocket import common -from mod_pywebsocket import util -from mod_pywebsocket.http_header_util import quote_if_necessary + +from pywebsocket3 import common, util +from pywebsocket3.http_header_util import quote_if_necessary # The list of available server side extension processor classes. _available_processors = {} diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/handshake/__init__.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/handshake/__init__.py index 4bc1c67c57..275e447552 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/handshake/__init__.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/handshake/__init__.py @@ -32,15 +32,19 @@ successfully established. """ from __future__ import absolute_import + import logging -from mod_pywebsocket import common -from mod_pywebsocket.handshake import hybi +from pywebsocket3 import common +from pywebsocket3.handshake import hybi # Export AbortedByUserException, HandshakeException, and VersionException # symbol from this module. -from mod_pywebsocket.handshake.base import AbortedByUserException -from mod_pywebsocket.handshake.base import HandshakeException -from mod_pywebsocket.handshake.base import VersionException +from pywebsocket3.handshake.base import ( + AbortedByUserException, + HandshakeException, + VersionException +) + _LOGGER = logging.getLogger(__name__) diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/handshake/base.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/handshake/base.py index ffad0614d6..561f7b650a 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/handshake/base.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/handshake/base.py @@ -32,15 +32,12 @@ processors. from __future__ import absolute_import -from mod_pywebsocket import common -from mod_pywebsocket import http_header_util -from mod_pywebsocket.extensions import get_extension_processor -from mod_pywebsocket.stream import StreamOptions -from mod_pywebsocket.stream import Stream -from mod_pywebsocket import util - -from six.moves import map -from six.moves import range +from pywebsocket3 import common, http_header_util, util +from pywebsocket3.extensions import get_extension_processor +from pywebsocket3.stream import Stream, StreamOptions + +from six.moves import map, range + # Defining aliases for values used frequently. _VERSION_LATEST = common.VERSION_HYBI_LATEST diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/handshake/hybi.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/handshake/hybi.py index cf931db5a5..2e26532c3f 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/handshake/hybi.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/handshake/hybi.py @@ -34,17 +34,20 @@ http://tools.ietf.org/html/rfc6455 """ from __future__ import absolute_import + import base64 import re from hashlib import sha1 -from mod_pywebsocket import common -from mod_pywebsocket.handshake.base import get_mandatory_header -from mod_pywebsocket.handshake.base import HandshakeException -from mod_pywebsocket.handshake.base import parse_token_list -from mod_pywebsocket.handshake.base import validate_mandatory_header -from mod_pywebsocket.handshake.base import HandshakerBase -from mod_pywebsocket import util +from pywebsocket3 import common, util +from pywebsocket3.handshake.base import ( + get_mandatory_header, + HandshakeException, + parse_token_list, + validate_mandatory_header, + HandshakerBase +) + # Used to validate the value in the Sec-WebSocket-Key header strictly. RFC 4648 # disallows non-zero padding, so the character right before == must be any of diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/http_header_util.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/http_header_util.py index 21fde59af1..63e698bc16 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/http_header_util.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/http_header_util.py @@ -31,8 +31,10 @@ in HTTP RFC http://www.ietf.org/rfc/rfc2616.txt. """ from __future__ import absolute_import + import six.moves.urllib.parse + _SEPARATORS = '()<>@,;:\\"/[]?={} \t' diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/memorizingfile.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/memorizingfile.py index d353967618..4ee132fae6 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/memorizingfile.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/memorizingfile.py @@ -34,6 +34,7 @@ A memorizing file wraps a file and memorizes lines read by readline. """ from __future__ import absolute_import + import sys @@ -61,7 +62,7 @@ class MemorizingFile(object): def __getattribute__(self, name): """Return a file attribute. - + Returns the value overridden by this class for some attributes, and forwards the call to _file for the other attributes. """ diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/msgutil.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/msgutil.py index f58ca78e14..dd6a6fc410 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/msgutil.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/msgutil.py @@ -36,14 +36,18 @@ bytes writing/reading. """ from __future__ import absolute_import -import six.moves.queue + import threading +import six.moves.queue + # Export Exception symbols from msgutil for backward compatibility -from mod_pywebsocket._stream_exceptions import ConnectionTerminatedException -from mod_pywebsocket._stream_exceptions import InvalidFrameException -from mod_pywebsocket._stream_exceptions import BadOperationException -from mod_pywebsocket._stream_exceptions import UnsupportedFrameException +from pywebsocket3._stream_exceptions import ( + ConnectionTerminatedException, + InvalidFrameException, + BadOperationException, + UnsupportedFrameException +) # An API for handler to send/receive WebSocket messages. diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/request_handler.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/request_handler.py index 5e9c875dc7..9d89b47c69 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/request_handler.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/request_handler.py @@ -34,12 +34,14 @@ import os from six.moves import CGIHTTPServer from six.moves import http_client -from mod_pywebsocket import common -from mod_pywebsocket import dispatch -from mod_pywebsocket import handshake -from mod_pywebsocket import http_header_util -from mod_pywebsocket import memorizingfile -from mod_pywebsocket import util +from pywebsocket3 import ( + common, + dispatch, + handshake, + http_header_util, + memorizingfile, + util +) # 1024 is practically large enough to contain WebSocket handshake lines. _MAX_MEMORIZED_LINES = 1024 diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/server_util.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/server_util.py index 8f9e273e97..3bf07f885b 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/server_util.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/server_util.py @@ -33,8 +33,7 @@ import logging.handlers import threading import time -from mod_pywebsocket import common -from mod_pywebsocket import util +from pywebsocket3 import common, util def _get_logger_from_class(c): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/standalone.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/standalone.py index bd32158790..0c324c4221 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/standalone.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/standalone.py @@ -38,7 +38,7 @@ BASIC USAGE Go to the src directory and run - $ python mod_pywebsocket/standalone.py [-p <ws_port>] + $ python pywebsocket3/standalone.py [-p <ws_port>] [-w <websock_handlers>] [-d <document_root>] @@ -48,11 +48,11 @@ Go to the src directory and run <websock_handlers> is the path to the root directory of WebSocket handlers. If not specified, <document_root> will be used. See __init__.py (or -run $ pydoc mod_pywebsocket) for how to write WebSocket handlers. +run $ pydoc pywebsocket3) for how to write WebSocket handlers. For more detail and other options, run - $ python mod_pywebsocket/standalone.py --help + $ python pywebsocket3/standalone.py --help or see _build_option_parser method below. @@ -66,7 +66,7 @@ Go to the src directory and run standalone.py with -d option to set the document root to the directory containing example HTMLs and handlers like this: $ cd src - $ PYTHONPATH=. python mod_pywebsocket/standalone.py -d example + $ PYTHONPATH=. python pywebsocket3/standalone.py -d example to launch pywebsocket with the sample handler and html on port 80. Open http://localhost/console.html, click the connect button, type something into @@ -85,7 +85,7 @@ TLS connection silently fails while pyOpenSSL fails on startup. Example: - $ PYTHONPATH=. python mod_pywebsocket/standalone.py \ + $ PYTHONPATH=. python pywebsocket3/standalone.py \ -d example \ -p 10443 \ -t \ @@ -105,7 +105,7 @@ TLS support. Example: - $ PYTHONPATH=. python mod_pywebsocket/standalone.py -d example -p 10443 -t \ + $ PYTHONPATH=. python pywebsocket3/standalone.py -d example -p 10443 -t \ -c ../test/cert/cert.pem -k ../test/cert/key.pem \ --tls-client-auth \ --tls-client-ca=../test/cert/cacert.pem @@ -154,19 +154,20 @@ used outside a firewall. """ from __future__ import absolute_import -from six.moves import configparser + +import argparse import base64 import logging -import argparse import os -import six import sys import traceback -from mod_pywebsocket import common -from mod_pywebsocket import util -from mod_pywebsocket import server_util -from mod_pywebsocket.websocket_server import WebSocketServer +import six +from six.moves import configparser + +from pywebsocket3 import common, server_util, util +from pywebsocket3.websocket_server import WebSocketServer + _DEFAULT_LOG_MAX_BYTES = 1024 * 256 _DEFAULT_LOG_BACKUP_COUNT = 5 @@ -480,8 +481,8 @@ def _main(args=None): server = WebSocketServer(options) server.serve_forever() except Exception as e: - logging.critical('mod_pywebsocket: %s' % e) - logging.critical('mod_pywebsocket: %s' % traceback.format_exc()) + logging.critical('pywebsocket3: %s' % e) + logging.critical('pywebsocket3: %s' % traceback.format_exc()) sys.exit(1) diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/stream.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/stream.py index 82d1ea619c..dd41850dc4 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/stream.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/stream.py @@ -33,21 +33,22 @@ Specification: http://tools.ietf.org/html/rfc6455 """ -from collections import deque import logging import os import struct import time -import socket +from collections import deque + import six -from mod_pywebsocket import common -from mod_pywebsocket import util -from mod_pywebsocket._stream_exceptions import BadOperationException -from mod_pywebsocket._stream_exceptions import ConnectionTerminatedException -from mod_pywebsocket._stream_exceptions import InvalidFrameException -from mod_pywebsocket._stream_exceptions import InvalidUTF8Exception -from mod_pywebsocket._stream_exceptions import UnsupportedFrameException +from pywebsocket3 import common, util +from pywebsocket3._stream_exceptions import ( + BadOperationException, + ConnectionTerminatedException, + InvalidFrameException, + InvalidUTF8Exception, + UnsupportedFrameException +) _NOOP_MASKER = util.NoopMasker() diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/util.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/util.py index 04006ecacd..9c25ab8315 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/util.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/util.py @@ -29,20 +29,18 @@ """WebSocket utilities.""" from __future__ import absolute_import -import array -import errno + import logging import os import re -import six -from six.moves import map -from six.moves import range -import socket import struct import zlib +import six +from six.moves import map, range + try: - from mod_pywebsocket import fast_masking + from pywebsocket3 import fast_masking except ImportError: pass diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/websocket_server.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/websocket_server.py index 9f67c9f02d..dab2f079ff 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/mod_pywebsocket/websocket_server.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/pywebsocket3/websocket_server.py @@ -34,8 +34,7 @@ to use standalone.py, since it is intended to act as a skeleton of this module. """ from __future__ import absolute_import -from six.moves import BaseHTTPServer -from six.moves import socketserver + import logging import re import select @@ -44,9 +43,10 @@ import ssl import threading import traceback -from mod_pywebsocket import dispatch -from mod_pywebsocket import util -from mod_pywebsocket.request_handler import WebSocketRequestHandler +from six.moves import BaseHTTPServer, socketserver + +from pywebsocket3 import dispatch, util +from pywebsocket3.request_handler import WebSocketRequestHandler def _alias_handlers(dispatcher, websock_handlers_map_file): @@ -157,12 +157,13 @@ class WebSocketServer(socketserver.ThreadingMixIn, BaseHTTPServer.HTTPServer): client_cert_ = ssl.CERT_REQUIRED else: client_cert_ = ssl.CERT_NONE - socket_ = ssl.wrap_socket( - socket_, - keyfile=server_options.private_key, - certfile=server_options.certificate, - ca_certs=server_options.tls_client_ca, - cert_reqs=client_cert_) + ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + ssl_context.verify_mode = client_cert_ + ssl_context.load_cert_chain(keyfile=server_options.private_key, + certfile=server_options.certificate) + if client_cert_ != ssl.CERT_NONE: + ssl_context.load_verify_locations(cafile=server_options.tls_client_ca) + socket_ = ssl_context.wrap_socket(socket_, server_side=True) self._sockets.append((socket_, addrinfo)) def server_bind(self): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/setup.cfg b/testing/web-platform/tests/tools/third_party/pywebsocket3/setup.cfg new file mode 100644 index 0000000000..8bfd5a12f8 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/setup.cfg @@ -0,0 +1,4 @@ +[egg_info] +tag_build = +tag_date = 0 + diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/setup.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/setup.py index 12c60d8617..ab9a24a3e7 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/setup.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/setup.py @@ -28,7 +28,8 @@ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -"""Set up script for mod_pywebsocket. + +"""Set up script for pywebsocket3. """ from __future__ import absolute_import @@ -36,7 +37,7 @@ from __future__ import print_function from setuptools import setup, Extension import sys -_PACKAGE_NAME = 'mod_pywebsocket' +_PACKAGE_NAME = 'pywebsocket3' # Build and use a C++ extension for faster masking. SWIG is required. _USE_FAST_MASKING = False @@ -49,8 +50,8 @@ if sys.hexversion < 0x020700f0: if _USE_FAST_MASKING: setup(ext_modules=[ - Extension('mod_pywebsocket/_fast_masking', - ['mod_pywebsocket/fast_masking.i'], + Extension('pywebsocket3/_fast_masking', + ['pywebsocket3/fast_masking.i'], swig_opts=['-c++']) ]) @@ -58,16 +59,16 @@ setup( author='Yuzo Fujishima', author_email='yuzo@chromium.org', description='Standalone WebSocket Server for testing purposes.', - long_description=('mod_pywebsocket is a standalone server for ' + long_description=('pywebsocket3 is a standalone server for ' 'the WebSocket Protocol (RFC 6455). ' - 'See mod_pywebsocket/__init__.py for more detail.'), + 'See pywebsocket3/__init__.py for more detail.'), license='See LICENSE', name=_PACKAGE_NAME, packages=[_PACKAGE_NAME, _PACKAGE_NAME + '.handshake'], python_requires='>=2.7', install_requires=['six'], url='https://github.com/GoogleChromeLabs/pywebsocket3', - version='3.0.2', + version='4.0.2', ) # vi:sts=4 sw=4 et diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/cert/cacert.pem b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/cert/cacert.pem deleted file mode 100644 index 4dadae121b..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/cert/cacert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICvDCCAiWgAwIBAgIJAKqVghkGF1rSMA0GCSqGSIb3DQEBBQUAMEkxCzAJBgNV -BAYTAkpQMQ4wDAYDVQQIEwVUb2t5bzEUMBIGA1UEChMLcHl3ZWJzb2NrZXQxFDAS -BgNVBAMTC3B5d2Vic29ja2V0MB4XDTEyMDYwNjA3MjQzM1oXDTM5MTAyMzA3MjQz -M1owSTELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRQwEgYDVQQKEwtweXdl -YnNvY2tldDEUMBIGA1UEAxMLcHl3ZWJzb2NrZXQwgZ8wDQYJKoZIhvcNAQEBBQAD -gY0AMIGJAoGBAKoSEW2biQxVrMMKdn/8PJzDYiSXDPR9WQbLRRQ1Gm5jkCYiahXW -u2CbTThfPPfi2NHA3I+HlT7gO9yR7RVUvN6ISUzGwXDEq4f4UNqtQOhQaqqK+CZ9 -LO/BhO/YYfNrbSPlYzHUKaT9ese7xO9VzVKLW+qUf2Mjh4/+SzxBDNP7AgMBAAGj -gaswgagwHQYDVR0OBBYEFOsWdxCSuyhwaZeab6BoTho3++bzMHkGA1UdIwRyMHCA -FOsWdxCSuyhwaZeab6BoTho3++bzoU2kSzBJMQswCQYDVQQGEwJKUDEOMAwGA1UE -CBMFVG9reW8xFDASBgNVBAoTC3B5d2Vic29ja2V0MRQwEgYDVQQDEwtweXdlYnNv -Y2tldIIJAKqVghkGF1rSMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEA -gsMI1WEYqNw/jhUIdrTBcCxJ0X6hJvA9ziKANVm1Rs+4P3YDArkQ8bCr6xY+Kw7s -Zp0yE7dM8GMdi+DU6hL3t3E5eMkTS1yZr9WCK4f2RLo+et98selZydpHemF3DJJ3 -gAj8Sx4LBaG8Cb/WnEMPv3MxG3fBE5favF6V4jU07hQ= ------END CERTIFICATE----- diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/cert/cert.pem b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/cert/cert.pem deleted file mode 100644 index 25379a72b0..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/cert/cert.pem +++ /dev/null @@ -1,61 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 1 (0x1) - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=JP, ST=Tokyo, O=pywebsocket, CN=pywebsocket - Validity - Not Before: Jun 6 07:25:08 2012 GMT - Not After : Oct 23 07:25:08 2039 GMT - Subject: C=JP, ST=Tokyo, O=pywebsocket, CN=pywebsocket - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (1024 bit) - Modulus (1024 bit): - 00:de:10:ce:3a:5a:04:a4:1c:29:93:5c:23:82:1a: - f2:06:01:e6:2b:a4:0f:dd:77:49:76:89:03:a2:21: - de:04:75:c6:e2:dd:fb:35:27:3a:a2:92:8e:12:62: - 2b:3e:1f:f4:78:df:b6:94:cb:27:d6:cb:d6:37:d7: - 5c:08:f0:09:3e:c9:ce:24:2d:00:c9:df:4a:e0:99: - e5:fb:23:a9:e2:d6:c9:3d:96:fa:01:88:de:5a:89: - b0:cf:03:67:6f:04:86:1d:ef:62:1c:55:a9:07:9a: - 2e:66:2a:73:5b:4c:62:03:f9:82:83:db:68:bf:b8: - 4b:0b:8b:93:11:b8:54:73:7b - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Cert Type: - SSL Server - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 82:A1:73:8B:16:0C:7C:E4:D3:46:95:13:95:1A:32:C1:84:E9:06:00 - X509v3 Authority Key Identifier: - keyid:EB:16:77:10:92:BB:28:70:69:97:9A:6F:A0:68:4E:1A:37:FB:E6:F3 - - Signature Algorithm: sha1WithRSAEncryption - 6b:b3:46:29:02:df:b0:c8:8e:c4:d7:7f:a0:1e:0d:1a:eb:2f: - df:d1:48:57:36:5f:95:8c:1b:f0:51:d6:52:e7:8d:84:3b:9f: - d8:ed:22:9c:aa:bd:ee:9b:90:1d:84:a3:4c:0b:cb:eb:64:73: - ba:f7:15:ce:da:5f:db:8b:15:07:a6:28:7f:b9:8c:11:9b:64: - d3:f1:be:52:4f:c3:d8:58:fe:de:56:63:63:3b:51:ed:a7:81: - f9:05:51:70:63:32:09:0e:94:7e:05:fe:a1:56:18:34:98:d5: - 99:1e:4e:27:38:89:90:6a:e5:ce:60:35:01:f5:de:34:60:b1: - cb:ae ------BEGIN CERTIFICATE----- -MIICmDCCAgGgAwIBAgIBATANBgkqhkiG9w0BAQUFADBJMQswCQYDVQQGEwJKUDEO -MAwGA1UECBMFVG9reW8xFDASBgNVBAoTC3B5d2Vic29ja2V0MRQwEgYDVQQDEwtw -eXdlYnNvY2tldDAeFw0xMjA2MDYwNzI1MDhaFw0zOTEwMjMwNzI1MDhaMEkxCzAJ -BgNVBAYTAkpQMQ4wDAYDVQQIEwVUb2t5bzEUMBIGA1UEChMLcHl3ZWJzb2NrZXQx -FDASBgNVBAMTC3B5d2Vic29ja2V0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB -gQDeEM46WgSkHCmTXCOCGvIGAeYrpA/dd0l2iQOiId4Edcbi3fs1Jzqiko4SYis+ -H/R437aUyyfWy9Y311wI8Ak+yc4kLQDJ30rgmeX7I6ni1sk9lvoBiN5aibDPA2dv -BIYd72IcVakHmi5mKnNbTGID+YKD22i/uEsLi5MRuFRzewIDAQABo4GPMIGMMAkG -A1UdEwQCMAAwEQYJYIZIAYb4QgEBBAQDAgZAMCwGCWCGSAGG+EIBDQQfFh1PcGVu -U1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUgqFzixYMfOTTRpUT -lRoywYTpBgAwHwYDVR0jBBgwFoAU6xZ3EJK7KHBpl5pvoGhOGjf75vMwDQYJKoZI -hvcNAQEFBQADgYEAa7NGKQLfsMiOxNd/oB4NGusv39FIVzZflYwb8FHWUueNhDuf -2O0inKq97puQHYSjTAvL62RzuvcVztpf24sVB6Yof7mMEZtk0/G+Uk/D2Fj+3lZj -YztR7aeB+QVRcGMyCQ6UfgX+oVYYNJjVmR5OJziJkGrlzmA1AfXeNGCxy64= ------END CERTIFICATE----- diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/cert/key.pem b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/cert/key.pem deleted file mode 100644 index fae858318f..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/cert/key.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDeEM46WgSkHCmTXCOCGvIGAeYrpA/dd0l2iQOiId4Edcbi3fs1 -Jzqiko4SYis+H/R437aUyyfWy9Y311wI8Ak+yc4kLQDJ30rgmeX7I6ni1sk9lvoB -iN5aibDPA2dvBIYd72IcVakHmi5mKnNbTGID+YKD22i/uEsLi5MRuFRzewIDAQAB -AoGBAIuCuV1Vcnb7rm8CwtgZP5XgmY8vSjxTldafa6XvawEYUTP0S77v/1llg1Yv -UIV+I+PQgG9oVoYOl22LoimHS/Z3e1fsot5tDYszGe8/Gkst4oaReSoxvBUa6WXp -QSo7YFCajuHtE+W/gzF+UHbdzzXIDjQZ314LNF5t+4UnsEPBAkEA+girImqWoM2t -3UR8f8oekERwsmEMf9DH5YpH4cvUnvI+kwesC/r2U8Sho++fyEMUNm7aIXGqNLga -ogAM+4NX4QJBAONdSxSay22egTGNoIhLndljWkuOt/9FWj2klf/4QxD4blMJQ5Oq -QdOGAh7nVQjpPLQ5D7CBVAKpGM2CD+QJBtsCQEP2kz35pxPylG3urcC2mfQxBkkW -ZCViBNP58GwJ0bOauTOSBEwFXWuLqTw8aDwxL49UNmqc0N0fpe2fAehj3UECQQCm -FH/DjU8Lw7ybddjNtm6XXPuYNagxz3cbkB4B3FchDleIUDwMoVF0MW9bI5/54mV1 -QDk1tUKortxvQZJaAD4BAkEAhGOHQqPd6bBBoFBvpaLzPJMxwLKrB+Wtkq/QlC72 -ClRiMn2g8SALiIL3BDgGXKcKE/Wy7jo/af/JCzQ/cPqt/A== ------END RSA PRIVATE KEY----- diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/client_for_testing.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/client_for_testing.py index a45e8f5cf2..6275676371 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/client_for_testing.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/client_for_testing.py @@ -33,8 +33,8 @@ This module contains helper methods for performing handshake, frame sending/receiving as a WebSocket client. -This is code for testing mod_pywebsocket. Keep this code independent from -mod_pywebsocket. Don't import e.g. Stream class for generating frame for +This is code for testing pywebsocket3. Keep this code independent from +pywebsocket3. Don't import e.g. Stream class for generating frame for testing. Using util.hexify, etc. that are not related to protocol processing is allowed. @@ -43,22 +43,20 @@ This code is far from robust, e.g., we cut corners in handshake. """ from __future__ import absolute_import + import base64 import errno -import logging import os -import random import re import socket import struct import time from hashlib import sha1 -from six import iterbytes -from six import indexbytes -from mod_pywebsocket import common -from mod_pywebsocket import util -from mod_pywebsocket.handshake import HandshakeException +from six import indexbytes, iterbytes + +from pywebsocket3 import common, util +from pywebsocket3.handshake import HandshakeException DEFAULT_PORT = 80 DEFAULT_SECURE_PORT = 443 @@ -702,15 +700,15 @@ class Client(object): try: read_data = receive_bytes(self._socket, 1) except Exception as e: - if str(e).find( - 'Connection closed before receiving requested length ' - ) == 0: + if str(e).find('Connection closed before receiving requested length ') == 0: return + try: - error_number, message = e for error_name in ['ECONNRESET', 'WSAECONNRESET']: - if (error_name in dir(errno) - and error_number == getattr(errno, error_name)): + if ( + error_name in dir(errno) and + e.errno == getattr(errno, error_name) + ): return except: raise e diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/mock.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/mock.py index eeaef52ecf..c460d9b7f0 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/mock.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/mock.py @@ -30,17 +30,14 @@ """ from __future__ import absolute_import -import six.moves.queue -import threading -import struct -import six -from mod_pywebsocket import common -from mod_pywebsocket import util -from mod_pywebsocket.stream import Stream -from mod_pywebsocket.stream import StreamOptions +import six +import six.moves.queue from six.moves import range +from pywebsocket3 import common, util +from pywebsocket3.stream import Stream, StreamOptions + class _MockConnBase(object): """Base class of mocks for mod_python.apache.mp_conn. diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/run_all.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/run_all.py index ea52223cea..569bdb4c07 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/run_all.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/run_all.py @@ -31,7 +31,7 @@ """Run all tests in the same directory. This suite is expected to be run under pywebsocket's src directory, i.e. the -directory containing mod_pywebsocket, test, etc. +directory containing pywebsocket3, test, etc. To change loggin level, please specify --log-level option. python test/run_test.py --log-level debug @@ -42,14 +42,16 @@ example, run this for making the test runner verbose. """ from __future__ import absolute_import -import logging + import argparse +import logging import os import re -import six import sys import unittest +import six + _TEST_MODULE_PATTERN = re.compile(r'^(test_.+)\.py$') diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/set_sys_path.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/set_sys_path.py index 48d0e116a5..c35cb6f972 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/set_sys_path.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/set_sys_path.py @@ -28,14 +28,15 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Configuration for testing. -Test files should import this module before mod_pywebsocket. +Test files should import this module before pywebsocket3. """ from __future__ import absolute_import + import os import sys -# Add the parent directory to sys.path to enable importing mod_pywebsocket. +# Add the parent directory to sys.path to enable importing pywebsocket3. sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # vi:sts=4 sw=4 et diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_dispatch.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_dispatch.py index 132dd92d76..18a39d1af9 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_dispatch.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_dispatch.py @@ -31,15 +31,16 @@ """Tests for dispatch module.""" from __future__ import absolute_import + import os import unittest -import set_sys_path # Update sys.path to locate mod_pywebsocket module. +from six.moves import zip -from mod_pywebsocket import dispatch -from mod_pywebsocket import handshake +import set_sys_path # Update sys.path to locate pywebsocket3 module. +from pywebsocket3 import dispatch, handshake from test import mock -from six.moves import zip + _TEST_HANDLERS_DIR = os.path.join(os.path.dirname(__file__), 'testdata', 'handlers') diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_endtoend.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_endtoend.py index 2789e4a57e..9718c6a2b2 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_endtoend.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_endtoend.py @@ -28,23 +28,23 @@ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -"""End-to-end tests for pywebsocket. Tests standalone.py. +"""End-to-end tests for pywebsocket3. Tests standalone.py. """ from __future__ import absolute_import -from six.moves import urllib + import locale import logging import os -import signal import socket import subprocess import sys import time import unittest -import set_sys_path # Update sys.path to locate mod_pywebsocket module. +from six.moves import urllib +import set_sys_path # Update sys.path to locate pywebsocket3 module. from test import client_for_testing # Special message that tells the echo server to start closing handshake @@ -137,7 +137,7 @@ class EndToEndTestBase(unittest.TestCase): self.server_stderr = None self.top_dir = os.path.join(os.path.dirname(__file__), '..') os.putenv('PYTHONPATH', os.path.pathsep.join(sys.path)) - self.standalone_command = os.path.join(self.top_dir, 'mod_pywebsocket', + self.standalone_command = os.path.join(self.top_dir, 'pywebsocket3', 'standalone.py') self.document_root = os.path.join(self.top_dir, 'example') s = socket.socket() diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_extensions.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_extensions.py index 39a111888b..008df24827 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_extensions.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_extensions.py @@ -31,13 +31,12 @@ """Tests for extensions module.""" from __future__ import absolute_import + import unittest import zlib -import set_sys_path # Update sys.path to locate mod_pywebsocket module. - -from mod_pywebsocket import common -from mod_pywebsocket import extensions +import set_sys_path # Update sys.path to locate pywebsocket3 module. +from pywebsocket3 import common, extensions class ExtensionsTest(unittest.TestCase): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_handshake.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_handshake.py index 7f4acf56ff..c8e25ab099 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_handshake.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_handshake.py @@ -31,16 +31,17 @@ """Tests for handshake.base module.""" from __future__ import absolute_import -import unittest -import set_sys_path # Update sys.path to locate mod_pywebsocket module. +import unittest -from mod_pywebsocket.common import ExtensionParameter -from mod_pywebsocket.common import ExtensionParsingException -from mod_pywebsocket.common import format_extensions -from mod_pywebsocket.common import parse_extensions -from mod_pywebsocket.handshake.base import HandshakeException -from mod_pywebsocket.handshake.base import validate_subprotocol +import set_sys_path # Update sys.path to locate pywebsocket3 module. +from pywebsocket3.common import ( + ExtensionParameter, + ExtensionParsingException, + format_extensions, + parse_extensions, +) +from pywebsocket3.handshake.base import HandshakeException, validate_subprotocol class ValidateSubprotocolTest(unittest.TestCase): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_handshake_hybi.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_handshake_hybi.py index 8c65822170..ee63ed45b4 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_handshake_hybi.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_handshake_hybi.py @@ -31,15 +31,17 @@ """Tests for handshake module.""" from __future__ import absolute_import -import unittest -import set_sys_path # Update sys.path to locate mod_pywebsocket module. -from mod_pywebsocket import common -from mod_pywebsocket.handshake.base import AbortedByUserException -from mod_pywebsocket.handshake.base import HandshakeException -from mod_pywebsocket.handshake.base import VersionException -from mod_pywebsocket.handshake.hybi import Handshaker +import unittest +import set_sys_path # Update sys.path to locate pywebsocket3 module. +from pywebsocket3 import common +from pywebsocket3.handshake.base import ( + AbortedByUserException, + HandshakeException, + VersionException, +) +from pywebsocket3.handshake.hybi import Handshaker from test import mock diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_http_header_util.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_http_header_util.py index f8c8e7a981..bd9b9bfc2e 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_http_header_util.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_http_header_util.py @@ -31,10 +31,11 @@ """Tests for http_header_util module.""" from __future__ import absolute_import + import unittest import sys -from mod_pywebsocket import http_header_util +from pywebsocket3 import http_header_util class UnitTest(unittest.TestCase): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_memorizingfile.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_memorizingfile.py index f7288c510b..4749085962 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_memorizingfile.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_memorizingfile.py @@ -31,12 +31,13 @@ """Tests for memorizingfile module.""" from __future__ import absolute_import + import unittest -import six -import set_sys_path # Update sys.path to locate mod_pywebsocket module. +import six -from mod_pywebsocket import memorizingfile +import set_sys_path # Update sys.path to locate pywebsocket3 module. +from pywebsocket3 import memorizingfile class UtilTest(unittest.TestCase): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_mock.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_mock.py index 073873dde9..df5353bc59 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_mock.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_mock.py @@ -31,12 +31,13 @@ """Tests for mock module.""" from __future__ import absolute_import -import six.moves.queue + import threading import unittest -import set_sys_path # Update sys.path to locate mod_pywebsocket module. +import six.moves.queue +import set_sys_path # Update sys.path to locate pywebsocket3 module. from test import mock diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_msgutil.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_msgutil.py index 1122c281b7..99aa200ba4 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_msgutil.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_msgutil.py @@ -33,26 +33,26 @@ from __future__ import absolute_import from __future__ import print_function from __future__ import division -import array -import six.moves.queue + import random import struct import unittest import zlib -import set_sys_path # Update sys.path to locate mod_pywebsocket module. - -from mod_pywebsocket import common -from mod_pywebsocket.extensions import PerMessageDeflateExtensionProcessor -from mod_pywebsocket import msgutil -from mod_pywebsocket.stream import InvalidUTF8Exception -from mod_pywebsocket.stream import Stream -from mod_pywebsocket.stream import StreamOptions -from mod_pywebsocket import util -from test import mock +from six import iterbytes from six.moves import map from six.moves import range -from six import iterbytes +import six.moves.queue + +import set_sys_path # Update sys.path to locate pywebsocket3 module. +from pywebsocket3 import common, msgutil, util +from pywebsocket3.extensions import PerMessageDeflateExtensionProcessor +from pywebsocket3.stream import ( + InvalidUTF8Exception, + Stream, + StreamOptions, +) +from test import mock # We use one fixed nonce for testing instead of cryptographically secure PRNG. _MASKING_NONCE = b'ABCD' diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_stream.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_stream.py index 153899d205..c165e84688 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_stream.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_stream.py @@ -31,12 +31,11 @@ """Tests for stream module.""" from __future__ import absolute_import -import unittest -import set_sys_path # Update sys.path to locate mod_pywebsocket module. +import unittest -from mod_pywebsocket import common -from mod_pywebsocket import stream +import set_sys_path # Update sys.path to locate pywebsocket3 module. +from pywebsocket3 import common, stream class StreamTest(unittest.TestCase): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_util.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_util.py index bf4bd32bba..24c4b5bfbd 100755 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_util.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/test_util.py @@ -32,18 +32,16 @@ from __future__ import absolute_import from __future__ import print_function + import os import random -import sys import unittest -import struct - -import set_sys_path # Update sys.path to locate mod_pywebsocket module. -from mod_pywebsocket import util +from six import int2byte, PY3 from six.moves import range -from six import PY3 -from six import int2byte + +import set_sys_path # Update sys.path to locate pywebsocket3 module. +from pywebsocket3 import util _TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), 'testdata') diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/testdata/README b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/testdata/README deleted file mode 100644 index c001aa5595..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/testdata/README +++ /dev/null @@ -1 +0,0 @@ -Test data directory diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/testdata/handlers/abort_by_user_wsh.py b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/testdata/handlers/abort_by_user_wsh.py index 63cb541bb7..a6e0831847 100644 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/testdata/handlers/abort_by_user_wsh.py +++ b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/testdata/handlers/abort_by_user_wsh.py @@ -27,7 +27,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from mod_pywebsocket import handshake +from pywebsocket3 import handshake def web_socket_do_extra_handshake(request): diff --git a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/testdata/hello.pl b/testing/web-platform/tests/tools/third_party/pywebsocket3/test/testdata/hello.pl deleted file mode 100644 index 882ef5a100..0000000000 --- a/testing/web-platform/tests/tools/third_party/pywebsocket3/test/testdata/hello.pl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/perl -wT -# -# Copyright 2012, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -print "Hello\n"; |