3 <meta name=
"viewport" content=
"width=800">
4 <script src=
"../http/tests/inspector/inspector-test.js"></script>
6 html { font-size:
16px; }
7 body { width:
800px; margin:
0; overflow-y: hidden; }
11 window
.internals
.settings
.setTextAutosizingWindowSizeOverride(320, 480);
13 function getAutosizing()
15 return JSON
.stringify({ textHeight
: document
.getElementById('measure').offsetHeight
});
20 function assertAutosizingResult(expected
, callback
)
22 function resultCallback(jsonResult
) {
23 var result
= JSON
.parse(jsonResult
.value
);
24 var actual
= result
.textHeight
> 200;
25 InspectorTest
.addResult('Text ' + (actual
? 'was' : 'was not') + ' autosized. ' + (expected
== actual
? 'PASS' : 'FAIL'));
29 InspectorTest
.evaluateInPage("getAutosizing()", resultCallback
);
32 InspectorTest
.runTestSuite([
33 function checkNotAutosizedWithoutPageAgent(next
)
35 InspectorTest
.PageAgent
.disable();
36 assertAutosizingResult(false, next
);
39 function checkNotAutosizedWithPageAgent(next
)
41 InspectorTest
.PageAgent
.enable();
42 assertAutosizingResult(false, next
);
45 function checkNotAutosizedWithZeroDeviceMetrics(next
)
47 InspectorTest
.PageAgent
.invoke_setDeviceMetricsOverride({width
: 0, height
: 0, deviceScaleFactor
: 0, mobile
: false, fitWindow
: true});
48 assertAutosizingResult(false, next
);
51 function checkAutosizedWhenDeviceMetrics(next
)
53 InspectorTest
.PageAgent
.invoke_setDeviceMetricsOverride({width
: 320, height
: 480, deviceScaleFactor
: 0, mobile
: true, fitWindow
: true});
54 assertAutosizingResult(true, next
);
57 function checkCleanupOverrides(next
)
59 InspectorTest
.PageAgent
.clearDeviceMetricsOverride();
60 assertAutosizingResult(false);
61 InspectorTest
.evaluateInPage("document.getElementById('measure').remove();", next
);
67 <body onload=
"runTest()">
69 This text should be autosized to
40px computed font-size (
16 *
800/
320).
<br/>
70 FAIL IF THIS IS VISIBLE
<br/>
71 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.