summaryrefslogtreecommitdiffstats
path: root/remoting/test/fake_network_manager.h
blob: 0dea2ba0a70d3d9eb454a47582f70015e6236947 (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
// Copyright 2014 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 REMOTING_TEST_FAKE_NETWORK_MANAGER_H_
#define REMOTING_TEST_FAKE_NETWORK_MANAGER_H_

#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "third_party/webrtc/base/network.h"

namespace remoting {

// FakeNetworkManager always returns one interface with the IP address
// specified in the constructor.
class FakeNetworkManager : public rtc::NetworkManager {
 public:
  FakeNetworkManager(const rtc::IPAddress& address);
  virtual ~FakeNetworkManager();

  // rtc::NetworkManager interface.
  virtual void StartUpdating() override;
  virtual void StopUpdating() override;
  virtual void GetNetworks(NetworkList* networks) const override;

 protected:
  void SendNetworksChangedSignal();

  bool started_;
  scoped_ptr<rtc::Network> network_;

  base::WeakPtrFactory<FakeNetworkManager> weak_factory_;
};

}  // namespace remoting

#endif  // REMOTING_TEST_FAKE_NETWORK_MANAGER_H_