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

Side by Side Diff: LayoutTests/http/tests/appcache/fail-on-update.html

Issue 752983002: Deflake appCache/fail-on-update* by removing sync XMLHTTPRequest warnings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/http/tests/appcache/fail-on-update-2.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML>
1 <html manifest="resources/fail-on-update.php"> 2 <html manifest="resources/fail-on-update.php">
2 <script> 3 <script>
3 if (window.testRunner) { 4 if (window.testRunner) {
4 testRunner.dumpAsText(); 5 testRunner.dumpAsText();
5 testRunner.waitUntilDone(); 6 testRunner.waitUntilDone();
6 } 7 }
7 8
8 function setManifestDeleted(state) 9 function setManifestDeleted(state, callback)
9 { 10 {
10 var req = new XMLHttpRequest; 11 var req = new XMLHttpRequest;
11 req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" : "reset"), false); 12 req.onreadystatechange = function() {
13 if (req.readyState == 4)
14 callback();
15 }
16 req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" : "reset"));
12 req.send(null); 17 req.send(null);
13 } 18 }
14 19
15 function test() 20 function test()
16 { 21 {
17 clearTimeout(timeoutId); 22 clearTimeout(timeoutId);
18 23
19 setManifestDeleted(true); 24 setManifestDeleted(true, afterDelete);
20 applicationCache.update(); 25
21 window.location = 'data:text/html,<p>SUCCESS: No crash.</p>' + 26 function afterDelete()
22 '<script>' + 27 {
23 'if (window.testRunner) testRunner.notifyDone();' + 28 applicationCache.update();
24 '</scri' + 'pt>'; 29 window.location = 'data:text/html,<p>SUCCESS: No crash.</p>' +
30 '<script>' +
31 'if (window.testRunner) testRunner.notifyDone();' +
32 '</scri' + 'pt>';
33 }
25 } 34 }
26 35
27 function resetManifest() 36 function resetManifest()
28 { 37 {
29 if (applicationCache.status != applicationCache.UNCACHED && applicationCache .status != applicationCache.OBSOLETE) { 38 if (applicationCache.status != applicationCache.UNCACHED && applicationCache .status != applicationCache.OBSOLETE) {
30 timeoutId = setTimeout(resetManifest, 100); 39 timeoutId = setTimeout(resetManifest, 100);
31 return; 40 return;
32 } 41 }
33 42
34 setManifestDeleted(false); 43 setManifestDeleted(false, function() {
35 location.reload(); 44 location.reload();
45 });
36 } 46 }
37 47
38 applicationCache.addEventListener('noupdate', function() { setTimeout(test, 0) } , false); 48 applicationCache.addEventListener('noupdate', function() { setTimeout(test, 0) } , false);
39 applicationCache.addEventListener('cached', function() { setTimeout(test, 0) }, false); 49 applicationCache.addEventListener('cached', function() { setTimeout(test, 0) }, false);
40 50
41 // If the manifest script happened to be in a wrong state, reset it. 51 // If the manifest script happened to be in a wrong state, reset it.
42 var timeoutId = setTimeout(resetManifest, 100); 52 var timeoutId = setTimeout(resetManifest, 100);
43 53
44 </script> 54 </script>
45 <p>Test for a particular incorrect assertion failure.</p> 55 <p>Test for a particular incorrect assertion failure.</p>
46 56
47 </html> 57 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/appcache/fail-on-update-2.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698