| Index: LayoutTests/inspector/styles/override-and-disable.html
|
| diff --git a/LayoutTests/inspector/styles/override-screen-size.html b/LayoutTests/inspector/styles/override-and-disable.html
|
| similarity index 72%
|
| copy from LayoutTests/inspector/styles/override-screen-size.html
|
| copy to LayoutTests/inspector/styles/override-and-disable.html
|
| index 826f1babb7c32969545f3266a8f091cb76e6b6f1..b7ff8971a803cfa9e57dfe7eb05eaa553b8ffdaa 100644
|
| --- a/LayoutTests/inspector/styles/override-screen-size.html
|
| +++ b/LayoutTests/inspector/styles/override-and-disable.html
|
| @@ -2,15 +2,15 @@
|
| <head>
|
|
|
| <style type="text/css" media="screen">
|
| -@media (max-device-width: 478px) and (max-device-height: 959px) {
|
| +@media (max-device-width: 478px) and (max-device-height: 799px) {
|
| #main { background: red; }
|
| }
|
|
|
| -@media (max-device-width: 480px) and (max-device-height: 960px) {
|
| +@media (max-device-width: 480px) and (max-device-height: 800px) {
|
| #main { background: green; }
|
| }
|
|
|
| -@media (min-device-width: 481px) and (min-device-height: 961px) {
|
| +@media (min-device-width: 481px) and (min-device-height: 801px) {
|
| #main { background: yellow; }
|
| }
|
|
|
| @@ -41,7 +41,7 @@ function getSizes()
|
|
|
| function test()
|
| {
|
| - var exceededDimension = 10000001;
|
| + var overridesEnabled = false;
|
| var originalScreenSize;
|
|
|
| function saveSizeCallback(jsonResult)
|
| @@ -64,56 +64,6 @@ function test()
|
|
|
| function step1()
|
| {
|
| - function compareSizeCallback(jsonResult)
|
| - {
|
| - // Check that the screen size reported is the same as the original one.
|
| - var result = JSON.parse(jsonResult.value);
|
| - if (result.screen !== originalScreenSize)
|
| - InspectorTest.addResult("Original size " + originalScreenSize + " not restored, found: " + result.screen);
|
| - step2();
|
| - }
|
| -
|
| - function overrideCallback()
|
| - {
|
| - InspectorTest.evaluateInPage("getSizes()", compareSizeCallback);
|
| - }
|
| -
|
| - // Disable overrides.
|
| - PageAgent.setDeviceMetricsOverride(0, 0, 1, true, overrideCallback);
|
| - }
|
| -
|
| - function step2()
|
| - {
|
| - overrideAndDumpData(800, 480, step3);
|
| - }
|
| -
|
| - function step3()
|
| - {
|
| - applyOverride(exceededDimension, 800, step4);
|
| - }
|
| -
|
| - function step4()
|
| - {
|
| - applyOverride(-1, 800, step5);
|
| - }
|
| -
|
| - function step5()
|
| - {
|
| - applyOverride(480, exceededDimension, step6);
|
| - }
|
| -
|
| - function step6()
|
| - {
|
| - function callback()
|
| - {
|
| - InspectorTest.addResult("Current dimensions:");
|
| - getAndDumpSizes(step7);
|
| - }
|
| - applyOverride(480, -1, callback);
|
| - }
|
| -
|
| - function step7()
|
| - {
|
| function callback(jsonResult)
|
| {
|
| var value = JSON.parse(jsonResult.value);
|
| @@ -121,7 +71,7 @@ function test()
|
| InspectorTest.addResult("Screen size not restored, actual: " + value.screen + ", expected: " + originalScreenSize);
|
| else
|
| InspectorTest.addResult("Screen size same as original - OK");
|
| - step8();
|
| + step2();
|
| }
|
|
|
| InspectorTest.addResult("Disable PageAgent:");
|
| @@ -129,7 +79,7 @@ function test()
|
| InspectorTest.evaluateInPage("getSizes()", callback);
|
| }
|
|
|
| - function step8()
|
| + function step2()
|
| {
|
| function callback(jsonResult)
|
| {
|
| @@ -148,13 +98,20 @@ function test()
|
|
|
| function applyOverride(width, height, userCallback)
|
| {
|
| - function callback(error)
|
| + function callback(reload, error)
|
| {
|
| if (error)
|
| InspectorTest.addResult("Override: " + width + "x" + height + " => ERROR");
|
| - userCallback();
|
| + if (reload && !error) {
|
| + InspectorTest.reloadPage(userCallback);
|
| + } else {
|
| + userCallback();
|
| + }
|
| }
|
| - PageAgent.setDeviceMetricsOverride(width, height, 1, true, callback);
|
| +
|
| + var enabled = width > 0 && height > 0;
|
| + PageAgent.setDeviceMetricsOverride(width, height, 1, true, callback.bind(null, enabled != overridesEnabled));
|
| + overridesEnabled = enabled;
|
| }
|
|
|
| function overrideAndDumpData(width, height, callback)
|
| @@ -212,7 +169,7 @@ function test()
|
|
|
| <body onload="runTest()">
|
| <p>
|
| -Tests that screen dimension overrides affect media rules, body dimensions, and window.screen.
|
| +Tests that disabling page agent cancels device metrics override.
|
| </p>
|
|
|
| <div id="main"></div>
|
|
|