OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "ppapi/c/dev/ppb_websocket_dev.h" | 9 #include "ppapi/c/dev/ppb_websocket_dev.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
11 #include "ppapi/c/pp_var.h" | 11 #include "ppapi/c/pp_var.h" |
12 #include "ppapi/c/pp_completion_callback.h" | 12 #include "ppapi/c/pp_completion_callback.h" |
13 #include "ppapi/c/ppb_core.h" | 13 #include "ppapi/c/ppb_core.h" |
14 #include "ppapi/c/ppb_var.h" | 14 #include "ppapi/c/ppb_var.h" |
15 #include "ppapi/cpp/instance.h" | 15 #include "ppapi/cpp/instance.h" |
16 #include "ppapi/cpp/module.h" | 16 #include "ppapi/cpp/module.h" |
17 #include "ppapi/tests/test_utils.h" | 17 #include "ppapi/tests/test_utils.h" |
18 #include "ppapi/tests/testing_instance.h" | 18 #include "ppapi/tests/testing_instance.h" |
19 | 19 |
20 static const char kEchoServerURL[] = | 20 static const char kEchoServerURL[] = |
21 "ws://localhost:8880/websocket/tests/hybi/echo"; | 21 "ws://localhost:8880/websocket/tests/hybi/echo"; |
22 | 22 |
23 static const char kProtocolTestServerURL[] = | 23 static const char kProtocolTestServerURL[] = |
24 "ws://localhost:8880/websocket/tests/hybi/protocol-test?protocol="; | 24 "ws://localhost:8880/websocket/tests/hybi/protocol-test?protocol="; |
25 | 25 |
26 static const char* kInvalidURLs[] = { | 26 static const char* kInvalidURLs[] = { |
27 "http://www.google.com/invalid_scheme", | 27 "http://www.google.com/invalid_scheme", |
28 "ws://www.google.com/invalid#fragment", | 28 "ws://www.google.com/invalid#fragment", |
29 // TODO(toyoshim): Add URL which has invalid port like | 29 "ws://www.google.com:65535/invalid_port", |
30 // ws://www.google.com:65535/invalid_port | |
31 NULL | 30 NULL |
32 }; | 31 }; |
33 | 32 |
34 REGISTER_TEST_CASE(WebSocket); | 33 REGISTER_TEST_CASE(WebSocket); |
35 | 34 |
36 bool TestWebSocket::Init() { | 35 bool TestWebSocket::Init() { |
37 websocket_interface_ = static_cast<const PPB_WebSocket_Dev*>( | 36 websocket_interface_ = static_cast<const PPB_WebSocket_Dev*>( |
38 pp::Module::Get()->GetBrowserInterface(PPB_WEBSOCKET_DEV_INTERFACE)); | 37 pp::Module::Get()->GetBrowserInterface(PPB_WEBSOCKET_DEV_INTERFACE)); |
39 var_interface_ = static_cast<const PPB_Var*>( | 38 var_interface_ = static_cast<const PPB_Var*>( |
40 pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE)); | 39 pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE)); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 core_interface_->ReleaseResource(ws); | 230 core_interface_->ReleaseResource(ws); |
232 | 231 |
233 PASS(); | 232 PASS(); |
234 } | 233 } |
235 | 234 |
236 // TODO(toyoshim): Add tests for GetBufferedAmount(). | 235 // TODO(toyoshim): Add tests for GetBufferedAmount(). |
237 // For now, the function doesn't work fine because update callback in WebKit is | 236 // For now, the function doesn't work fine because update callback in WebKit is |
238 // not landed yet. | 237 // not landed yet. |
239 | 238 |
240 // TODO(toyoshim): Add other function tests. | 239 // TODO(toyoshim): Add other function tests. |
OLD | NEW |