| 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 29 matching lines...) Expand all Loading... |
| 40 const char kProtocolTestServerURL[] = "protocol-test?protocol="; | 40 const char kProtocolTestServerURL[] = "protocol-test?protocol="; |
| 41 | 41 |
| 42 const char* const kInvalidURLs[] = { | 42 const char* const kInvalidURLs[] = { |
| 43 "http://www.google.com/invalid_scheme", | 43 "http://www.google.com/invalid_scheme", |
| 44 "ws://www.google.com/invalid#fragment", | 44 "ws://www.google.com/invalid#fragment", |
| 45 "ws://www.google.com:65535/invalid_port", | 45 "ws://www.google.com:65535/invalid_port", |
| 46 NULL | 46 NULL |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // Internal packet sizes. | 49 // Internal packet sizes. |
| 50 const uint64_t kCloseFrameSize = 6; | |
| 51 const uint64_t kMessageFrameOverhead = 6; | 50 const uint64_t kMessageFrameOverhead = 6; |
| 52 | 51 |
| 53 namespace { | 52 namespace { |
| 54 | 53 |
| 55 struct WebSocketEvent { | 54 struct WebSocketEvent { |
| 56 enum EventType { | 55 enum EventType { |
| 57 EVENT_OPEN, | 56 EVENT_OPEN, |
| 58 EVENT_MESSAGE, | 57 EVENT_MESSAGE, |
| 59 EVENT_ERROR, | 58 EVENT_ERROR, |
| 60 EVENT_CLOSE | 59 EVENT_CLOSE |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 size_t last_event = events_on_closed - 1; | 1576 size_t last_event = events_on_closed - 1; |
| 1578 for (uint32_t i = 1; i < last_event; ++i) { | 1577 for (uint32_t i = 1; i < last_event; ++i) { |
| 1579 ASSERT_EQ(WebSocketEvent::EVENT_MESSAGE, events[i].event_type); | 1578 ASSERT_EQ(WebSocketEvent::EVENT_MESSAGE, events[i].event_type); |
| 1580 ASSERT_TRUE(AreEqualWithString(events[i].var.pp_var(), message)); | 1579 ASSERT_TRUE(AreEqualWithString(events[i].var.pp_var(), message)); |
| 1581 } | 1580 } |
| 1582 ASSERT_EQ(WebSocketEvent::EVENT_CLOSE, events[last_event].event_type); | 1581 ASSERT_EQ(WebSocketEvent::EVENT_CLOSE, events[last_event].event_type); |
| 1583 ASSERT_TRUE(events[last_event].was_clean); | 1582 ASSERT_TRUE(events[last_event].was_clean); |
| 1584 | 1583 |
| 1585 PASS(); | 1584 PASS(); |
| 1586 } | 1585 } |
| OLD | NEW |