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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/misc/scroll-cross-origin-iframes.html

Issue 2642723009: Improve cross-origin-subframe-for-scrolling layout test (Closed)
Patch Set: 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
Index: third_party/WebKit/LayoutTests/http/tests/misc/scroll-cross-origin-iframes.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/misc/scroll-cross-origin-iframes.html b/third_party/WebKit/LayoutTests/http/tests/misc/scroll-cross-origin-iframes.html
index acd83091601202aaba7a62707ae3370a475546b6..54df529b110b0cc6619ec79f37155aea4e290071 100644
--- a/third_party/WebKit/LayoutTests/http/tests/misc/scroll-cross-origin-iframes.html
+++ b/third_party/WebKit/LayoutTests/http/tests/misc/scroll-cross-origin-iframes.html
@@ -1,10 +1,11 @@
<!DOCTYPE html>
-<script src="/js-test-resources/js-test.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src='/resources/testharnessreport.js'></script>
<iframe id="target-iframe1" src="http://localhost:8080/misc/resources/cross-origin-subframe-for-scrolling.html" style="height: 100px; width: 100px; overflow-y: scroll; position: absolute; left: 50px; top: 50px"></iframe>
<iframe id="target-iframe2" src="http://localhost:8080/misc/resources/cross-origin-subframe-for-scrolling.html" style="height: 100px; width: 100px; overflow-y: scroll; position: absolute; left: 50px; top: 200px"></iframe>
<script>
-description("Verify that two sibling cross-origin iframes both correctly scroll on MouseWheel events, as per https://crbug.com/675695.");
+var scroll_test = async_test("Verify that two sibling cross-origin iframes both correctly scroll on MouseWheel events, as per https://crbug.com/675695.");
// States:
// 0 => Scroll sent to iframe1
@@ -14,31 +15,29 @@ description("Verify that two sibling cross-origin iframes both correctly scroll
var state = 0;
var iframe1 = document.getElementById("target-iframe1");
var iframe2 = document.getElementById("target-iframe2");
-setPrintTestResultsLazily();
-self.jsTestIsAsync = true;
function handleMessage(event) {
- if (state == 0) {
+ if (state == 0 && event.data.scrolled == 1) {
bokan 2017/01/20 18:13:26 if state == 0 then event.data.scrolled must be 1,
kenrb 2017/01/20 19:21:34 Okay, I've simplified this quite a bit and removed
iframe1.contentWindow.postMessage("", "*");
state = 1;
- } else if (state == 1) {
- shouldBeEqualToNumber("event.data.scrollTop", 40);
+ } else if (state == 1 && event.data.hasOwnProperty("scrollTop")) {
+ scroll_test.step(() => { assert_greater_than(event.data.scrollTop, 0, "iframe1 scroll offset greater than 0")} );
state = 2;
- iframe2.contentWindow.postMessage({scrollBy: -1, left: iframe2.offsetLeft, top: iframe2.offsetTop}, "*");
+ iframe2.contentWindow.postMessage({scrollBy: -1, frame_id: 2, left: iframe2.offsetLeft, top: iframe2.offsetTop}, "*");
iframe2.contentWindow.postMessage("", "*");
bokan 2017/01/20 18:13:26 Don't we need to wait until iframe2 gets the onscr
- } else if (state == 2) {
+ } else if (state == 2 && event.data.scrolled == 2) {
iframe1.contentWindow.postMessage("", "*");
bokan 2017/01/20 18:13:26 This is the second time we're posting iframe1 with
state = 3;
- } else if (state == 3) {
- shouldBeEqualToNumber("event.data.scrollTop", 40);
- finishJSTest();
+ } else if (state == 3 && event.data.hasOwnProperty("scrollTop")) {
+ scroll_test.step(() => { assert_greater_than(event.data.scrollTop, 0, "iframe2 scroll offset greater than 0")} );
+ scroll_test.done();
}
}
window.addEventListener("message", handleMessage);
iframe1.onload = (() => {
- iframe1.contentWindow.postMessage({scrollBy: -1, left: iframe1.offsetLeft, top: iframe1.offsetTop}, "*");
+ iframe1.contentWindow.postMessage({scrollBy: -1, frame_id: 1, left: iframe1.offsetLeft, top: iframe1.offsetTop}, "*");
});
</script>

Powered by Google App Engine
This is Rietveld 408576698