Index: third_party/WebKit/LayoutTests/intersection-observer/resources/cross-origin-subframe.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/cross-origin-subframe.html b/third_party/WebKit/LayoutTests/intersection-observer/resources/cross-origin-subframe.html |
similarity index 70% |
rename from third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/cross-origin-subframe.html |
rename to third_party/WebKit/LayoutTests/intersection-observer/resources/cross-origin-subframe.html |
index edf34dcd2a591c09c7d4cc213bf175104acaf8ad..93e958349e567da1a2d5df8b184aecf3e9c41714 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/cross-origin-subframe.html |
+++ b/third_party/WebKit/LayoutTests/intersection-observer/resources/cross-origin-subframe.html |
@@ -1,8 +1,10 @@ |
<!DOCTYPE html> |
-<script src="/js-test-resources/intersection-observer-helper-functions.js"></script> |
+<script src="./intersection-observer-test-utils.js"></script> |
+ |
<div style="height: 200px; width: 100px;"></div> |
<div id="target" style="background-color: green; width:100px; height:100px"></div> |
<div style="height: 200px; width: 100px;"></div> |
+ |
<script> |
var port; |
var entries = []; |
@@ -15,23 +17,30 @@ var nextStep; |
// RAF when it is received, and then send us a message to cause the next step to run. |
// Use a rootMargin here, and verify it does NOT get applied for the cross-origin case. |
-var observer = new IntersectionObserver( |
- changes => { entries = entries.concat(changes) }, |
- { rootMargin: "7px" } |
-); |
+var observer = new IntersectionObserver(function(changes) { |
+ entries = entries.concat(changes) |
+}, { rootMargin: "7px" }); |
observer.observe(target); |
function step0() { |
entries = entries.concat(observer.takeRecords()); |
nextStep = step1; |
- port.postMessage({actual: entries.map(entryToJson), expected: []}, "*"); |
+ port.postMessage({ |
+ actual: entries.map(entryToJson), |
+ expected: [], |
+ description: "First rAF" |
+ }, "*"); |
entries = []; |
port.postMessage({scrollTo: 200}, "*"); |
} |
function step1() { |
entries = entries.concat(observer.takeRecords()); |
- port.postMessage({actual: entries.map(entryToJson), expected: []}, "*"); |
+ port.postMessage({ |
+ actual: entries.map(entryToJson), |
+ expected: [], |
+ description: "topDocument.scrollingElement.scrollTop = 200" |
+ }, "*"); |
entries = []; |
scroller.scrollTop = 250; |
nextStep = step2; |
@@ -46,7 +55,11 @@ function step2() { |
rootBounds: "null", |
target: target.id |
}]; |
- port.postMessage({actual: entries.map(entryToJson), expected: expected}, "*"); |
+ port.postMessage({ |
+ actual: entries.map(entryToJson), |
+ expected: expected, |
+ description: "iframeDocument.scrollingElement.scrollTop = 250" |
+ }, "*"); |
entries = []; |
nextStep = step3; |
port.postMessage({scrollTo: 100}, "*"); |
@@ -60,7 +73,11 @@ function step3() { |
rootBounds: "null", |
target: target.id |
}]; |
- port.postMessage({actual: entries.map(entryToJson), expected: expected}, "*"); |
+ port.postMessage({ |
+ actual: entries.map(entryToJson), |
+ expected: expected, |
+ description: "topDocument.scrollingElement.scrollTop = 100" |
+ }, "*"); |
port.postMessage({DONE: 1}, "*"); |
} |