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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/resources/device-emulator.js

Issue 2960023003: [DevTools] Migrate inspector-protocol/emulation tests to new harness (Closed)
Patch Set: 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 (class DeviceEmulator {
2 constructor(testRunner, session) {
3 this._testRunner = testRunner;
4 this._session = session;
5 }
6
7 async emulate(width, height, deviceScaleFactor, insets) {
8 this._testRunner.log(`Emulating device: ${width}x${height}x${deviceScaleFact or}`);
9 var full = !!width && !!height && !!deviceScaleFactor;
10 var params = {
11 width,
12 height,
13 deviceScaleFactor,
14 mobile: true,
15 fitWindow: false,
16 scale: 1,
17 screenWidth: width,
18 screenHeight: height,
19 positionX: 0,
20 positionY: 0
21 };
22 if (insets) {
23 params.screenWidth += insets.left + insets.right;
24 params.positionX = insets.left;
25 params.screenHeight += insets.top + insets.bottom;
26 params.positionY = insets.top;
27 }
28 var response = await this._session.protocol.Emulation.setDeviceMetricsOverri de(params);
29 if (response.error)
30 this._testRunner.log('Error: ' + response.error);
31 }
32
33 async clear() {
34 await this._session.protocol.Emulation.clearDeviceMetricsOverride();
35 }
36 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698