• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 
5 #ifndef TESTS_NACL_IO_TEST_FAKE_HOST_RESOLVER_INTERFACE_H_
6 #define TESTS_NACL_IO_TEST_FAKE_HOST_RESOLVER_INTERFACE_H_
7 
8 #include <ppapi/c/ppb_host_resolver.h>
9 
10 #include <netinet/in.h>
11 #include <string>
12 #include <vector>
13 
14 #include "nacl_io/pepper_interface.h"
15 #include "sdk_util/macros.h"
16 
17 class FakePepperInterface;
18 class FakeVarManager;
19 
20 class FakeHostResolverInterface : public nacl_io::HostResolverInterface {
21  public:
22   explicit FakeHostResolverInterface(FakePepperInterface* ppapi);
23 
24   virtual PP_Resource Create(PP_Instance);
25 
26   virtual int32_t Resolve(PP_Resource,
27                           const char*,
28                           uint16_t,
29                           const PP_HostResolver_Hint* hints,
30                           PP_CompletionCallback);
31 
32   virtual PP_Var GetCanonicalName(PP_Resource);
33   virtual uint32_t GetNetAddressCount(PP_Resource);
34   virtual PP_Resource GetNetAddress(PP_Resource, uint32_t);
35 
36   std::string fake_hostname;
37   std::vector<struct sockaddr_in> fake_addresses_v4;
38   std::vector<struct sockaddr_in6> fake_addresses_v6;
39  private:
40   FakePepperInterface* ppapi_;
41 
42   DISALLOW_COPY_AND_ASSIGN(FakeHostResolverInterface);
43 };
44 
45 #endif  // TESTS_NACL_IO_TEST_FAKE_HOST_RESOLVER_INTERFACE_H_
46