| Index: third_party/WebKit/LayoutTests/http/tests/subresource_filter/image-allow-disallow-transitions.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/subresource_filter/image-allow-disallow-transitions.html b/third_party/WebKit/LayoutTests/http/tests/subresource_filter/image-allow-disallow-transitions.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7e83d4a8261dace50a400b645db0922567a5e913
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/subresource_filter/image-allow-disallow-transitions.html
|
| @@ -0,0 +1,60 @@
|
| +<!DOCTYPE html>
|
| +<body>
|
| +<script type="text/javascript">
|
| +// Verify that when the 'src' attribute for an <img> element is changed, the
|
| +// element transitions properly between states where primary content is shown,
|
| +// fallback content is shown, and when the element is collapsed.
|
| +//
|
| +// This test is carried out using a matrix of <img> elements. Initially, all
|
| +// images in the first row are set to show primary content, all images in the
|
| +// second row are set to show fallback content, etc. Once everything is loaded,
|
| +// the 'src' URLs are changed so that all images in the first column should show
|
| +// primary content, in the second column fallback content, etc.
|
| +
|
| +var INITIAL_URLS = {
|
| + "primary": "resources/alpha.png",
|
| + "fallback": "resources/non-existent-1.png",
|
| + "collapsed": "resources/gamma.png"
|
| +};
|
| +
|
| +var FINAL_URLS = {
|
| + "primary": "resources/beta.png",
|
| + "fallback": "resources/non-existent-2.png",
|
| + "collapsed": "resources/delta.png"
|
| +};
|
| +
|
| +var numPendingImages =
|
| + Object.keys(INITIAL_URLS).length * Object.keys(FINAL_URLS).length;
|
| +
|
| +if (window.testRunner) {
|
| + testRunner.setDisallowedSubresourcePathSuffixes(["gamma.png", "delta.png"]);
|
| + testRunner.waitUntilDone();
|
| +}
|
| +
|
| +let table = document.createElement("table");
|
| +let headerRow = table.insertRow();
|
| +
|
| +headerRow.insertCell().innerHTML = "- - - - \\ Final<br>Initial \\";
|
| +for (let finalState of Object.keys(FINAL_URLS)) {
|
| + headerRow.insertCell().textContent = finalState;
|
| +}
|
| +
|
| +for (let initialState of Object.keys(INITIAL_URLS)) {
|
| + let row = table.insertRow();
|
| + row.insertCell().textContent = initialState;
|
| + for (let finalState of Object.keys(FINAL_URLS)) {
|
| + let cell = row.insertCell();
|
| + let img = document.createElement("img");
|
| + img.src = INITIAL_URLS[initialState];
|
| + window.addEventListener("load", _ => {
|
| + img.src = FINAL_URLS[finalState];
|
| + img.onload = img.onerror = function() {
|
| + if (window.testRunner && --numPendingImages == 0)
|
| + testRunner.notifyDone();
|
| + };
|
| + });
|
| + cell.appendChild(img);
|
| + }
|
| +}
|
| +document.body.appendChild(table);
|
| +</script>
|
|
|