summaryrefslogtreecommitdiffstats
path: root/ppapi/tests/test_udp_socket_private.h
blob: e4a23c976e40cadc9e8e77b860aa7acf2b13ccc6 (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.

#ifndef PPAPI_TESTS_TEST_UDP_SOCKET_PRIVATE_H_
#define PPAPI_TESTS_TEST_UDP_SOCKET_PRIVATE_H_

#include <string>

#include "ppapi/c/pp_stdint.h"
#include "ppapi/cpp/private/udp_socket_private.h"
#include "ppapi/tests/test_case.h"

class TestUDPSocketPrivate : public TestCase {
 public:
  explicit TestUDPSocketPrivate(TestingInstance* instance);

  // TestCase implementation.
  virtual bool Init();
  virtual void RunTests(const std::string& filter);

 private:
  std::string GetLocalAddress(PP_NetAddress_Private* address);
  std::string SetBroadcastOptions(pp::UDPSocketPrivate* socket);
  std::string BindUDPSocket(pp::UDPSocketPrivate* socket,
                            PP_NetAddress_Private *address);
  std::string LookupPortAndBindUDPSocket(pp::UDPSocketPrivate* socket,
                                         PP_NetAddress_Private* address);
  std::string BindUDPSocketFailure(pp::UDPSocketPrivate* socket,
                                   PP_NetAddress_Private *address);
  std::string ReadSocket(pp::UDPSocketPrivate* socket,
                         PP_NetAddress_Private* address,
                         size_t size,
                         std::string* message);
  std::string PassMessage(pp::UDPSocketPrivate* target,
                          pp::UDPSocketPrivate* source,
                          PP_NetAddress_Private* address,
                          const std::string& message);

  std::string TestConnect();
  std::string TestConnectFailure();
  std::string TestBroadcast();
  std::string TestSetSocketFeatureErrors();

  std::string host_;
  uint16_t port_;
};

#endif  // PPAPI_TESTS_TEST_UDP_SOCKET_PRIVATE_H_