| 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_tcp_socket_private.h" | 5 #include "ppapi/tests/test_tcp_socket_private.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "ppapi/c/dev/ppb_url_util_dev.h" | 10 #include "ppapi/c/dev/ppb_url_util_dev.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 int i = atoi(url.substr(components.port.begin, | 73 int i = atoi(url.substr(components.port.begin, |
| 74 components.port.len).c_str()); | 74 components.port.len).c_str()); |
| 75 if (i < 0 || i > 65535) | 75 if (i < 0 || i > 65535) |
| 76 return false; | 76 return false; |
| 77 port_ = static_cast<uint16_t>(i); | 77 port_ = static_cast<uint16_t>(i); |
| 78 } | 78 } |
| 79 | 79 |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void TestTCPSocketPrivate::RunTest() { | 83 void TestTCPSocketPrivate::RunTests(const std::string& filter) { |
| 84 RUN_TEST_FORCEASYNC_AND_NOT(Basic); | 84 RUN_TEST_FORCEASYNC_AND_NOT(Basic, filter); |
| 85 RUN_TEST_FORCEASYNC_AND_NOT(ReadWrite); | 85 RUN_TEST_FORCEASYNC_AND_NOT(ReadWrite, filter); |
| 86 RUN_TEST_FORCEASYNC_AND_NOT(ConnectAddress); | 86 RUN_TEST_FORCEASYNC_AND_NOT(ConnectAddress, filter); |
| 87 } | 87 } |
| 88 | 88 |
| 89 std::string TestTCPSocketPrivate::TestBasic() { | 89 std::string TestTCPSocketPrivate::TestBasic() { |
| 90 TCPSocketPrivate socket(instance_); | 90 TCPSocketPrivate socket(instance_); |
| 91 TestCompletionCallback cb(instance_->pp_instance(), force_async_); | 91 TestCompletionCallback cb(instance_->pp_instance(), force_async_); |
| 92 | 92 |
| 93 int32_t rv = socket.Connect(host_.c_str(), port_, cb); | 93 int32_t rv = socket.Connect(host_.c_str(), port_, cb); |
| 94 ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING); | 94 ASSERT_TRUE(!force_async_ || rv == PP_OK_COMPLETIONPENDING); |
| 95 if (rv == PP_OK_COMPLETIONPENDING) | 95 if (rv == PP_OK_COMPLETIONPENDING) |
| 96 rv = cb.WaitForResult(); | 96 rv = cb.WaitForResult(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 if (rv < 0) | 208 if (rv < 0) |
| 209 return rv; | 209 return rv; |
| 210 if (rv == 0) | 210 if (rv == 0) |
| 211 return PP_ERROR_FAILED; | 211 return PP_ERROR_FAILED; |
| 212 written += rv; | 212 written += rv; |
| 213 } | 213 } |
| 214 if (written != s.size()) | 214 if (written != s.size()) |
| 215 return PP_ERROR_FAILED; | 215 return PP_ERROR_FAILED; |
| 216 return PP_OK; | 216 return PP_OK; |
| 217 } | 217 } |
| OLD | NEW |