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

Unified Diff: third_party/WebKit/LayoutTests/inspector/throttling/mobile-throttling.html

Issue 2938503002: DevTools: unify Network & CPU throttling (Closed)
Patch Set: rebaseline Created 3 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/LayoutTests/inspector/throttling/mobile-throttling.html
diff --git a/third_party/WebKit/LayoutTests/inspector/throttling/mobile-throttling.html b/third_party/WebKit/LayoutTests/inspector/throttling/mobile-throttling.html
new file mode 100644
index 0000000000000000000000000000000000000000..ce8fd2612b5eedb4700b81508e90615305f5274e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/throttling/mobile-throttling.html
@@ -0,0 +1,106 @@
+<html>
+<head>
+<title> Change mobile throttling setting.</title>
+<script src = "../../http/tests/inspector/inspector-test.js"></script>
+<script>
+
+function initialize_ThrottlingTest() {
+ InspectorTest.preloadPanel("network");
+ InspectorTest.preloadPanel("timeline");
+ UI.viewManager.showView("network.config");
+}
+
+function test() {
+ var deviceModeView = new Emulation.DeviceModeView();
+
+ var deviceModeThrottling = deviceModeView._toolbar._throttlingConditionsItem;
+ var networkPanelThrottling = UI.panels.network._throttlingRefForTest;
+ var networkPanelOfflineCheckbox = UI.panels.network._offlineCheckboxRefForTest.inputElement;
+ var networkConditionsDrawerThrottlingSelector =
+ self.runtime.sharedInstance(Network.NetworkConfigView)._networkThrottlingRefForTest;
+ var performancePanelNetworkThrottling = UI.panels.timeline._networkThrottlingRefForTest;
+ var performancePanelCPUThrottling = UI.panels.timeline._cpuThrottlingRefForTest;
+
+ function dumpThrottlingState() {
+ InspectorTest.addResult('=== THROTTLING STATE ===');
+ var {download, upload, latency} = SDK.multitargetNetworkManager.networkConditions();
+ InspectorTest.addResult(`Network throttling - download: ${download} upload: ${upload} latency: ${latency}`);
+ InspectorTest.addResult('CPU throttling rate: ' +
+ MobileThrottling.cpuThrottlingRateSetting().get());
+ InspectorTest.addResult('Device mode throttling: ' + deviceModeThrottling._text);
+ InspectorTest.addResult('Network panel offline checkbox: ' +
+ networkPanelOfflineCheckbox.checked);
+ InspectorTest.addResult('Network panel throttling: ' +
+ networkPanelThrottling.selectedOption().text);
+ InspectorTest.addResult('Network conditions drawer throttling: ' +
+ networkConditionsDrawerThrottlingSelector.value);
+ InspectorTest.addResult('Performance panel network throttling: ' +
+ performancePanelNetworkThrottling.selectedOption().text);
+ InspectorTest.addResult('Performance panel CPU throttling: ' +
+ performancePanelCPUThrottling.selectedOption().text);
+ InspectorTest.addResult('========================\n');
+ }
+
+ InspectorTest.addResult('Initial throttling state');
+ dumpThrottlingState();
+
+ InspectorTest.addResult('Change to low-end mobile in device mode');
+ SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.LowEndMobileConditions);
+ MobileThrottling.cpuThrottlingRateSetting().set(
+ MobileThrottling.LowEndMobileConditions.cpuThrottlingRate);
+ dumpThrottlingState();
+
+ InspectorTest.addResult('Change network to Fast 3G');
+ SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Fast3GConditions);
+ dumpThrottlingState();
+
+ InspectorTest.addResult('Toggle network offline checkbox (enable offline)');
+ networkPanelOfflineCheckbox.click();
+ dumpThrottlingState();
+
+ InspectorTest.addResult('Toggle network offline checkbox (disable offline)');
+ networkPanelOfflineCheckbox.click();
+ dumpThrottlingState();
+
+ InspectorTest.addResult('Change to mid-tier mobile in device mode');
+ SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.MidTierMobileConditions);
+ MobileThrottling.cpuThrottlingRateSetting().set(
+ MobileThrottling.MidTierMobileConditions.cpuThrottlingRate);
+ dumpThrottlingState();
+
+ InspectorTest.addResult('Change CPU throttling to low-end mobile');
+ MobileThrottling.cpuThrottlingRateSetting().set(MobileThrottling.CPUThrottlingRates.LowEndMobile);
+ dumpThrottlingState();
+
+ InspectorTest.addResult('Change CPU throttling to mid-tier mobile');
+ MobileThrottling.cpuThrottlingRateSetting().set(
+ MobileThrottling.CPUThrottlingRates.MidTierMobile);
+ dumpThrottlingState();
+
+ InspectorTest.addResult('Change to offline in device mode');
+ SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.OfflineConditions);
+ MobileThrottling.cpuThrottlingRateSetting().set(
+ MobileThrottling.OfflineConditions.cpuThrottlingRate);
+ dumpThrottlingState();
+
+ InspectorTest.addResult('Toggle network offline checkbox');
+ networkPanelOfflineCheckbox.click();
+ dumpThrottlingState();
+
+ InspectorTest.addResult('Change to no throttling in device mode');
+ SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.NoThrottlingConditions);
+ MobileThrottling.cpuThrottlingRateSetting().set(
+ MobileThrottling.NoThrottlingConditions.cpuThrottlingRate);
+ dumpThrottlingState();
+
+ InspectorTest.completeTest();
+}
+
+</script>
+</head>
+<body onload="runTest()">
+ <p>
+ Tests that mobile, network, and CPU throttling interact with each other logically.
+ </p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698