Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 // Regression test for crbug.com/370035. | 613 // Regression test for crbug.com/370035. |
| 614 TestSuite.prototype.testDeviceMetricsOverrides = function() { | 614 TestSuite.prototype.testDeviceMetricsOverrides = function() { |
| 615 function dumpPageMetrics() { | 615 function dumpPageMetrics() { |
| 616 return JSON.stringify( | 616 return JSON.stringify( |
| 617 {width: window.innerWidth, height: window.innerHeight, deviceScaleFact or: window.devicePixelRatio}); | 617 {width: window.innerWidth, height: window.innerHeight, deviceScaleFact or: window.devicePixelRatio}); |
| 618 } | 618 } |
| 619 | 619 |
| 620 var test = this; | 620 var test = this; |
| 621 | 621 |
| 622 async function testOverrides(params, metrics, callback) { | 622 async function testOverrides(params, metrics, callback) { |
| 623 await SDK.targetManager.mainTarget().emulationAgent().invoke_setDeviceMetr icsOverride(params); | 623 await SDK.targetManager.mainTarget()._dispatcher.emulationAgent().invoke_s etDeviceMetricsOverride(params); |
| 624 test.evaluateInConsole_('(' + dumpPageMetrics.toString() + ')()', checkMet rics); | 624 test.evaluateInConsole_('(' + dumpPageMetrics.toString() + ')()', checkMet rics); |
| 625 | 625 |
| 626 function checkMetrics(consoleResult) { | 626 function checkMetrics(consoleResult) { |
| 627 test.assertEquals( | 627 test.assertEquals( |
| 628 '"' + JSON.stringify(metrics) + '"', consoleResult, 'Wrong metrics f or params: ' + JSON.stringify(params)); | 628 '"' + JSON.stringify(metrics) + '"', consoleResult, 'Wrong metrics f or params: ' + JSON.stringify(params)); |
| 629 callback(); | 629 callback(); |
| 630 } | 630 } |
| 631 } | 631 } |
| 632 | 632 |
| 633 function step1() { | 633 function |
| 634 step1() { | |
|
caseq
2017/04/29 02:12:53
here and below -- revert.
| |
| 634 testOverrides( | 635 testOverrides( |
| 635 {width: 1200, height: 1000, deviceScaleFactor: 1, mobile: false, fitWi ndow: true}, | 636 {width: 1200, height: 1000, deviceScaleFactor: 1, mobile: false, fitWi ndow: true}, |
| 636 {width: 1200, height: 1000, deviceScaleFactor: 1}, step2); | 637 {width: 1200, height: 1000, deviceScaleFactor: 1}, step2); |
| 637 } | 638 } |
| 638 | 639 |
| 639 function step2() { | 640 function |
| 641 step2() { | |
| 640 testOverrides( | 642 testOverrides( |
| 641 {width: 1200, height: 1000, deviceScaleFactor: 1, mobile: false, fitWi ndow: false}, | 643 {width: 1200, height: 1000, deviceScaleFactor: 1, mobile: false, fitWi ndow: false}, |
| 642 {width: 1200, height: 1000, deviceScaleFactor: 1}, step3); | 644 {width: 1200, height: 1000, deviceScaleFactor: 1}, step3); |
| 643 } | 645 } |
| 644 | 646 |
| 645 function step3() { | 647 function |
| 648 step3() { | |
| 646 testOverrides( | 649 testOverrides( |
| 647 {width: 1200, height: 1000, deviceScaleFactor: 3, mobile: false, fitWi ndow: true}, | 650 {width: 1200, height: 1000, deviceScaleFactor: 3, mobile: false, fitWi ndow: true}, |
| 648 {width: 1200, height: 1000, deviceScaleFactor: 3}, step4); | 651 {width: 1200, height: 1000, deviceScaleFactor: 3}, step4); |
| 649 } | 652 } |
| 650 | 653 |
| 651 function step4() { | 654 function |
| 655 step4() { | |
| 652 testOverrides( | 656 testOverrides( |
| 653 {width: 1200, height: 1000, deviceScaleFactor: 3, mobile: false, fitWi ndow: false}, | 657 {width: 1200, height: 1000, deviceScaleFactor: 3, mobile: false, fitWi ndow: false}, |
| 654 {width: 1200, height: 1000, deviceScaleFactor: 3}, finish); | 658 {width: 1200, height: 1000, deviceScaleFactor: 3}, finish); |
| 655 } | 659 } |
| 656 | 660 |
| 657 function finish() { | 661 function |
| 662 finish() { | |
| 658 test.releaseControl(); | 663 test.releaseControl(); |
| 659 } | 664 } |
| 660 | 665 |
| 661 test.takeControl(); | 666 test.takeControl(); |
| 662 step1(); | 667 step1(); |
| 663 }; | 668 }; |
| 664 | 669 |
| 665 TestSuite.prototype.testDispatchKeyEventDoesNotCrash = function() { | 670 TestSuite.prototype.testDispatchKeyEventDoesNotCrash = function() { |
| 666 SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent( | 671 SDK.targetManager.mainTarget()._dispatcher.inputAgent().invoke_dispatchKeyEv ent( |
| 667 {type: 'rawKeyDown', windowsVirtualKeyCode: 0x23, key: 'End'}); | 672 {type: 'rawKeyDown', windowsVirtualKeyCode: 0x23, key: 'End'}); |
| 668 SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent( | 673 SDK.targetManager.mainTarget()._dispatcher.inputAgent().invoke_dispatchKeyEv ent( |
| 669 {type: 'keyUp', windowsVirtualKeyCode: 0x23, key: 'End'}); | 674 {type: 'keyUp', windowsVirtualKeyCode: 0x23, key: 'End'}); |
| 670 }; | 675 }; |
| 671 | 676 |
| 672 TestSuite.prototype.testEmulateNetworkConditions = function() { | 677 TestSuite.prototype.testEmulateNetworkConditions = function() { |
| 673 var test = this; | 678 var test = this; |
| 674 | 679 |
| 675 function testPreset(preset, messages, next) { | 680 function testPreset(preset, messages, next) { |
| 676 function onConsoleMessage(event) { | 681 function onConsoleMessage(event) { |
| 677 var index = messages.indexOf(event.data.messageText); | 682 var index = messages.indexOf(event.data.messageText); |
| 678 if (index === -1) { | 683 if (index === -1) { |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1100 if (runtimeModel.executionContexts().length >= n) | 1105 if (runtimeModel.executionContexts().length >= n) |
| 1101 callback.call(null); | 1106 callback.call(null); |
| 1102 else | 1107 else |
| 1103 this.addSniffer(SDK.RuntimeModel.prototype, '_executionContextCreated', checkForExecutionContexts.bind(this)); | 1108 this.addSniffer(SDK.RuntimeModel.prototype, '_executionContextCreated', checkForExecutionContexts.bind(this)); |
| 1104 } | 1109 } |
| 1105 }; | 1110 }; |
| 1106 | 1111 |
| 1107 | 1112 |
| 1108 window.uiTests = new TestSuite(window.domAutomationController); | 1113 window.uiTests = new TestSuite(window.domAutomationController); |
| 1109 })(window); | 1114 })(window); |
| OLD | NEW |