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

Unified Diff: LayoutTests/fast/forms/calendar-picker/calendar-picker-appearance.html

Issue 513723003: Add pixel readback to page popup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/forms/calendar-picker/calendar-picker-appearance.html
diff --git a/LayoutTests/fast/forms/calendar-picker/calendar-picker-appearance.html b/LayoutTests/fast/forms/calendar-picker/calendar-picker-appearance.html
index 2f3f00437417152eb8c4d02f437a95c0947afff6..2b4eca5cdd8188b776a64b1e382ce621e4195e5d 100644
--- a/LayoutTests/fast/forms/calendar-picker/calendar-picker-appearance.html
+++ b/LayoutTests/fast/forms/calendar-picker/calendar-picker-appearance.html
@@ -2,20 +2,47 @@
<html>
<head>
<script>
+window.jsTestIsAsync = true;
window.enablePixelTesting = true;
</script>
<script src="../../../resources/js-test.js"></script>
-<script src="../../forms/resources/picker-common.js"></script>
-<script src="resources/calendar-picker-common.js"></script>
</head>
<body>
<input type=date id=date value="10000-12-31">
-
<p id="description" style="opacity: 0"></p>
<div id="console" style="opacity: 0"></div>
-
<script>
-openPicker(document.getElementById('date'), finishJSTest);
+function sendKey(input, keyName, ctrlKey, altKey) {
+ var event = document.createEvent('KeyboardEvent');
+ event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName, 0, ctrlKey, altKey);
+ input.dispatchEvent(event);
+}
+
+function openPicker(input, callback) {
+ input.offsetTop; // Force layout.
+ sendKey(input, "Down", false, true);
+ callback.call(this);
+}
+
+function finishWhenOpen() {
+ // We need to keep moving the window to the top left of available space
+ // because the window will move back to (0, 0) when the
+ // ShellViewMsg_SetTestConfiguration IPC arrives.
+ window.moveTo();
+ // FIXME: resize event isn't firing in layout tests so we need to use a
+ // timer to check if the popup is ready.
+ if (window.internals.pagePopupWindow.innerWidth)
+ finishJSTest();
+ else
+ setTimeout(finishWhenOpen, 0);
+}
+
+// Move window to the top left of available space.
+window.moveTo();
+openPicker(document.getElementById('date'), function () {
+ finishWhenOpen();
+});
+
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698