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

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

Issue 17314012: Move PPB_TCPSocket out of dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « ppapi/tests/test_tcp_socket.cc ('k') | ppapi/thunk/interfaces_ppb_public_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dev/tcp_socket_dev.h"
10 #include "ppapi/cpp/dev/udp_socket_dev.h" 9 #include "ppapi/cpp/dev/udp_socket_dev.h"
11 #include "ppapi/cpp/pass_ref.h" 10 #include "ppapi/cpp/pass_ref.h"
11 #include "ppapi/cpp/tcp_socket.h"
12 #include "ppapi/cpp/var.h" 12 #include "ppapi/cpp/var.h"
13 #include "ppapi/tests/test_utils.h" 13 #include "ppapi/tests/test_utils.h"
14 #include "ppapi/tests/testing_instance.h" 14 #include "ppapi/tests/testing_instance.h"
15 15
16 REGISTER_TEST_CASE(UDPSocket); 16 REGISTER_TEST_CASE(UDPSocket);
17 17
18 namespace { 18 namespace {
19 19
20 const uint16_t kPortScanFrom = 1024; 20 const uint16_t kPortScanFrom = 1024;
21 const uint16_t kPortScanTo = 4096; 21 const uint16_t kPortScanTo = 4096;
(...skipping 22 matching lines...) Expand all
44 } 44 }
45 return pp::NetAddress(); 45 return pp::NetAddress();
46 } 46 }
47 47
48 } // namespace 48 } // namespace
49 49
50 TestUDPSocket::TestUDPSocket(TestingInstance* instance) : TestCase(instance) { 50 TestUDPSocket::TestUDPSocket(TestingInstance* instance) : TestCase(instance) {
51 } 51 }
52 52
53 bool TestUDPSocket::Init() { 53 bool TestUDPSocket::Init() {
54 bool tcp_socket_is_available = pp::TCPSocket_Dev::IsAvailable(); 54 bool tcp_socket_is_available = pp::TCPSocket::IsAvailable();
55 if (!tcp_socket_is_available) 55 if (!tcp_socket_is_available)
56 instance_->AppendError("PPB_TCPSocket interface not available"); 56 instance_->AppendError("PPB_TCPSocket interface not available");
57 57
58 bool udp_socket_is_available = pp::UDPSocket_Dev::IsAvailable(); 58 bool udp_socket_is_available = pp::UDPSocket_Dev::IsAvailable();
59 if (!udp_socket_is_available) 59 if (!udp_socket_is_available)
60 instance_->AppendError("PPB_UDPSocket interface not available"); 60 instance_->AppendError("PPB_UDPSocket interface not available");
61 61
62 bool net_address_is_available = pp::NetAddress::IsAvailable(); 62 bool net_address_is_available = pp::NetAddress::IsAvailable();
63 if (!net_address_is_available) 63 if (!net_address_is_available)
64 instance_->AppendError("PPB_NetAddress interface not available"); 64 instance_->AppendError("PPB_NetAddress interface not available");
(...skipping 14 matching lines...) Expand all
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_Dev socket(instance_); 89 pp::TCPSocket socket(instance_);
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
« no previous file with comments | « ppapi/tests/test_tcp_socket.cc ('k') | ppapi/thunk/interfaces_ppb_public_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698