1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ppapi/tests/test_tcp_socket_private_disallowed.h"
7 #include "ppapi/cpp/module.h"
8 #include "ppapi/tests/test_utils.h"
9 #include "ppapi/tests/testing_instance.h"
13 const char kServerName
[] = "www.google.com";
18 REGISTER_TEST_CASE(TCPSocketPrivateDisallowed
);
20 TestTCPSocketPrivateDisallowed::TestTCPSocketPrivateDisallowed(
21 TestingInstance
* instance
)
22 : TestCase(instance
), tcp_socket_private_interface_(NULL
) {
25 bool TestTCPSocketPrivateDisallowed::Init() {
26 tcp_socket_private_interface_
= static_cast<const PPB_TCPSocket_Private
*>(
27 pp::Module::Get()->GetBrowserInterface(PPB_TCPSOCKET_PRIVATE_INTERFACE
));
28 if (!tcp_socket_private_interface_
)
29 instance_
->AppendError("TCPSocketPrivate interface not available");
30 return tcp_socket_private_interface_
&& CheckTestingInterface();
33 void TestTCPSocketPrivateDisallowed::RunTests(const std::string
& filter
) {
34 RUN_TEST(Connect
, filter
);
37 std::string
TestTCPSocketPrivateDisallowed::TestConnect() {
39 tcp_socket_private_interface_
->Create(instance_
->pp_instance());
41 TestCompletionCallback
callback(instance_
->pp_instance());
42 callback
.WaitForResult(tcp_socket_private_interface_
->Connect(
43 socket
, kServerName
, kPort
,
44 callback
.GetCallback().pp_completion_callback()));
45 CHECK_CALLBACK_BEHAVIOR(callback
);
46 ASSERT_EQ(PP_ERROR_FAILED
, callback
.result());