Chromium Code Reviews| Index: net/data/websocket/echo_wsh.py |
| diff --git a/third_party/protobuf/src/google/protobuf/io/gzip_stream_unittest.sh b/net/data/websocket/echo_wsh.py |
| old mode 100755 |
| new mode 100644 |
| similarity index 72% |
| copy from third_party/protobuf/src/google/protobuf/io/gzip_stream_unittest.sh |
| copy to net/data/websocket/echo_wsh.py |
| index 6e8a09437d096c0ea9b0d62ba4833450eddf9cda..24c25178c13932efaed74ff90eb1140fb4d1f1f5 |
| --- a/third_party/protobuf/src/google/protobuf/io/gzip_stream_unittest.sh |
| +++ b/net/data/websocket/echo_wsh.py |
| @@ -1,8 +1,4 @@ |
| -#!/bin/sh -x |
| -# |
| -# Protocol Buffers - Google's data interchange format |
| -# Copyright 2009 Google Inc. All rights reserved. |
| -# http://code.google.com/p/protobuf/ |
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| # |
| # Redistribution and use in source and binary forms, with or without |
| # modification, are permitted provided that the following conditions are |
| @@ -29,16 +25,24 @@ |
| # 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. |
| -# |
| -# Author: brianolson@google.com (Brian Olson) |
| -# |
| -# Test compatibility between command line gzip/gunzip binaries and |
| -# ZeroCopyStream versions. |
| -TESTFILE=Makefile |
| -(./zcgzip < ${TESTFILE} | gunzip | cmp - ${TESTFILE}) && \ |
| -(gzip < ${TESTFILE} | ./zcgunzip | cmp - ${TESTFILE}) |
| +_GOODBYE_MESSAGE = u'Goodbye' |
| + |
| + |
| +def web_socket_do_extra_handshake(request): |
| + pass # Always accept. |
| + |
| + |
| +def web_socket_transfer_data(request): |
| + while True: |
| + line = request.ws_stream.receive_message() |
| + if line is None: |
| + return |
| + if isinstance(line, unicode): |
| + request.ws_stream.send_message(line, binary=False) |
| + if line == _GOODBYE_MESSAGE: |
| + return |
| + else: |
| + request.ws_stream.send_message(line, binary=True) |
|
Ryan Sleevi
2012/10/09 19:39:07
nit: I'm never sure what the prevailing wind for C
Takashi Toyoshima
2012/10/10 01:34:48
Oops.
I forgot that Chromium style was different f
|
| -# Result of "(cmd) && (cmd)" implicitly becomes result of this script |
| -# and thus the test. |