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

Unified Diff: telemetry/telemetry/page/traffic_setting.py

Issue 2377373002: Add netconfigs for different network type (Closed)
Patch Set: Update test Created 4 years, 3 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 | « telemetry/telemetry/page/shared_page_state.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/page/traffic_setting.py
diff --git a/telemetry/telemetry/page/traffic_setting.py b/telemetry/telemetry/page/traffic_setting.py
index 10a8509525af7d77958efb913f5fd38fbbada1df..caffa09c608ffb5cffc3756e8ccd7e08ad7934af 100644
--- a/telemetry/telemetry/page/traffic_setting.py
+++ b/telemetry/telemetry/page/traffic_setting.py
@@ -5,8 +5,33 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import collections
+
+_Configs = collections.namedtuple(
+ '_Configs', ('download_bandwidth_kbps,'
+ 'upload_bandwidth_kbps,'
+ 'round_trip_latency_ms'))
+
+# These presets are copied from devtool's:
+# https://cs.chromium.org/chromium/src/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js?l=43
NONE = 'none'
-NET_2G = '2g'
-NET_3G = '3g'
-NET_4G = '4g'
-NET_FIBER = 'fiber'
+GPRS = 'GPRS'
+REGULAR_2G = 'Regular-2G'
+GOOD_2G = 'Good-2G'
+REGULAR_3G = 'Regular-3G'
+GOOD_3G = 'Good-3G'
+REGULAR_4G = 'Regular-4G'
+DSL = 'DSL'
+WIFI = 'WiFi'
+
+NETWORK_CONFIGS = {
+ NONE: _Configs(0, 0, 0),
+ GPRS: _Configs(50 * 1024 / 8, 20 * 1024 / 8, 500),
+ REGULAR_2G: _Configs(250 * 1024 / 8, 50 * 1024 / 8, 300),
+ GOOD_2G: _Configs(450 * 1024 / 8, 150 * 1024 / 8, 150),
+ REGULAR_3G: _Configs(750 * 1024 / 8, 250 * 1024 / 8, 100),
+ GOOD_3G: _Configs(1.5 * 1024 * 1024 / 8, 750 * 1024 / 8, 40),
+ REGULAR_4G: _Configs(4 * 1024 * 1024 / 8, 3 * 1024 * 1024 / 8, 20),
+ DSL: _Configs(2 * 1024 * 1024 / 8, 1 * 1024 * 1024 / 8, 5),
+ WIFI: _Configs(30 * 1024 * 1024 / 8, 15 * 1024 * 1024 / 8, 2),
+}
« no previous file with comments | « telemetry/telemetry/page/shared_page_state.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698