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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/misc/resources/cross-origin-subframe-for-scrolling.html

Issue 2642723009: Improve cross-origin-subframe-for-scrolling layout test (Closed)
Patch Set: Added an assert_unreached clause for invalid messages Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/misc/scroll-cross-origin-iframes.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/misc/resources/cross-origin-subframe-for-scrolling.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/misc/resources/cross-origin-subframe-for-scrolling.html b/third_party/WebKit/LayoutTests/http/tests/misc/resources/cross-origin-subframe-for-scrolling.html
index 75414848f7d7422ede192739fff1dab2f4cf88fa..a6598a5529e28210766d070ea3121be103467319 100644
--- a/third_party/WebKit/LayoutTests/http/tests/misc/resources/cross-origin-subframe-for-scrolling.html
+++ b/third_party/WebKit/LayoutTests/http/tests/misc/resources/cross-origin-subframe-for-scrolling.html
@@ -1,10 +1,9 @@
<!DOCTYPE html>
-<script src="/js-test-resources/js-test.js"></script>
<div style="height: 300px"></div>
<script>
-setPrintTestResultsLazily();
-self.jsTestIsAsync = true;
+var port;
+var frame_id;
window.onload = (() => {
if (!window.eventSender || !window.internals) {
@@ -16,13 +15,18 @@ window.onload = (() => {
function handleMessage(event) {
if (event.data.hasOwnProperty('scrollBy')) {
+ port = event.source;
+ frame_id = event.data.frame_id;
eventSender.mouseMoveTo(event.data.left + 5, event.data.top + 5);
eventSender.mouseScrollBy(0, event.data.scrollBy);
- requestAnimationFrame(() => {setTimeout(() => {event.source.postMessage("", "*")}, 500)});
- } else {
- event.source.postMessage({scrollTop: document.documentElement.scrollTop}, "*");
}
}
+window.onscroll = (() => {
+ if (port) {
+ port.postMessage({scrolled: frame_id, scrollTop: document.documentElement.scrollTop}, "*");
+ }
+});
+
window.addEventListener("message", handleMessage);
</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/misc/scroll-cross-origin-iframes.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698