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

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

Issue 530653002: Use page popup pixel readback for calendar-picker-appearance.html (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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..b6d0c1d4120702e98a0b05b2e719e9e56ea96a20 100644
--- a/LayoutTests/fast/forms/calendar-picker/calendar-picker-appearance.html
+++ b/LayoutTests/fast/forms/calendar-picker/calendar-picker-appearance.html
@@ -2,20 +2,38 @@
<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>
tkent 2014/09/29 06:20:45 We should have additional utility JS functions to
keishi 2014/09/29 12:48:44 Done.
-<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);
+ window.internals.pagePopupWindow.addEventListener("didOpenPicker", callback, false);
+}
+
+// Move window to the top left of available space.
+window.moveTo();
+openPicker(document.getElementById('date'), function () {
+ // 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();
+ finishJSTest();
+});
+
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698