| Index: third_party/grpc/src/python/grpcio/tests/interop/_insecure_interop_test.py
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/websocket/close_wsh.py b/third_party/grpc/src/python/grpcio/tests/interop/_insecure_interop_test.py
|
| similarity index 66%
|
| copy from third_party/WebKit/LayoutTests/http/tests/websocket/close_wsh.py
|
| copy to third_party/grpc/src/python/grpcio/tests/interop/_insecure_interop_test.py
|
| index 1b02d66267e294ce83977dac64f075981705647c..00b49aba374970f65af47bc97747fea87f40d9f9 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/websocket/close_wsh.py
|
| +++ b/third_party/grpc/src/python/grpcio/tests/interop/_insecure_interop_test.py
|
| @@ -1,4 +1,4 @@
|
| -# Copyright 2011, Google Inc.
|
| +# Copyright 2015, Google Inc.
|
| # All rights reserved.
|
| #
|
| # Redistribution and use in source and binary forms, with or without
|
| @@ -27,27 +27,32 @@
|
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| +"""Insecure client-server interoperability as a unit test."""
|
|
|
| -import logging
|
| -_GOODBYE_MESSAGE = u'Goodbye'
|
| +import unittest
|
|
|
| +from grpc.beta import implementations
|
|
|
| -def web_socket_do_extra_handshake(request):
|
| - pass # Always accept.
|
| +from tests.interop import _interop_test_case
|
| +from tests.interop import methods
|
| +from tests.interop import server
|
| +from tests.interop import test_pb2
|
|
|
|
|
| -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)
|
| +class InsecureInteropTest(
|
| + _interop_test_case.InteropTestCase,
|
| + unittest.TestCase):
|
|
|
| + def setUp(self):
|
| + self.server = test_pb2.beta_create_TestService_server(methods.TestService())
|
| + port = self.server.add_insecure_port('[::]:0')
|
| + self.server.start()
|
| + self.stub = test_pb2.beta_create_TestService_stub(
|
| + implementations.insecure_channel('[::]', port))
|
|
|
| -def web_socket_passive_closing_handshake(request):
|
| - return request.ws_close_code, request.ws_close_reason
|
| + def tearDown(self):
|
| + self.server.stop(0)
|
| +
|
| +
|
| +if __name__ == '__main__':
|
| + unittest.main(verbosity=2)
|
|
|