1# Copyright 2016 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# Copyright 2016 The Chromium Authors. All rights reserved. 5# Use of this source code is governed by a BSD-style license that can be 6# found in the LICENSE file. 7 8import collections 9 10_Configs = collections.namedtuple( 11 '_Configs', ('download_bandwidth_kbps,' 12 'upload_bandwidth_kbps,' 13 'round_trip_latency_ms')) 14 15# These presets are copied from devtool's: 16# https://cs.chromium.org/chromium/src/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js?l=43 17NONE = 'none' 18GPRS = 'GPRS' 19REGULAR_2G = 'Regular-2G' 20GOOD_2G = 'Good-2G' 21REGULAR_3G = 'Regular-3G' 22GOOD_3G = 'Good-3G' 23REGULAR_4G = 'Regular-4G' 24DSL = 'DSL' 25WIFI = 'WiFi' 26 27NETWORK_CONFIGS = { 28 NONE: _Configs(0, 0, 0), 29 GPRS: _Configs(50 * 1024 / 8, 20 * 1024 / 8, 500), 30 REGULAR_2G: _Configs(250 * 1024 / 8, 50 * 1024 / 8, 300), 31 GOOD_2G: _Configs(450 * 1024 / 8, 150 * 1024 / 8, 150), 32 REGULAR_3G: _Configs(750 * 1024 / 8, 250 * 1024 / 8, 100), 33 GOOD_3G: _Configs(1.5 * 1024 * 1024 / 8, 750 * 1024 / 8, 40), 34 REGULAR_4G: _Configs(4 * 1024 * 1024 / 8, 3 * 1024 * 1024 / 8, 20), 35 DSL: _Configs(2 * 1024 * 1024 / 8, 1 * 1024 * 1024 / 8, 5), 36 WIFI: _Configs(30 * 1024 * 1024 / 8, 15 * 1024 * 1024 / 8, 2), 37} 38