Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: ppapi/tests/test_udp_socket.cc

Issue 24195004: PPB_TCPSocket: add support for TCP server socket operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_udp_socket.h" 5 #include "ppapi/tests/test_udp_socket.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ppapi/cpp/pass_ref.h" 9 #include "ppapi/cpp/pass_ref.h"
10 #include "ppapi/cpp/tcp_socket.h" 10 #include "ppapi/cpp/tcp_socket.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 EnsureRunningOverHTTP(); 79 EnsureRunningOverHTTP();
80 } 80 }
81 81
82 void TestUDPSocket::RunTests(const std::string& filter) { 82 void TestUDPSocket::RunTests(const std::string& filter) {
83 RUN_CALLBACK_TEST(TestUDPSocket, ReadWrite, filter); 83 RUN_CALLBACK_TEST(TestUDPSocket, ReadWrite, filter);
84 RUN_CALLBACK_TEST(TestUDPSocket, Broadcast, filter); 84 RUN_CALLBACK_TEST(TestUDPSocket, Broadcast, filter);
85 RUN_CALLBACK_TEST(TestUDPSocket, SetOption, filter); 85 RUN_CALLBACK_TEST(TestUDPSocket, SetOption, filter);
86 } 86 }
87 87
88 std::string TestUDPSocket::GetLocalAddress(pp::NetAddress* address) { 88 std::string TestUDPSocket::GetLocalAddress(pp::NetAddress* address) {
89 pp::TCPSocket socket(instance_); 89 pp::TCPSocket socket(instance_, address_.GetFamily());
90 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); 90 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
91 callback.WaitForResult(socket.Connect(address_, callback.GetCallback())); 91 callback.WaitForResult(socket.Connect(address_, callback.GetCallback()));
92 CHECK_CALLBACK_BEHAVIOR(callback); 92 CHECK_CALLBACK_BEHAVIOR(callback);
93 ASSERT_EQ(PP_OK, callback.result()); 93 ASSERT_EQ(PP_OK, callback.result());
94 *address = socket.GetLocalAddress(); 94 *address = socket.GetLocalAddress();
95 ASSERT_NE(0, address->pp_resource()); 95 ASSERT_NE(0, address->pp_resource());
96 socket.Close(); 96 socket.Close();
97 PASS(); 97 PASS();
98 } 98 }
99 99
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 ASSERT_EQ(PP_OK, callback.result()); 309 ASSERT_EQ(PP_OK, callback.result());
310 310
311 callback.WaitForResult(socket.SetOption( 311 callback.WaitForResult(socket.SetOption(
312 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE, pp::Var(1024), 312 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE, pp::Var(1024),
313 callback.GetCallback())); 313 callback.GetCallback()));
314 CHECK_CALLBACK_BEHAVIOR(callback); 314 CHECK_CALLBACK_BEHAVIOR(callback);
315 ASSERT_EQ(PP_OK, callback.result()); 315 ASSERT_EQ(PP_OK, callback.result());
316 316
317 PASS(); 317 PASS();
318 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698