| OLD | NEW |
| (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._throttlingSelect; |
| 18 var networkPanelOfflineCheckbox = UI.panels.network._offlineCheckbox.inputElem
ent; |
| 19 var networkConditionsDrawerThrottlingSelector = |
| 20 self.runtime.sharedInstance(Network.NetworkConfigView)._networkThrottlingS
elect; |
| 21 var performancePanelNetworkThrottling = UI.panels.timeline._networkThrottlingS
elect; |
| 22 var performancePanelCPUThrottling = UI.panels.timeline._cpuThrottlingSelect; |
| 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.throttlingManager().cpuThrottlingRa
te()); |
| 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 offline in device mode'); |
| 48 SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.OfflineCon
ditions.network); |
| 49 MobileThrottling.throttlingManager().setCPUThrottlingRate( |
| 50 MobileThrottling.OfflineConditions.cpuThrottlingRate); |
| 51 dumpThrottlingState(); |
| 52 |
| 53 InspectorTest.addResult('Toggle network offline checkbox'); |
| 54 networkPanelOfflineCheckbox.click(); |
| 55 dumpThrottlingState(); |
| 56 |
| 57 InspectorTest.addResult('Change to low-end mobile in device mode'); |
| 58 SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.LowEndMobi
leConditions.network); |
| 59 MobileThrottling.throttlingManager().setCPUThrottlingRate( |
| 60 MobileThrottling.LowEndMobileConditions.cpuThrottlingRate); |
| 61 dumpThrottlingState(); |
| 62 |
| 63 InspectorTest.addResult('Change network to Fast 3G'); |
| 64 SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Fast3GCo
nditions); |
| 65 dumpThrottlingState(); |
| 66 |
| 67 InspectorTest.addResult('Toggle network offline checkbox (enable offline)'); |
| 68 networkPanelOfflineCheckbox.click(); |
| 69 dumpThrottlingState(); |
| 70 |
| 71 InspectorTest.addResult('Toggle network offline checkbox (disable offline)'); |
| 72 networkPanelOfflineCheckbox.click(); |
| 73 dumpThrottlingState(); |
| 74 |
| 75 InspectorTest.addResult('Change to mid-tier mobile in device mode'); |
| 76 SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.MidTierMob
ileConditions.network); |
| 77 MobileThrottling.throttlingManager().setCPUThrottlingRate( |
| 78 MobileThrottling.MidTierMobileConditions.cpuThrottlingRate); |
| 79 dumpThrottlingState(); |
| 80 |
| 81 InspectorTest.addResult('Change CPU throttling to low-end mobile'); |
| 82 MobileThrottling.throttlingManager().setCPUThrottlingRate(MobileThrottling.CPU
ThrottlingRates.LowEndMobile); |
| 83 dumpThrottlingState(); |
| 84 |
| 85 InspectorTest.addResult('Change CPU throttling to mid-tier mobile'); |
| 86 MobileThrottling.throttlingManager().setCPUThrottlingRate( |
| 87 MobileThrottling.CPUThrottlingRates.MidTierMobile); |
| 88 dumpThrottlingState(); |
| 89 |
| 90 InspectorTest.addResult('Change to no throttling in device mode'); |
| 91 SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.NoThrottli
ngConditions.network); |
| 92 MobileThrottling.throttlingManager().setCPUThrottlingRate( |
| 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> |
| OLD | NEW |