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

Unified Diff: third_party/WebKit/Source/devtools/front_end/mobile_throttling/ThrottlingPresets.js

Issue 2938503002: DevTools: unify Network & CPU throttling (Closed)
Patch Set: update test Created 3 years, 5 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
Index: third_party/WebKit/Source/devtools/front_end/mobile_throttling/ThrottlingPresets.js
diff --git a/third_party/WebKit/Source/devtools/front_end/mobile_throttling/ThrottlingPresets.js b/third_party/WebKit/Source/devtools/front_end/mobile_throttling/ThrottlingPresets.js
new file mode 100644
index 0000000000000000000000000000000000000000..463ddb08572c052c677881952bd42d50e93e51bb
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/mobile_throttling/ThrottlingPresets.js
@@ -0,0 +1,99 @@
+// Copyright 2017 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.
+
+/** @enum {number} */
+MobileThrottling.CPUThrottlingRates = {
+ NoThrottling: 1,
+ MidTierMobile: 4,
+ LowEndMobile: 6,
+};
+
+/**
+ * @typedef {{
+ * title: string,
+ * description: string,
+ * network: !SDK.NetworkManager.Conditions,
+ * cpuThrottlingRate: !MobileThrottling.CPUThrottlingRates
+ * }}
+ **/
+MobileThrottling.Conditions;
+
+/** @type {!MobileThrottling.Conditions} */
+MobileThrottling.NoThrottlingConditions = {
+ title: SDK.NetworkManager.NoThrottlingConditions.title,
+ description: Common.UIString('No throttling'),
+ network: SDK.NetworkManager.NoThrottlingConditions,
+ cpuThrottlingRate: MobileThrottling.CPUThrottlingRates.NoThrottling,
+};
+
+/** @type {!MobileThrottling.Conditions} */
+MobileThrottling.OfflineConditions = {
+ title: SDK.NetworkManager.OfflineConditions.title,
+ description: Common.UIString('No internet connectivity'),
+ network: SDK.NetworkManager.OfflineConditions,
+ cpuThrottlingRate: MobileThrottling.CPUThrottlingRates.NoThrottling,
+};
+
+/** @type {!MobileThrottling.Conditions} */
+MobileThrottling.LowEndMobileConditions = {
+ title: Common.UIString('Low-end mobile'),
+ description: Common.UIString('Slow 3G & 6x CPU slowdown'),
+ network: SDK.NetworkManager.Slow3GConditions,
+ cpuThrottlingRate: MobileThrottling.CPUThrottlingRates.LowEndMobile,
+};
+
+/** @type {!MobileThrottling.Conditions} */
+MobileThrottling.MidTierMobileConditions = {
+ title: Common.UIString('Mid-tier mobile'),
+ description: Common.UIString('Fast 3G & 4x CPU slowdown'),
+ network: SDK.NetworkManager.Fast3GConditions,
+ cpuThrottlingRate: MobileThrottling.CPUThrottlingRates.MidTierMobile,
+};
+
+/**
+ * @typedef {{
+ * title: string,
+ * description: string
+ * }}
+ **/
+MobileThrottling.PlaceholderConditions;
+
+/** @type {!MobileThrottling.PlaceholderConditions} */
+MobileThrottling.CustomConditions = {
+ title: Common.UIString('Custom'),
+ description: Common.UIString('Check Network and Performance panels'),
+};
+
+/** @typedef {!{title: string, items: !Array<!SDK.NetworkManager.Conditions>}} */
+MobileThrottling.NetworkThrottlingConditionsGroup;
+
+/** @typedef {!{title: string, items: !Array<!MobileThrottling.Conditions|!MobileThrottling.PlaceholderConditions>}} */
+MobileThrottling.MobileThrottlingConditionsGroup;
+
+/** @typedef {!Array<?MobileThrottling.Conditions|!MobileThrottling.PlaceholderConditions>} */
+MobileThrottling.ConditionsList;
+
+/** @type {!Array.<!MobileThrottling.Conditions>} */
+MobileThrottling.mobilePresets = [
+ MobileThrottling.MidTierMobileConditions, MobileThrottling.LowEndMobileConditions, MobileThrottling.CustomConditions
+];
+
+/** @type {!Array.<!MobileThrottling.Conditions>} */
+MobileThrottling.advancedMobilePresets = [
+ MobileThrottling.OfflineConditions,
+];
+
+/** @type {!Array<!SDK.NetworkManager.Conditions>} */
+MobileThrottling.networkPresets = [
+ SDK.NetworkManager.Fast3GConditions,
+ SDK.NetworkManager.Slow3GConditions,
+ SDK.NetworkManager.OfflineConditions,
+];
+
+/** @type {!Array<!MobileThrottling.CPUThrottlingRates>} */
+MobileThrottling.cpuThrottlingPresets = [
+ MobileThrottling.CPUThrottlingRates.NoThrottling,
+ MobileThrottling.CPUThrottlingRates.MidTierMobile,
+ MobileThrottling.CPUThrottlingRates.LowEndMobile,
+];

Powered by Google App Engine
This is Rietveld 408576698