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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/multipart/stop-loading-after-onload2.html

Issue 1840933002: Do not rely on broken images in http/tests/multipart/ tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 1 month 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/multipart/stop-loading-after-onload2.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/multipart/stop-loading-after-onload2.html b/third_party/WebKit/LayoutTests/http/tests/multipart/stop-loading-after-onload2.html
index 0dd8589f353eb23ce9e9ec43d8aff37947f9e540..43671201b25b8434e4e5326c20dfd61ed7150719 100644
--- a/third_party/WebKit/LayoutTests/http/tests/multipart/stop-loading-after-onload2.html
+++ b/third_party/WebKit/LayoutTests/http/tests/multipart/stop-loading-after-onload2.html
@@ -1,33 +1,35 @@
<html>
<head>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
<script>
-// This tests window.stop() can stop loading of multipart images after
-// <img>'s onload and one more part loaded after onload.
-if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
-}
+var t = async_test("window.stop() can stop loading of multipart images " +
+ "after <img>'s onload and " +
+ "after one more part loaded after onload.");
function callStop()
{
+ const url = "resources/multipart.php?interval=1&loop=1&img1=2x2-green.png&img2=abe.png&label=2";
+ if (window.internals) {
+ assert_true(internals.isLoading(url), "The image should be loading before window.stop().");
+ }
window.stop();
- window.setTimeout(function() {
- var broken = (testingImage.width != 2 && testingImage.width != 76);
- document.getElementById("results").innerHTML = broken ? "PASS" : "FAIL";
- if (window.testRunner)
- testRunner.notifyDone();
- }, 100);
+ window.setTimeout(t.step_func(function() {
+ if (window.internals) {
+ assert_false(internals.isLoading(url), "The image should not be loading after window.stop().");
+ }
+ t.done();
+ }), 100);
}
function firstPartLoaded()
{
- setTimeout(callStop, 1500);
+ setTimeout(t.step_func(callStop), 1500);
}
</script>
</head>
<body>
<!-- |label| is added to avoid interaction between stop-loading* tests -->
<img id=testingImage src="resources/multipart.php?interval=1&loop=1&img1=2x2-green.png&img2=abe.png&label=2" onload="firstPartLoaded()">
-<p id="results"></p>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698