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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js

Issue 2087293003: [DevTools] Network.emulateNetworkConditions now affects NetworkStateNotifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed review comments Created 4 years, 6 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/sdk/NetworkManager.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js
index ab95c758b722495ebcd2024430d717ca8197d62f..4e96bf0490b14b692561dbb5edc0b8d21cf29b92 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js
@@ -88,6 +88,32 @@ WebInspector.NetworkManager.NoThrottlingConditions = {title: WebInspector.UIStri
/** @type {!WebInspector.NetworkManager.Conditions} */
WebInspector.NetworkManager.OfflineConditions = {title: WebInspector.UIString("Offline"), download: 0, upload: 0, latency: 0};
+/**
+ * @param {!WebInspector.NetworkManager.Conditions} conditions
+ * @return {!NetworkAgent.ConnectionType}
+ */
+WebInspector.NetworkManager._connectionType = function(conditions)
+{
+ if (!conditions.download && !conditions.upload)
+ return NetworkAgent.ConnectionType.None;
+ var types = WebInspector.NetworkManager._connectionTypes;
+ if (!types) {
+ WebInspector.NetworkManager._connectionTypes = [];
+ types = WebInspector.NetworkManager._connectionTypes;
allada 2016/06/28 22:34:15 I think these should be classified in: WebInspecto
dgozman 2016/06/29 01:17:33 Added a TODO.
+ types.push(["2g", NetworkAgent.ConnectionType.Cellular2g]);
+ types.push(["3g", NetworkAgent.ConnectionType.Cellular3g]);
+ types.push(["4g", NetworkAgent.ConnectionType.Cellular4g]);
+ types.push(["bluetooth", NetworkAgent.ConnectionType.Bluetooth]);
+ types.push(["wifi", NetworkAgent.ConnectionType.Wifi]);
+ types.push(["wimax", NetworkAgent.ConnectionType.Wimax]);
+ }
+ for (var type of types) {
+ if (conditions.title.toLowerCase().indexOf(type[0]) !== -1)
+ return type[1];
+ }
+ return NetworkAgent.ConnectionType.Other;
+}
+
WebInspector.NetworkManager.prototype = {
/**
* @param {string} url
@@ -774,7 +800,7 @@ WebInspector.MultitargetNetworkManager.prototype = {
if (!this.isThrottling()) {
networkAgent.emulateNetworkConditions(false, 0, 0, 0);
} else {
- networkAgent.emulateNetworkConditions(this.isOffline(), conditions.latency, conditions.download < 0 ? 0 : conditions.download, conditions.upload < 0 ? 0 : conditions.upload);
+ networkAgent.emulateNetworkConditions(this.isOffline(), conditions.latency, conditions.download < 0 ? 0 : conditions.download, conditions.upload < 0 ? 0 : conditions.upload, WebInspector.NetworkManager._connectionType(conditions));
}
},

Powered by Google App Engine
This is Rietveld 408576698