| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.h" | 5 #include "ppapi/tests/test_tcp_socket.h" |
| 6 | 6 |
| 7 #include "ppapi/cpp/dev/tcp_socket_dev.h" | 7 #include "ppapi/cpp/dev/tcp_socket_dev.h" |
| 8 #include "ppapi/tests/test_utils.h" | 8 #include "ppapi/tests/test_utils.h" |
| 9 #include "ppapi/tests/testing_instance.h" | 9 #include "ppapi/tests/testing_instance.h" |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 std::string TestTCPSocket::TestConnect() { | 54 std::string TestTCPSocket::TestConnect() { |
| 55 pp::TCPSocket_Dev socket(instance_); | 55 pp::TCPSocket_Dev socket(instance_); |
| 56 TestCompletionCallback cb(instance_->pp_instance(), callback_type()); | 56 TestCompletionCallback cb(instance_->pp_instance(), callback_type()); |
| 57 | 57 |
| 58 cb.WaitForResult(socket.Connect(addr_, cb.GetCallback())); | 58 cb.WaitForResult(socket.Connect(addr_, cb.GetCallback())); |
| 59 CHECK_CALLBACK_BEHAVIOR(cb); | 59 CHECK_CALLBACK_BEHAVIOR(cb); |
| 60 ASSERT_EQ(PP_OK, cb.result()); | 60 ASSERT_EQ(PP_OK, cb.result()); |
| 61 | 61 |
| 62 pp::NetAddress_Dev local_addr, remote_addr; | 62 pp::NetAddress local_addr, remote_addr; |
| 63 local_addr = socket.GetLocalAddress(); | 63 local_addr = socket.GetLocalAddress(); |
| 64 remote_addr = socket.GetRemoteAddress(); | 64 remote_addr = socket.GetRemoteAddress(); |
| 65 | 65 |
| 66 ASSERT_NE(0, local_addr.pp_resource()); | 66 ASSERT_NE(0, local_addr.pp_resource()); |
| 67 ASSERT_NE(0, remote_addr.pp_resource()); | 67 ASSERT_NE(0, remote_addr.pp_resource()); |
| 68 ASSERT_TRUE(EqualNetAddress(addr_, remote_addr)); | 68 ASSERT_TRUE(EqualNetAddress(addr_, remote_addr)); |
| 69 | 69 |
| 70 socket.Close(); | 70 socket.Close(); |
| 71 | 71 |
| 72 PASS(); | 72 PASS(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 if (cb.result() < 0) | 182 if (cb.result() < 0) |
| 183 return cb.result(); | 183 return cb.result(); |
| 184 if (cb.result() == 0) | 184 if (cb.result() == 0) |
| 185 return PP_ERROR_FAILED; | 185 return PP_ERROR_FAILED; |
| 186 written += cb.result(); | 186 written += cb.result(); |
| 187 } | 187 } |
| 188 if (written != s.size()) | 188 if (written != s.size()) |
| 189 return PP_ERROR_FAILED; | 189 return PP_ERROR_FAILED; |
| 190 return PP_OK; | 190 return PP_OK; |
| 191 } | 191 } |
| OLD | NEW |