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" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 ASSERT_TRUE(ws); | 130 ASSERT_TRUE(ws); |
131 | 131 |
132 uint64_t bufferedAmount = websocket_interface_->GetBufferedAmount(ws); | 132 uint64_t bufferedAmount = websocket_interface_->GetBufferedAmount(ws); |
133 ASSERT_EQ(0, bufferedAmount); | 133 ASSERT_EQ(0, bufferedAmount); |
134 | 134 |
135 uint16_t close_code = websocket_interface_->GetCloseCode(ws); | 135 uint16_t close_code = websocket_interface_->GetCloseCode(ws); |
136 ASSERT_EQ(0, close_code); | 136 ASSERT_EQ(0, close_code); |
137 | 137 |
138 PP_Var close_reason = websocket_interface_->GetCloseReason(ws); | 138 PP_Var close_reason = websocket_interface_->GetCloseReason(ws); |
139 ASSERT_TRUE(AreEqual(close_reason, "")); | 139 ASSERT_TRUE(AreEqual(close_reason, "")); |
140 ReleaseVar(close_reason); | |
140 | 141 |
141 PP_Bool close_was_clean = websocket_interface_->GetCloseWasClean(ws); | 142 PP_Bool close_was_clean = websocket_interface_->GetCloseWasClean(ws); |
142 ASSERT_EQ(PP_FALSE, close_was_clean); | 143 ASSERT_EQ(PP_FALSE, close_was_clean); |
143 | 144 |
144 PP_Var extensions = websocket_interface_->GetExtensions(ws); | 145 PP_Var extensions = websocket_interface_->GetExtensions(ws); |
145 ASSERT_TRUE(AreEqual(extensions, "")); | 146 ASSERT_TRUE(AreEqual(extensions, "")); |
147 ReleaseVar(extensions); | |
146 | 148 |
147 PP_Var protocol = websocket_interface_->GetProtocol(ws); | 149 PP_Var protocol = websocket_interface_->GetProtocol(ws); |
148 ASSERT_TRUE(AreEqual(protocol, "")); | 150 ASSERT_TRUE(AreEqual(protocol, "")); |
151 ReleaseVar(protocol); | |
149 | 152 |
150 PP_WebSocketReadyState_Dev ready_state = | 153 PP_WebSocketReadyState_Dev ready_state = |
151 websocket_interface_->GetReadyState(ws); | 154 websocket_interface_->GetReadyState(ws); |
152 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID_DEV, ready_state); | 155 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID_DEV, ready_state); |
153 | 156 |
154 PP_Var url = websocket_interface_->GetURL(ws); | 157 PP_Var url = websocket_interface_->GetURL(ws); |
155 ASSERT_TRUE(AreEqual(url, "")); | 158 ASSERT_TRUE(AreEqual(url, "")); |
159 ReleaseVar(url); | |
dmichael (off chromium)
2011/12/09 21:26:05
I agree the ReleaseVar should be here. Are you sur
Takashi Toyoshima
2011/12/10 01:25:52
OK, anyway it could be useful to add ref-count che
| |
156 | 160 |
157 PASS(); | 161 PASS(); |
158 } | 162 } |
159 | 163 |
160 std::string TestWebSocket::TestInvalidConnect() { | 164 std::string TestWebSocket::TestInvalidConnect() { |
161 PP_Var protocols[] = { PP_MakeUndefined() }; | 165 PP_Var protocols[] = { PP_MakeUndefined() }; |
162 | 166 |
163 PP_Resource ws = websocket_interface_->Create(instance_->pp_instance()); | 167 PP_Resource ws = websocket_interface_->Create(instance_->pp_instance()); |
164 ASSERT_TRUE(ws); | 168 ASSERT_TRUE(ws); |
165 | 169 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
372 PASS(); | 376 PASS(); |
373 } | 377 } |
374 | 378 |
375 // TODO(toyoshim): Add tests for GetBufferedAmount(). | 379 // TODO(toyoshim): Add tests for GetBufferedAmount(). |
376 // For now, the function doesn't work fine because update callback in WebKit is | 380 // For now, the function doesn't work fine because update callback in WebKit is |
377 // not landed yet. | 381 // not landed yet. |
378 | 382 |
379 // TODO(toyoshim): Add tests for didReceiveMessageError(). | 383 // TODO(toyoshim): Add tests for didReceiveMessageError(). |
380 | 384 |
381 // TODO(toyoshim): Add other function tests. | 385 // TODO(toyoshim): Add other function tests. |
OLD | NEW |