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

Unified Diff: third_party/WebKit/Source/devtools/front_end/mobile_throttling/ThrottlingSettingsTab.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/ThrottlingSettingsTab.js
diff --git a/third_party/WebKit/Source/devtools/front_end/mobile_throttling/NetworkConditionsSettingsTab.js b/third_party/WebKit/Source/devtools/front_end/mobile_throttling/ThrottlingSettingsTab.js
similarity index 88%
rename from third_party/WebKit/Source/devtools/front_end/mobile_throttling/NetworkConditionsSettingsTab.js
rename to third_party/WebKit/Source/devtools/front_end/mobile_throttling/ThrottlingSettingsTab.js
index a8a86fc1f8d3037c24f22353b394fa0665ec037b..4c31ac201417f2fd9e47de6fd7ac2ed59e93813f 100644
--- a/third_party/WebKit/Source/devtools/front_end/mobile_throttling/NetworkConditionsSettingsTab.js
+++ b/third_party/WebKit/Source/devtools/front_end/mobile_throttling/ThrottlingSettingsTab.js
@@ -6,10 +6,10 @@
* @implements {UI.ListWidget.Delegate}
* @unrestricted
*/
-MobileThrottling.NetworkConditionsSettingsTab = class extends UI.VBox {
+MobileThrottling.ThrottlingSettingsTab = class extends UI.VBox {
constructor() {
super(true);
- this.registerRequiredCSS('mobile_throttling/networkConditionsSettingsTab.css');
+ this.registerRequiredCSS('mobile_throttling/throttlingSettingsTab.css');
this.contentElement.createChild('div', 'header').textContent = Common.UIString('Network Throttling Profiles');
@@ -19,7 +19,7 @@ MobileThrottling.NetworkConditionsSettingsTab = class extends UI.VBox {
this._list = new UI.ListWidget(this);
this._list.element.classList.add('conditions-list');
- this._list.registerRequiredCSS('mobile_throttling/networkConditionsSettingsTab.css');
+ this._list.registerRequiredCSS('mobile_throttling/throttlingSettingsTab.css');
this._list.show(this.contentElement);
this._customSetting = Common.moduleSetting('customNetworkConditions');
@@ -66,10 +66,9 @@ MobileThrottling.NetworkConditionsSettingsTab = class extends UI.VBox {
titleText.title = conditions.title;
element.createChild('div', 'conditions-list-separator');
element.createChild('div', 'conditions-list-text').textContent =
- MobileThrottling.NetworkConditionsSelector.throughputText(conditions.download);
+ MobileThrottling.throughputText(conditions.download);
element.createChild('div', 'conditions-list-separator');
- element.createChild('div', 'conditions-list-text').textContent =
- MobileThrottling.NetworkConditionsSelector.throughputText(conditions.upload);
+ element.createChild('div', 'conditions-list-text').textContent = MobileThrottling.throughputText(conditions.upload);
element.createChild('div', 'conditions-list-separator');
element.createChild('div', 'conditions-list-text').textContent = Common.UIString('%dms', conditions.latency);
return element;
@@ -199,3 +198,20 @@ MobileThrottling.NetworkConditionsSettingsTab = class extends UI.VBox {
}
}
};
+
+/**
+ * @param {number} throughput
+ * @param {boolean=} plainText
+ * @return {string}
+ */
+MobileThrottling.throughputText = function(throughput, plainText) {
+ if (throughput < 0)
+ return '';
+ var throughputInKbps = throughput / (1024 / 8);
+ var delimiter = plainText ? '' : ' ';
+ if (throughputInKbps < 1024)
+ return Common.UIString('%d%skb/s', throughputInKbps, delimiter);
+ if (throughputInKbps < 1024 * 10)
+ return Common.UIString('%.1f%sMb/s', throughputInKbps / 1024, delimiter);
+ return Common.UIString('%d%sMb/s', (throughputInKbps / 1024) | 0, delimiter);
+};

Powered by Google App Engine
This is Rietveld 408576698