Windows precompiled header support in GN.
[chromium-blink-merge.git] / ppapi / tests / test_tcp_socket_private_disallowed.cc
blob581b54b37cc45fc683c85efe9f00f23581ef5932
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"
11 namespace {
13 const char kServerName[] = "www.google.com";
14 const int kPort = 80;
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() {
38 PP_Resource socket =
39 tcp_socket_private_interface_->Create(instance_->pp_instance());
40 if (0 != socket) {
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());
48 PASS();