Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / frames / resources / frame-programmatic-resize.js
blobe762ab0fec6721ad3d43692e2f4e123cb55b2b21
1 var _testFrame;
2 var _testFrameId; // We keep the id of the test frame to make it easier for a person to interpret the test results.
4 function setTestFrameById(id)
6 _testFrameId = id;
7 _testFrame = document.getElementById(id);
10 function deltaWidth()
12 return 10; // A resonable amount to be able to detect that the frame width changed.
15 function shouldAllowFrameResize()
17 shouldAllowFrameResizeAfterProcessingFrame(function(frame) { /* Do nothing. */});
20 function shouldDisallowFrameResize()
22 shouldDisallowFrameResizeAfterProcessingFrame(function(frame) { /* Do nothing. */})
25 function shouldDisallowFrameResizeAfterProcessingFrame(processFrameFunction)
27 var expectedWidth = _testFrame.getBoundingClientRect().width;
28 processFrameFunction(_testFrame);
29 resizeTestFrameBy(deltaWidth());
30 checkTestFrameWidthEquals(expectedWidth);
33 function shouldAllowFrameResizeAfterProcessingFrame(processFrameFunction)
35 var expectedWidth = _testFrame.getBoundingClientRect().width + deltaWidth();
36 processFrameFunction(_testFrame);
37 resizeTestFrameBy(deltaWidth());
38 checkTestFrameWidthEquals(expectedWidth);
41 function checkTestFrameWidthEquals(expectedWidth)
43 if (_testFrame.getBoundingClientRect().width === expectedWidth)
44 log('PASS document.getElementById("' + _testFrameId + '").getBoundingClientRect().width is ' + expectedWidth);
45 else
46 log('FAIL document.getElementById("' + _testFrameId + '").getBoundingClientRect().width should be ' + expectedWidth + '. Was ' + _testFrame.getBoundingClientRect().width + '.');
49 function resizeTestFrameBy(deltaWidthInPixels)
51 var borderWidth = parseInt(_testFrame.parentNode.getAttribute("border"));
53 var startX = _testFrame.offsetWidth + borderWidth / 2;
54 var startY = _testFrame.offsetHeight / 2;
55 var endX = startX + deltaWidthInPixels;
56 var endY = startY;
58 eventSender.mouseMoveTo(startX, startY);
59 eventSender.mouseDown();
60 eventSender.leapForward(100);
61 eventSender.mouseMoveTo(endX, endY);
62 eventSender.mouseUp();
65 function log(message)
67 document.getElementById("results").contentDocument.getElementById("console").appendChild(document.createTextNode(message + "\n"));
70 function description(message)
72 document.getElementById("results").contentDocument.getElementById("description").innerText = message;