Home | History | Annotate | Download | only in glue
      1 // Copyright (c) 2011 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 JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_
      6 #define JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_
      7 
      8 #include <vector>
      9 
     10 #include "base/compiler_specific.h"
     11 #include "base/memory/scoped_ptr.h"
     12 #include "base/memory/weak_ptr.h"
     13 #include "net/base/net_util.h"
     14 #include "third_party/libjingle/source/talk/base/network.h"
     15 
     16 namespace jingle_glue {
     17 
     18 // FakeNetworkManager always returns one interface with the IP address
     19 // specified in the constructor.
     20 class FakeNetworkManager : public talk_base::NetworkManager {
     21  public:
     22   FakeNetworkManager(const net::IPAddressNumber& address);
     23   virtual ~FakeNetworkManager();
     24 
     25   // talk_base::NetworkManager interface.
     26   virtual void StartUpdating() OVERRIDE;
     27   virtual void StopUpdating() OVERRIDE;
     28   virtual void GetNetworks(NetworkList* networks) const OVERRIDE;
     29 
     30  protected:
     31   void SendNetworksChangedSignal();
     32 
     33   bool started_;
     34   scoped_ptr<talk_base::Network> network_;
     35 
     36   base::WeakPtrFactory<FakeNetworkManager> weak_factory_;
     37 };
     38 
     39 }  // namespace jingle_glue
     40 
     41 #endif  // JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_
     42