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

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

Issue 2938503002: DevTools: unify Network & CPU throttling (Closed)
Patch Set: rebaseline 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 unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <head>
3 <title> Change mobile throttling setting.</title>
4 <script src = "../../http/tests/inspector/inspector-test.js"></script>
5 <script>
6
7 function initialize_ThrottlingTest() {
8 InspectorTest.preloadPanel("network");
9 InspectorTest.preloadPanel("timeline");
10 UI.viewManager.showView("network.config");
11 }
12
13 function test() {
14 var deviceModeView = new Emulation.DeviceModeView();
15
16 var deviceModeThrottling = deviceModeView._toolbar._throttlingConditionsItem;
17 var networkPanelThrottling = UI.panels.network._throttlingRefForTest;
18 var networkPanelOfflineCheckbox = UI.panels.network._offlineCheckboxRefForTest .inputElement;
19 var networkConditionsDrawerThrottlingSelector =
20 self.runtime.sharedInstance(Network.NetworkConfigView)._networkThrottlingR efForTest;
21 var performancePanelNetworkThrottling = UI.panels.timeline._networkThrottlingR efForTest;
22 var performancePanelCPUThrottling = UI.panels.timeline._cpuThrottlingRefForTes t;
23
24 function dumpThrottlingState() {
25 InspectorTest.addResult('=== THROTTLING STATE ===');
26 var {download, upload, latency} = SDK.multitargetNetworkManager.networkCondi tions();
27 InspectorTest.addResult(`Network throttling - download: ${download} upload: ${upload} latency: ${latency}`);
28 InspectorTest.addResult('CPU throttling rate: ' +
29 MobileThrottling.cpuThrottlingRateSetting().get());
30 InspectorTest.addResult('Device mode throttling: ' + deviceModeThrottling._t ext);
31 InspectorTest.addResult('Network panel offline checkbox: ' +
32 networkPanelOfflineCheckbox.checked);
33 InspectorTest.addResult('Network panel throttling: ' +
34 networkPanelThrottling.selectedOption().text);
35 InspectorTest.addResult('Network conditions drawer throttling: ' +
36 networkConditionsDrawerThrottlingSelector.value);
37 InspectorTest.addResult('Performance panel network throttling: ' +
38 performancePanelNetworkThrottling.selectedOption().t ext);
39 InspectorTest.addResult('Performance panel CPU throttling: ' +
40 performancePanelCPUThrottling.selectedOption().text) ;
41 InspectorTest.addResult('========================\n');
42 }
43
44 InspectorTest.addResult('Initial throttling state');
45 dumpThrottlingState();
46
47 InspectorTest.addResult('Change to low-end mobile in device mode');
48 SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.LowEndMobi leConditions);
49 MobileThrottling.cpuThrottlingRateSetting().set(
50 MobileThrottling.LowEndMobileConditions.cpuThrottlingRate);
51 dumpThrottlingState();
52
53 InspectorTest.addResult('Change network to Fast 3G');
54 SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Fast3GCo nditions);
55 dumpThrottlingState();
56
57 InspectorTest.addResult('Toggle network offline checkbox (enable offline)');
58 networkPanelOfflineCheckbox.click();
59 dumpThrottlingState();
60
61 InspectorTest.addResult('Toggle network offline checkbox (disable offline)');
62 networkPanelOfflineCheckbox.click();
63 dumpThrottlingState();
64
65 InspectorTest.addResult('Change to mid-tier mobile in device mode');
66 SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.MidTierMob ileConditions);
67 MobileThrottling.cpuThrottlingRateSetting().set(
68 MobileThrottling.MidTierMobileConditions.cpuThrottlingRate);
69 dumpThrottlingState();
70
71 InspectorTest.addResult('Change CPU throttling to low-end mobile');
72 MobileThrottling.cpuThrottlingRateSetting().set(MobileThrottling.CPUThrottling Rates.LowEndMobile);
73 dumpThrottlingState();
74
75 InspectorTest.addResult('Change CPU throttling to mid-tier mobile');
76 MobileThrottling.cpuThrottlingRateSetting().set(
77 MobileThrottling.CPUThrottlingRates.MidTierMobile);
78 dumpThrottlingState();
79
80 InspectorTest.addResult('Change to offline in device mode');
81 SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.OfflineCon ditions);
82 MobileThrottling.cpuThrottlingRateSetting().set(
83 MobileThrottling.OfflineConditions.cpuThrottlingRate);
84 dumpThrottlingState();
85
86 InspectorTest.addResult('Toggle network offline checkbox');
87 networkPanelOfflineCheckbox.click();
88 dumpThrottlingState();
89
90 InspectorTest.addResult('Change to no throttling in device mode');
91 SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.NoThrottli ngConditions);
92 MobileThrottling.cpuThrottlingRateSetting().set(
93 MobileThrottling.NoThrottlingConditions.cpuThrottlingRate);
94 dumpThrottlingState();
95
96 InspectorTest.completeTest();
97 }
98
99 </script>
100 </head>
101 <body onload="runTest()">
102 <p>
103 Tests that mobile, network, and CPU throttling interact with each other lo gically.
104 </p>
105 </body>
106 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698