test_udp_socket_private.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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.
  4. #ifndef PPAPI_TESTS_TEST_UDP_SOCKET_PRIVATE_H_
  5. #define PPAPI_TESTS_TEST_UDP_SOCKET_PRIVATE_H_
  6. #include <stddef.h>
  7. #include <string>
  8. #include "ppapi/c/pp_stdint.h"
  9. #include "ppapi/cpp/private/udp_socket_private.h"
  10. #include "ppapi/tests/test_case.h"
  11. class TestUDPSocketPrivate : public TestCase {
  12. public:
  13. explicit TestUDPSocketPrivate(TestingInstance* instance);
  14. // TestCase implementation.
  15. virtual bool Init();
  16. virtual void RunTests(const std::string& filter);
  17. private:
  18. std::string GetLocalAddress(PP_NetAddress_Private* address);
  19. std::string SetBroadcastOptions(pp::UDPSocketPrivate* socket);
  20. std::string BindUDPSocket(pp::UDPSocketPrivate* socket,
  21. PP_NetAddress_Private *address);
  22. std::string LookupPortAndBindUDPSocket(pp::UDPSocketPrivate* socket,
  23. PP_NetAddress_Private* address);
  24. std::string BindUDPSocketFailure(pp::UDPSocketPrivate* socket,
  25. PP_NetAddress_Private *address);
  26. std::string ReadSocket(pp::UDPSocketPrivate* socket,
  27. PP_NetAddress_Private* address,
  28. size_t size,
  29. std::string* message);
  30. std::string PassMessage(pp::UDPSocketPrivate* target,
  31. pp::UDPSocketPrivate* source,
  32. PP_NetAddress_Private* address,
  33. const std::string& message);
  34. std::string TestConnect();
  35. std::string TestConnectFailure();
  36. std::string TestBroadcast();
  37. std::string TestSetSocketFeatureErrors();
  38. std::string host_;
  39. uint16_t port_;
  40. };
  41. #endif // PPAPI_TESTS_TEST_UDP_SOCKET_PRIVATE_H_