Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: remoting/test/fake_network_manager.cc

Issue 427613005: Implement network performance simulation for remoting perf tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/test/fake_network_manager.h ('k') | remoting/test/fake_port_allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/test/fake_network_manager.cc
diff --git a/remoting/test/fake_network_manager.cc b/remoting/test/fake_network_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4139c8e7b7cda714e431fe56d056a274e7ba3d62
--- /dev/null
+++ b/remoting/test/fake_network_manager.cc
@@ -0,0 +1,46 @@
+// 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.
+
+#include "remoting/test/fake_network_manager.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "base/message_loop/message_loop.h"
+#include "jingle/glue/utils.h"
+#include "third_party/webrtc/base/socketaddress.h"
+
+namespace remoting {
+
+FakeNetworkManager::FakeNetworkManager(const rtc::IPAddress& address)
+ : started_(false),
+ weak_factory_(this) {
+ network_.reset(new rtc::Network("fake", "Fake Network", address, 32));
+ network_->AddIP(address);
+}
+
+FakeNetworkManager::~FakeNetworkManager() {
+}
+
+void FakeNetworkManager::StartUpdating() {
+ started_ = true;
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&FakeNetworkManager::SendNetworksChangedSignal,
+ weak_factory_.GetWeakPtr()));
+}
+
+void FakeNetworkManager::StopUpdating() {
+ started_ = false;
+}
+
+void FakeNetworkManager::GetNetworks(NetworkList* networks) const {
+ networks->clear();
+ networks->push_back(network_.get());
+}
+
+void FakeNetworkManager::SendNetworksChangedSignal() {
+ SignalNetworksChanged();
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/test/fake_network_manager.h ('k') | remoting/test/fake_port_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698