diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-16 08:12:32 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-16 08:13:46 +0000 |
commit | c44593fa600ad351e927bc838d133b78928daf6e (patch) | |
tree | 5e5a7a46221ea64153fc9d9dd9afcafbebd761e6 /remoting/test/fake_network_manager.h | |
parent | c4f1833e9879510843bfe9ba595b56bd50f74106 (diff) | |
download | chromium_src-c44593fa600ad351e927bc838d133b78928daf6e.zip chromium_src-c44593fa600ad351e927bc838d133b78928daf6e.tar.gz chromium_src-c44593fa600ad351e927bc838d133b78928daf6e.tar.bz2 |
Implement network performance simulation for remoting perf tests.
The new FakePacketSocketFactory allows to simulate fake
network with given latency/bandwidth parameters.
BUG=394067
Review URL: https://codereview.chromium.org/427613005
Cr-Commit-Position: refs/heads/master@{#290128}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290128 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/test/fake_network_manager.h')
-rw-r--r-- | remoting/test/fake_network_manager.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/remoting/test/fake_network_manager.h b/remoting/test/fake_network_manager.h new file mode 100644 index 0000000..20788b5 --- /dev/null +++ b/remoting/test/fake_network_manager.h @@ -0,0 +1,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_ |