OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/tests/test_websocket.h" | 5 #include "ppapi/tests/test_websocket.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "ppapi/cpp/module.h" | 27 #include "ppapi/cpp/module.h" |
28 #include "ppapi/cpp/var_array_buffer.h" | 28 #include "ppapi/cpp/var_array_buffer.h" |
29 #include "ppapi/cpp/websocket.h" | 29 #include "ppapi/cpp/websocket.h" |
30 #include "ppapi/tests/test_utils.h" | 30 #include "ppapi/tests/test_utils.h" |
31 #include "ppapi/tests/testing_instance.h" | 31 #include "ppapi/tests/testing_instance.h" |
32 #include "ppapi/utility/websocket/websocket_api.h" | 32 #include "ppapi/utility/websocket/websocket_api.h" |
33 | 33 |
34 // These servers are provided by pywebsocket server side handlers in | 34 // These servers are provided by pywebsocket server side handlers in |
35 // LayoutTests/http/tests/websocket/tests/hybi/*_wsh. | 35 // LayoutTests/http/tests/websocket/tests/hybi/*_wsh. |
36 // pywebsocket server itself is launched in ppapi_ui_test.cc. | 36 // pywebsocket server itself is launched in ppapi_ui_test.cc. |
37 const char kEchoServerURL[] = "websocket/tests/hybi/echo-with-no-extension"; | 37 const char kEchoServerURL[] = "echo-with-no-extension"; |
38 | 38 |
39 const char kCloseServerURL[] = "websocket/tests/hybi/close"; | 39 const char kCloseServerURL[] = "close"; |
40 | 40 |
41 const char kCloseWithCodeAndReasonServerURL[] = | 41 const char kCloseWithCodeAndReasonServerURL[] = "close-code-and-reason"; |
42 "websocket/tests/hybi/close-code-and-reason"; | |
43 | 42 |
44 const char kProtocolTestServerURL[] = | 43 const char kProtocolTestServerURL[] = "protocol-test?protocol="; |
45 "websocket/tests/hybi/protocol-test?protocol="; | |
46 | 44 |
47 const char* const kInvalidURLs[] = { | 45 const char* const kInvalidURLs[] = { |
48 "http://www.google.com/invalid_scheme", | 46 "http://www.google.com/invalid_scheme", |
49 "ws://www.google.com/invalid#fragment", | 47 "ws://www.google.com/invalid#fragment", |
50 "ws://www.google.com:65535/invalid_port", | 48 "ws://www.google.com:65535/invalid_port", |
51 NULL | 49 NULL |
52 }; | 50 }; |
53 | 51 |
54 // Internal packet sizes. | 52 // Internal packet sizes. |
55 const uint64_t kCloseFrameSize = 6; | 53 const uint64_t kCloseFrameSize = 6; |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 size_t last_event = events_on_closed - 1; | 1474 size_t last_event = events_on_closed - 1; |
1477 for (uint32_t i = 1; i < last_event; ++i) { | 1475 for (uint32_t i = 1; i < last_event; ++i) { |
1478 ASSERT_EQ(WebSocketEvent::EVENT_MESSAGE, events[i].event_type); | 1476 ASSERT_EQ(WebSocketEvent::EVENT_MESSAGE, events[i].event_type); |
1479 ASSERT_TRUE(AreEqualWithString(events[i].var.pp_var(), message)); | 1477 ASSERT_TRUE(AreEqualWithString(events[i].var.pp_var(), message)); |
1480 } | 1478 } |
1481 ASSERT_EQ(WebSocketEvent::EVENT_CLOSE, events[last_event].event_type); | 1479 ASSERT_EQ(WebSocketEvent::EVENT_CLOSE, events[last_event].event_type); |
1482 ASSERT_TRUE(events[last_event].was_clean); | 1480 ASSERT_TRUE(events[last_event].was_clean); |
1483 | 1481 |
1484 PASS(); | 1482 PASS(); |
1485 } | 1483 } |
OLD | NEW |