Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: net/data/websocket/echo_wsh.py

Issue 11087027: WebSocket test server migration on ExtensionApiTest.WebSocket (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix copyright Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698