blob: 655ed35fc43190304a1b7dbf329d1384f5492b7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ppapi/tests/test_udp_socket_private_disallowed.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/private/net_address_private.h"
#include "ppapi/tests/testing_instance.h"
#include "ppapi/tests/test_utils.h"
REGISTER_TEST_CASE(UDPSocketPrivateDisallowed);
TestUDPSocketPrivateDisallowed::TestUDPSocketPrivateDisallowed(
TestingInstance* instance)
: TestCase(instance), udp_socket_private_interface_(NULL) {
}
bool TestUDPSocketPrivateDisallowed::Init() {
udp_socket_private_interface_ = static_cast<const PPB_UDPSocket_Private*>(
pp::Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE));
if (!udp_socket_private_interface_)
instance_->AppendError("UDPSocketPrivate interface not available");
return udp_socket_private_interface_ && CheckTestingInterface();
}
void TestUDPSocketPrivateDisallowed::RunTests(const std::string& filter) {
RUN_TEST(Bind, filter);
}
std::string TestUDPSocketPrivateDisallowed::TestBind() {
PP_Resource socket =
udp_socket_private_interface_->Create(instance_->pp_instance());
if (0 != socket) {
PP_NetAddress_Private addr;
pp::NetAddressPrivate::GetAnyAddress(false, &addr);
TestCompletionCallback callback(instance_->pp_instance());
int32_t rv = udp_socket_private_interface_->Bind(socket, &addr,
callback.GetCallback().pp_completion_callback());
if (PP_OK_COMPLETIONPENDING == rv)
rv = callback.WaitForResult();
if (PP_ERROR_FAILED != rv)
return "PPB_UDPSocket_Private can bind without allowing switch";
}
PASS();
}
|