Move network emulation framework under test/network

Bug: webrtc:10138
Change-Id: I654bc124866241ceca65462937e2fad6294cc62b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144622
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28492}
diff --git a/test/network/BUILD.gn b/test/network/BUILD.gn
new file mode 100644
index 0000000..c8f14dd
--- /dev/null
+++ b/test/network/BUILD.gn
@@ -0,0 +1,158 @@
+# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS.  All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../webrtc.gni")
+
+rtc_source_set("emulated_network") {
+  visibility = [
+    "../../api:create_network_emulation_manager",
+    ":*",
+  ]
+  if (rtc_include_tests) {
+    visibility += [ "../scenario" ]
+  }
+  testonly = true
+  sources = [
+    "cross_traffic.cc",
+    "cross_traffic.h",
+    "emulated_network_manager.cc",
+    "emulated_network_manager.h",
+    "fake_network_socket.cc",
+    "fake_network_socket.h",
+    "fake_network_socket_server.cc",
+    "fake_network_socket_server.h",
+    "network_emulation.cc",
+    "network_emulation.h",
+    "network_emulation_manager.cc",
+    "network_emulation_manager.h",
+    "traffic_route.cc",
+    "traffic_route.h",
+  ]
+  deps = [
+    "../../api:network_emulation_manager_api",
+    "../../api:simulated_network_api",
+    "../../api/units:data_rate",
+    "../../api/units:data_size",
+    "../../api/units:time_delta",
+    "../../api/units:timestamp",
+    "../../rtc_base",
+    "../../rtc_base:rtc_base_tests_utils",
+    "../../rtc_base:rtc_task_queue",
+    "../../rtc_base:safe_minmax",
+    "../../rtc_base:task_queue_for_test",
+    "../../rtc_base/synchronization:sequence_checker",
+    "../../rtc_base/task_utils:repeating_task",
+    "../../rtc_base/third_party/sigslot",
+    "../../system_wrappers",
+    "../scenario:column_printer",
+    "../time_controller",
+    "//third_party/abseil-cpp/absl/memory",
+    "//third_party/abseil-cpp/absl/types:optional",
+  ]
+}
+
+rtc_source_set("network_emulation_unittest") {
+  testonly = true
+  sources = [
+    "network_emulation_unittest.cc",
+  ]
+  deps = [
+    ":emulated_network",
+    "../:test_support",
+    "../../api:simulated_network_api",
+    "../../api/units:time_delta",
+    "../../call:simulated_network",
+    "../../rtc_base:gunit_helpers",
+    "../../rtc_base:logging",
+    "../../rtc_base:rtc_event",
+    "../../system_wrappers:system_wrappers",
+    "//third_party/abseil-cpp/absl/memory",
+  ]
+}
+
+rtc_source_set("network_emulation_pc_unittest") {
+  testonly = true
+  sources = [
+    "network_emulation_pc_unittest.cc",
+  ]
+  deps = [
+    ":emulated_network",
+    "../:test_support",
+    "../../api:callfactory_api",
+    "../../api:libjingle_peerconnection_api",
+    "../../api:scoped_refptr",
+    "../../api:simulated_network_api",
+    "../../api/rtc_event_log:rtc_event_log_factory",
+    "../../api/task_queue:default_task_queue_factory",
+    "../../call:simulated_network",
+    "../../media:rtc_audio_video",
+    "../../media:rtc_media_engine_defaults",
+    "../../modules/audio_device:audio_device_impl",
+    "../../p2p:rtc_p2p",
+    "../../pc:pc_test_utils",
+    "../../pc:peerconnection_wrapper",
+    "../../rtc_base",
+    "../../rtc_base:gunit_helpers",
+    "../../rtc_base:logging",
+    "../../rtc_base:rtc_event",
+    "//third_party/abseil-cpp/absl/memory",
+  ]
+}
+
+rtc_source_set("cross_traffic_unittest") {
+  testonly = true
+  sources = [
+    "cross_traffic_unittest.cc",
+  ]
+  deps = [
+    ":emulated_network",
+    "../:test_support",
+    "../../api:simulated_network_api",
+    "../../call:simulated_network",
+    "../../rtc_base:logging",
+    "../../rtc_base:rtc_event",
+    "//third_party/abseil-cpp/absl/memory",
+  ]
+}
+
+rtc_source_set("feedback_generator") {
+  testonly = true
+  sources = [
+    "feedback_generator.cc",
+    "feedback_generator.h",
+  ]
+  deps = [
+    ":emulated_network",
+    "../../api/transport:test_feedback_generator_interface",
+    "../../call:simulated_network",
+    "../../rtc_base:checks",
+    "../time_controller",
+    "//third_party/abseil-cpp/absl/memory",
+  ]
+}
+
+rtc_source_set("feedback_generator_unittest") {
+  testonly = true
+  sources = [
+    "feedback_generator_unittest.cc",
+  ]
+  deps = [
+    "../:test_support",
+    "../../api/transport:test_feedback_generator",
+  ]
+}
+
+rtc_source_set("network_emulation_unittests") {
+  testonly = true
+  deps = [
+    ":cross_traffic_unittest",
+    ":feedback_generator_unittest",
+    ":network_emulation_pc_unittest",
+    ":network_emulation_unittest",
+  ]
+}
diff --git a/test/network/OWNERS b/test/network/OWNERS
new file mode 100644
index 0000000..b177c4e
--- /dev/null
+++ b/test/network/OWNERS
@@ -0,0 +1 @@
+titovartem@webrtc.org
diff --git a/test/scenario/network/cross_traffic.cc b/test/network/cross_traffic.cc
similarity index 98%
rename from test/scenario/network/cross_traffic.cc
rename to test/network/cross_traffic.cc
index 105ad48..7f64d53 100644
--- a/test/scenario/network/cross_traffic.cc
+++ b/test/network/cross_traffic.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "test/scenario/network/cross_traffic.h"
+#include "test/network/cross_traffic.h"
 
 #include <math.h>
 #include <utility>
diff --git a/test/scenario/network/cross_traffic.h b/test/network/cross_traffic.h
similarity index 95%
rename from test/scenario/network/cross_traffic.h
rename to test/network/cross_traffic.h
index 29625b8..6a01a4e 100644
--- a/test/scenario/network/cross_traffic.h
+++ b/test/network/cross_traffic.h
@@ -8,9 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef TEST_SCENARIO_NETWORK_CROSS_TRAFFIC_H_
-#define TEST_SCENARIO_NETWORK_CROSS_TRAFFIC_H_
+#ifndef TEST_NETWORK_CROSS_TRAFFIC_H_
+#define TEST_NETWORK_CROSS_TRAFFIC_H_
 
+#include <algorithm>
+#include <map>
 #include <memory>
 
 #include "api/units/data_rate.h"
@@ -19,8 +21,8 @@
 #include "api/units/timestamp.h"
 #include "rtc_base/random.h"
 #include "rtc_base/synchronization/sequence_checker.h"
+#include "test/network/traffic_route.h"
 #include "test/scenario/column_printer.h"
-#include "test/scenario/network/traffic_route.h"
 
 namespace webrtc {
 namespace test {
@@ -130,4 +132,4 @@
 }  // namespace test
 }  // namespace webrtc
 
-#endif  // TEST_SCENARIO_NETWORK_CROSS_TRAFFIC_H_
+#endif  // TEST_NETWORK_CROSS_TRAFFIC_H_
diff --git a/test/scenario/network/cross_traffic_unittest.cc b/test/network/cross_traffic_unittest.cc
similarity index 98%
rename from test/scenario/network/cross_traffic_unittest.cc
rename to test/network/cross_traffic_unittest.cc
index 4bff272..cc20d6c 100644
--- a/test/scenario/network/cross_traffic_unittest.cc
+++ b/test/network/cross_traffic_unittest.cc
@@ -20,7 +20,7 @@
 #include "rtc_base/logging.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
-#include "test/scenario/network/cross_traffic.h"
+#include "test/network/cross_traffic.h"
 
 namespace webrtc {
 namespace test {
diff --git a/test/scenario/network/emulated_network_manager.cc b/test/network/emulated_network_manager.cc
similarity index 97%
rename from test/scenario/network/emulated_network_manager.cc
rename to test/network/emulated_network_manager.cc
index 5ee9c16..5367a80 100644
--- a/test/scenario/network/emulated_network_manager.cc
+++ b/test/network/emulated_network_manager.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "test/scenario/network/emulated_network_manager.h"
+#include "test/network/emulated_network_manager.h"
 
 #include <memory>
 #include <utility>
diff --git a/test/scenario/network/emulated_network_manager.h b/test/network/emulated_network_manager.h
similarity index 87%
rename from test/scenario/network/emulated_network_manager.h
rename to test/network/emulated_network_manager.h
index 7f941a4..4e50e662 100644
--- a/test/scenario/network/emulated_network_manager.h
+++ b/test/network/emulated_network_manager.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef TEST_SCENARIO_NETWORK_EMULATED_NETWORK_MANAGER_H_
-#define TEST_SCENARIO_NETWORK_EMULATED_NETWORK_MANAGER_H_
+#ifndef TEST_NETWORK_EMULATED_NETWORK_MANAGER_H_
+#define TEST_NETWORK_EMULATED_NETWORK_MANAGER_H_
 
 #include <memory>
 #include <vector>
@@ -21,8 +21,8 @@
 #include "rtc_base/socket_server.h"
 #include "rtc_base/thread.h"
 #include "rtc_base/thread_checker.h"
-#include "test/scenario/network/fake_network_socket_server.h"
-#include "test/scenario/network/network_emulation.h"
+#include "test/network/fake_network_socket_server.h"
+#include "test/network/network_emulation.h"
 
 namespace webrtc {
 namespace test {
@@ -66,4 +66,4 @@
 }  // namespace test
 }  // namespace webrtc
 
-#endif  // TEST_SCENARIO_NETWORK_EMULATED_NETWORK_MANAGER_H_
+#endif  // TEST_NETWORK_EMULATED_NETWORK_MANAGER_H_
diff --git a/test/scenario/network/fake_network_socket.cc b/test/network/fake_network_socket.cc
similarity index 98%
rename from test/scenario/network/fake_network_socket.cc
rename to test/network/fake_network_socket.cc
index 59699f5..d514afe 100644
--- a/test/scenario/network/fake_network_socket.cc
+++ b/test/network/fake_network_socket.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "test/scenario/network/fake_network_socket.h"
+#include "test/network/fake_network_socket.h"
 
 #include <algorithm>
 #include <string>
diff --git a/test/scenario/network/fake_network_socket.h b/test/network/fake_network_socket.h
similarity index 93%
rename from test/scenario/network/fake_network_socket.h
rename to test/network/fake_network_socket.h
index 26013d9..1715f1e 100644
--- a/test/scenario/network/fake_network_socket.h
+++ b/test/network/fake_network_socket.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef TEST_SCENARIO_NETWORK_FAKE_NETWORK_SOCKET_H_
-#define TEST_SCENARIO_NETWORK_FAKE_NETWORK_SOCKET_H_
+#ifndef TEST_NETWORK_FAKE_NETWORK_SOCKET_H_
+#define TEST_NETWORK_FAKE_NETWORK_SOCKET_H_
 
 #include <deque>
 #include <map>
@@ -19,7 +19,7 @@
 #include "rtc_base/copy_on_write_buffer.h"
 #include "rtc_base/critical_section.h"
 #include "rtc_base/socket_address.h"
-#include "test/scenario/network/network_emulation.h"
+#include "test/network/network_emulation.h"
 
 namespace webrtc {
 namespace test {
@@ -102,4 +102,4 @@
 }  // namespace test
 }  // namespace webrtc
 
-#endif  // TEST_SCENARIO_NETWORK_FAKE_NETWORK_SOCKET_H_
+#endif  // TEST_NETWORK_FAKE_NETWORK_SOCKET_H_
diff --git a/test/scenario/network/fake_network_socket_server.cc b/test/network/fake_network_socket_server.cc
similarity index 97%
rename from test/scenario/network/fake_network_socket_server.cc
rename to test/network/fake_network_socket_server.cc
index 407f760..df082dd 100644
--- a/test/scenario/network/fake_network_socket_server.cc
+++ b/test/network/fake_network_socket_server.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "test/scenario/network/fake_network_socket_server.h"
+#include "test/network/fake_network_socket_server.h"
 
 #include <utility>
 #include "rtc_base/thread.h"
diff --git a/test/scenario/network/fake_network_socket_server.h b/test/network/fake_network_socket_server.h
similarity index 89%
rename from test/scenario/network/fake_network_socket_server.h
rename to test/network/fake_network_socket_server.h
index d36b8f0..2597779 100644
--- a/test/scenario/network/fake_network_socket_server.h
+++ b/test/network/fake_network_socket_server.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef TEST_SCENARIO_NETWORK_FAKE_NETWORK_SOCKET_SERVER_H_
-#define TEST_SCENARIO_NETWORK_FAKE_NETWORK_SOCKET_SERVER_H_
+#ifndef TEST_NETWORK_FAKE_NETWORK_SOCKET_SERVER_H_
+#define TEST_NETWORK_FAKE_NETWORK_SOCKET_SERVER_H_
 
 #include <set>
 #include <vector>
@@ -24,7 +24,7 @@
 #include "rtc_base/socket_server.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
 #include "system_wrappers/include/clock.h"
-#include "test/scenario/network/fake_network_socket.h"
+#include "test/network/fake_network_socket.h"
 
 namespace webrtc {
 namespace test {
@@ -68,4 +68,4 @@
 }  // namespace test
 }  // namespace webrtc
 
-#endif  // TEST_SCENARIO_NETWORK_FAKE_NETWORK_SOCKET_SERVER_H_
+#endif  // TEST_NETWORK_FAKE_NETWORK_SOCKET_SERVER_H_
diff --git a/test/scenario/network/feedback_generator.cc b/test/network/feedback_generator.cc
similarity index 97%
rename from test/scenario/network/feedback_generator.cc
rename to test/network/feedback_generator.cc
index 9512c47..27b7690 100644
--- a/test/scenario/network/feedback_generator.cc
+++ b/test/network/feedback_generator.cc
@@ -7,7 +7,7 @@
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
-#include "test/scenario/network/feedback_generator.h"
+#include "test/network/feedback_generator.h"
 
 #include "absl/memory/memory.h"
 #include "rtc_base/checks.h"
diff --git a/test/scenario/network/feedback_generator.h b/test/network/feedback_generator.h
similarity index 86%
rename from test/scenario/network/feedback_generator.h
rename to test/network/feedback_generator.h
index 094ada5..a2c4909 100644
--- a/test/scenario/network/feedback_generator.h
+++ b/test/network/feedback_generator.h
@@ -7,8 +7,8 @@
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
-#ifndef TEST_SCENARIO_NETWORK_FEEDBACK_GENERATOR_H_
-#define TEST_SCENARIO_NETWORK_FEEDBACK_GENERATOR_H_
+#ifndef TEST_NETWORK_FEEDBACK_GENERATOR_H_
+#define TEST_NETWORK_FEEDBACK_GENERATOR_H_
 
 #include <map>
 #include <utility>
@@ -16,8 +16,8 @@
 
 #include "api/transport/test/feedback_generator_interface.h"
 #include "call/simulated_network.h"
-#include "test/scenario/network/network_emulation.h"
-#include "test/scenario/network/network_emulation_manager.h"
+#include "test/network/network_emulation.h"
+#include "test/network/network_emulation_manager.h"
 #include "test/time_controller/simulated_time_controller.h"
 
 namespace webrtc {
@@ -54,4 +54,4 @@
   std::vector<TransportPacketsFeedback> feedback_;
 };
 }  // namespace webrtc
-#endif  // TEST_SCENARIO_NETWORK_FEEDBACK_GENERATOR_H_
+#endif  // TEST_NETWORK_FEEDBACK_GENERATOR_H_
diff --git a/test/scenario/network/feedback_generator_unittest.cc b/test/network/feedback_generator_unittest.cc
similarity index 100%
rename from test/scenario/network/feedback_generator_unittest.cc
rename to test/network/feedback_generator_unittest.cc
diff --git a/test/scenario/network/network_emulation.cc b/test/network/network_emulation.cc
similarity index 98%
rename from test/scenario/network/network_emulation.cc
rename to test/network/network_emulation.cc
index cb611e2..8a19486 100644
--- a/test/scenario/network/network_emulation.cc
+++ b/test/network/network_emulation.cc
@@ -8,8 +8,9 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "test/scenario/network/network_emulation.h"
+#include "test/network/network_emulation.h"
 
+#include <algorithm>
 #include <limits>
 #include <memory>
 
@@ -24,10 +25,7 @@
                                    const rtc::SocketAddress& to,
                                    rtc::CopyOnWriteBuffer data,
                                    Timestamp arrival_time)
-    : from(from),
-      to(to),
-      data(data),
-      arrival_time(arrival_time) {}
+    : from(from), to(to), data(data), arrival_time(arrival_time) {}
 
 void LinkEmulation::OnPacketReceived(EmulatedIpPacket packet) {
   struct Closure {
diff --git a/test/scenario/network/network_emulation.h b/test/network/network_emulation.h
similarity index 98%
rename from test/scenario/network/network_emulation.h
rename to test/network/network_emulation.h
index ff8444b..24e2fd9 100644
--- a/test/scenario/network/network_emulation.h
+++ b/test/network/network_emulation.h
@@ -8,10 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef TEST_SCENARIO_NETWORK_NETWORK_EMULATION_H_
-#define TEST_SCENARIO_NETWORK_NETWORK_EMULATION_H_
+#ifndef TEST_NETWORK_NETWORK_EMULATION_H_
+#define TEST_NETWORK_NETWORK_EMULATION_H_
 
 #include <cstdint>
+#include <deque>
 #include <map>
 #include <memory>
 #include <string>
@@ -317,4 +318,4 @@
 };
 }  // namespace webrtc
 
-#endif  // TEST_SCENARIO_NETWORK_NETWORK_EMULATION_H_
+#endif  // TEST_NETWORK_NETWORK_EMULATION_H_
diff --git a/test/scenario/network/network_emulation_manager.cc b/test/network/network_emulation_manager.cc
similarity index 98%
rename from test/scenario/network/network_emulation_manager.cc
rename to test/network/network_emulation_manager.cc
index 8900ec4..4ae7299 100644
--- a/test/scenario/network/network_emulation_manager.cc
+++ b/test/network/network_emulation_manager.cc
@@ -8,8 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "test/scenario/network/network_emulation_manager.h"
-#include "test/time_controller/real_time_controller.h"
+#include "test/network/network_emulation_manager.h"
 
 #include <algorithm>
 #include <memory>
@@ -18,6 +17,7 @@
 #include "api/units/time_delta.h"
 #include "api/units/timestamp.h"
 #include "rtc_base/fake_network.h"
+#include "test/time_controller/real_time_controller.h"
 
 namespace webrtc {
 namespace test {
@@ -62,8 +62,7 @@
       next_ip4_address_(kMinIPv4Address),
       task_queue_(time_controller->GetTaskQueueFactory()->CreateTaskQueue(
           "NetworkEmulation",
-          TaskQueueFactory::Priority::NORMAL)) {
-}
+          TaskQueueFactory::Priority::NORMAL)) {}
 
 // TODO(srte): Ensure that any pending task that must be run for consistency
 // (such as stats collection tasks) are not cancelled when the task queue is
diff --git a/test/scenario/network/network_emulation_manager.h b/test/network/network_emulation_manager.h
similarity index 88%
rename from test/scenario/network/network_emulation_manager.h
rename to test/network/network_emulation_manager.h
index a10eca7..c860362 100644
--- a/test/scenario/network/network_emulation_manager.h
+++ b/test/network/network_emulation_manager.h
@@ -8,10 +8,12 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef TEST_SCENARIO_NETWORK_NETWORK_EMULATION_MANAGER_H_
-#define TEST_SCENARIO_NETWORK_NETWORK_EMULATION_MANAGER_H_
+#ifndef TEST_NETWORK_NETWORK_EMULATION_MANAGER_H_
+#define TEST_NETWORK_NETWORK_EMULATION_MANAGER_H_
 
+#include <map>
 #include <memory>
+#include <set>
 #include <utility>
 #include <vector>
 
@@ -25,11 +27,11 @@
 #include "rtc_base/task_utils/repeating_task.h"
 #include "rtc_base/thread.h"
 #include "system_wrappers/include/clock.h"
-#include "test/scenario/network/cross_traffic.h"
-#include "test/scenario/network/emulated_network_manager.h"
-#include "test/scenario/network/fake_network_socket_server.h"
-#include "test/scenario/network/network_emulation.h"
-#include "test/scenario/network/traffic_route.h"
+#include "test/network/cross_traffic.h"
+#include "test/network/emulated_network_manager.h"
+#include "test/network/fake_network_socket_server.h"
+#include "test/network/network_emulation.h"
+#include "test/network/traffic_route.h"
 #include "test/time_controller/time_controller.h"
 
 namespace webrtc {
@@ -106,4 +108,4 @@
 }  // namespace test
 }  // namespace webrtc
 
-#endif  // TEST_SCENARIO_NETWORK_NETWORK_EMULATION_MANAGER_H_
+#endif  // TEST_NETWORK_NETWORK_EMULATION_MANAGER_H_
diff --git a/test/scenario/network/network_emulation_pc_unittest.cc b/test/network/network_emulation_pc_unittest.cc
similarity index 98%
rename from test/scenario/network/network_emulation_pc_unittest.cc
rename to test/network/network_emulation_pc_unittest.cc
index f9769bb..6c83a99 100644
--- a/test/scenario/network/network_emulation_pc_unittest.cc
+++ b/test/network/network_emulation_pc_unittest.cc
@@ -27,8 +27,8 @@
 #include "rtc_base/gunit.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
-#include "test/scenario/network/network_emulation.h"
-#include "test/scenario/network/network_emulation_manager.h"
+#include "test/network/network_emulation.h"
+#include "test/network/network_emulation_manager.h"
 
 namespace webrtc {
 namespace test {
diff --git a/test/scenario/network/network_emulation_unittest.cc b/test/network/network_emulation_unittest.cc
similarity index 98%
rename from test/scenario/network/network_emulation_unittest.cc
rename to test/network/network_emulation_unittest.cc
index e965dbc..26b1b37 100644
--- a/test/scenario/network/network_emulation_unittest.cc
+++ b/test/network/network_emulation_unittest.cc
@@ -10,6 +10,7 @@
 
 #include <atomic>
 #include <memory>
+#include <set>
 
 #include "absl/memory/memory.h"
 #include "api/test/simulated_network.h"
@@ -21,8 +22,8 @@
 #include "system_wrappers/include/sleep.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
-#include "test/scenario/network/network_emulation.h"
-#include "test/scenario/network/network_emulation_manager.h"
+#include "test/network/network_emulation.h"
+#include "test/network/network_emulation_manager.h"
 
 namespace webrtc {
 namespace test {
diff --git a/test/scenario/network/traffic_route.cc b/test/network/traffic_route.cc
similarity index 98%
rename from test/scenario/network/traffic_route.cc
rename to test/network/traffic_route.cc
index 7ede034..6bd4535 100644
--- a/test/scenario/network/traffic_route.cc
+++ b/test/network/traffic_route.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "test/scenario/network/traffic_route.h"
+#include "test/network/traffic_route.h"
 
 #include <utility>
 
diff --git a/test/scenario/network/traffic_route.h b/test/network/traffic_route.h
similarity index 89%
rename from test/scenario/network/traffic_route.h
rename to test/network/traffic_route.h
index 1f138f4..1bb34c6 100644
--- a/test/scenario/network/traffic_route.h
+++ b/test/network/traffic_route.h
@@ -8,15 +8,15 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef TEST_SCENARIO_NETWORK_TRAFFIC_ROUTE_H_
-#define TEST_SCENARIO_NETWORK_TRAFFIC_ROUTE_H_
+#ifndef TEST_NETWORK_TRAFFIC_ROUTE_H_
+#define TEST_NETWORK_TRAFFIC_ROUTE_H_
 
 #include <memory>
 #include <vector>
 
 #include "rtc_base/copy_on_write_buffer.h"
 #include "system_wrappers/include/clock.h"
-#include "test/scenario/network/network_emulation.h"
+#include "test/network/network_emulation.h"
 
 namespace webrtc {
 namespace test {
@@ -52,4 +52,4 @@
 }  // namespace test
 }  // namespace webrtc
 
-#endif  // TEST_SCENARIO_NETWORK_TRAFFIC_ROUTE_H_
+#endif  // TEST_NETWORK_TRAFFIC_ROUTE_H_
diff --git a/test/scenario/BUILD.gn b/test/scenario/BUILD.gn
index b8b4e77..eac3ba8 100644
--- a/test/scenario/BUILD.gn
+++ b/test/scenario/BUILD.gn
@@ -138,8 +138,8 @@
       "../../system_wrappers:field_trial",
       "../../video",
       "../logging:log_writer",
+      "../network:emulated_network",
       "../time_controller",
-      "network:emulated_network",
       "//third_party/abseil-cpp/absl/memory",
       "//third_party/abseil-cpp/absl/types:optional",
     ]
diff --git a/test/scenario/call_client.h b/test/scenario/call_client.h
index e863e60..b71f406 100644
--- a/test/scenario/call_client.h
+++ b/test/scenario/call_client.h
@@ -24,8 +24,8 @@
 #include "rtc_base/constructor_magic.h"
 #include "rtc_base/task_queue_for_test.h"
 #include "test/logging/log_writer.h"
+#include "test/network/network_emulation.h"
 #include "test/scenario/column_printer.h"
-#include "test/scenario/network/network_emulation.h"
 #include "test/scenario/network_node.h"
 #include "test/scenario/scenario_config.h"
 #include "test/time_controller/time_controller.h"
diff --git a/test/scenario/network/BUILD.gn b/test/scenario/network/BUILD.gn
deleted file mode 100644
index 339e441..0000000
--- a/test/scenario/network/BUILD.gn
+++ /dev/null
@@ -1,158 +0,0 @@
-# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS.  All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-import("../../../webrtc.gni")
-
-rtc_source_set("emulated_network") {
-  visibility = [
-    "../../../api:create_network_emulation_manager",
-    ":*",
-  ]
-  if (rtc_include_tests) {
-    visibility += [ "../:scenario" ]
-  }
-  testonly = true
-  sources = [
-    "cross_traffic.cc",
-    "cross_traffic.h",
-    "emulated_network_manager.cc",
-    "emulated_network_manager.h",
-    "fake_network_socket.cc",
-    "fake_network_socket.h",
-    "fake_network_socket_server.cc",
-    "fake_network_socket_server.h",
-    "network_emulation.cc",
-    "network_emulation.h",
-    "network_emulation_manager.cc",
-    "network_emulation_manager.h",
-    "traffic_route.cc",
-    "traffic_route.h",
-  ]
-  deps = [
-    "../:column_printer",
-    "../../../api:network_emulation_manager_api",
-    "../../../api:simulated_network_api",
-    "../../../api/units:data_rate",
-    "../../../api/units:data_size",
-    "../../../api/units:time_delta",
-    "../../../api/units:timestamp",
-    "../../../rtc_base",
-    "../../../rtc_base:rtc_base_tests_utils",
-    "../../../rtc_base:rtc_task_queue",
-    "../../../rtc_base:safe_minmax",
-    "../../../rtc_base:task_queue_for_test",
-    "../../../rtc_base/synchronization:sequence_checker",
-    "../../../rtc_base/task_utils:repeating_task",
-    "../../../rtc_base/third_party/sigslot",
-    "../../../system_wrappers",
-    "../../time_controller",
-    "//third_party/abseil-cpp/absl/memory",
-    "//third_party/abseil-cpp/absl/types:optional",
-  ]
-}
-
-rtc_source_set("network_emulation_unittest") {
-  testonly = true
-  sources = [
-    "network_emulation_unittest.cc",
-  ]
-  deps = [
-    ":emulated_network",
-    "../../../api:simulated_network_api",
-    "../../../api/units:time_delta",
-    "../../../call:simulated_network",
-    "../../../rtc_base:gunit_helpers",
-    "../../../rtc_base:logging",
-    "../../../rtc_base:rtc_event",
-    "../../../system_wrappers:system_wrappers",
-    "../../../test:test_support",
-    "//third_party/abseil-cpp/absl/memory",
-  ]
-}
-
-rtc_source_set("network_emulation_pc_unittest") {
-  testonly = true
-  sources = [
-    "network_emulation_pc_unittest.cc",
-  ]
-  deps = [
-    ":emulated_network",
-    "../../../api:callfactory_api",
-    "../../../api:libjingle_peerconnection_api",
-    "../../../api:scoped_refptr",
-    "../../../api:simulated_network_api",
-    "../../../api/rtc_event_log:rtc_event_log_factory",
-    "../../../api/task_queue:default_task_queue_factory",
-    "../../../call:simulated_network",
-    "../../../media:rtc_audio_video",
-    "../../../media:rtc_media_engine_defaults",
-    "../../../modules/audio_device:audio_device_impl",
-    "../../../p2p:rtc_p2p",
-    "../../../pc:pc_test_utils",
-    "../../../pc:peerconnection_wrapper",
-    "../../../rtc_base",
-    "../../../rtc_base:gunit_helpers",
-    "../../../rtc_base:logging",
-    "../../../rtc_base:rtc_event",
-    "../../../test:test_support",
-    "//third_party/abseil-cpp/absl/memory",
-  ]
-}
-
-rtc_source_set("cross_traffic_unittest") {
-  testonly = true
-  sources = [
-    "cross_traffic_unittest.cc",
-  ]
-  deps = [
-    ":emulated_network",
-    "../../../api:simulated_network_api",
-    "../../../call:simulated_network",
-    "../../../rtc_base:logging",
-    "../../../rtc_base:rtc_event",
-    "../../../test:test_support",
-    "//third_party/abseil-cpp/absl/memory",
-  ]
-}
-
-rtc_source_set("feedback_generator") {
-  testonly = true
-  sources = [
-    "feedback_generator.cc",
-    "feedback_generator.h",
-  ]
-  deps = [
-    "../../../api/transport:test_feedback_generator_interface",
-    "../../../call:simulated_network",
-    "../../../rtc_base:checks",
-    "../../../test/scenario/network:emulated_network",
-    "../../../test/time_controller",
-    "//third_party/abseil-cpp/absl/memory",
-  ]
-}
-
-rtc_source_set("feedback_generator_unittest") {
-  testonly = true
-  sources = [
-    "feedback_generator_unittest.cc",
-  ]
-  deps = [
-    "../../../api/transport:test_feedback_generator",
-    "../../../test:test_support",
-  ]
-}
-
-rtc_source_set("network_emulation_unittests") {
-  testonly = true
-  deps = [
-    ":cross_traffic_unittest",
-    ":feedback_generator_unittest",
-    ":network_emulation_pc_unittest",
-    ":network_emulation_unittest",
-  ]
-}
diff --git a/test/scenario/network_node.h b/test/scenario/network_node.h
index 5dcfa52..bab045d 100644
--- a/test/scenario/network_node.h
+++ b/test/scenario/network_node.h
@@ -23,8 +23,8 @@
 #include "rtc_base/constructor_magic.h"
 #include "rtc_base/copy_on_write_buffer.h"
 #include "rtc_base/task_queue.h"
+#include "test/network/network_emulation.h"
 #include "test/scenario/column_printer.h"
-#include "test/scenario/network/network_emulation.h"
 #include "test/scenario/scenario_config.h"
 
 namespace webrtc {
diff --git a/test/scenario/scenario.cc b/test/scenario/scenario.cc
index 1845577..9e6105b 100644
--- a/test/scenario/scenario.cc
+++ b/test/scenario/scenario.cc
@@ -17,7 +17,7 @@
 #include "rtc_base/flags.h"
 #include "rtc_base/socket_address.h"
 #include "test/logging/file_log_writer.h"
-#include "test/scenario/network/network_emulation.h"
+#include "test/network/network_emulation.h"
 #include "test/testsupport/file_utils.h"
 #include "test/time_controller/real_time_controller.h"
 #include "test/time_controller/simulated_time_controller.h"
diff --git a/test/scenario/scenario.h b/test/scenario/scenario.h
index c4e672e..fc4fced 100644
--- a/test/scenario/scenario.h
+++ b/test/scenario/scenario.h
@@ -20,10 +20,10 @@
 #include "rtc_base/task_queue.h"
 #include "rtc_base/task_utils/repeating_task.h"
 #include "test/logging/log_writer.h"
+#include "test/network/network_emulation_manager.h"
 #include "test/scenario/audio_stream.h"
 #include "test/scenario/call_client.h"
 #include "test/scenario/column_printer.h"
-#include "test/scenario/network/network_emulation_manager.h"
 #include "test/scenario/network_node.h"
 #include "test/scenario/scenario_config.h"
 #include "test/scenario/video_stream.h"