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

Side by Side Diff: chrome/test/data/chromedriver/xmlrequest_test.html

Issue 2065733002: Add a method to override the network conditions of the ChromeDriver session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed style issues. Changed names for consistency. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 </head>
6 <body>
7 <span id='requestButton'>
8 Make a request
9 </span>
10 <a id="link" target="_blank" href="empty.html">Link to empty.html</a >
11
12 <p>Successes:
13 <div id="successes">
14 </div>
15
16 <p>Failures:
17 <div id="failures">
18 </div>
19
20 <script type="text/javascript">
21 var successes;
22 var failures;
23
24 var eventListener = function(evt) {
25 if( evt == 'success'){
26 document.getElementById("successes").innerHTML = ++successes;
27 } else if( evt == 'failure') {
28 document.getElementById("failures").innerHTML = ++fail ures;
29 }
30 };
31
32 var s = document.getElementById('successes');
33 var f = document.getElementById('failures');
34
35 s.addEventListener('click', function() { eventListener('success') });
36 f.addEventListener('click', function() { eventListener('failure') });
37
38 var httpRequest;
39 document.getElementById('requestButton').addEventListener('cli ck', repeatLoadPage);
40
41 function makeRequest() {
42 httpRequest = new XMLHttpRequest();
43 url = window.location.protocol + "//" + window.location.host + "/hel loworld";
44 httpRequest.onreadystatechange = alertContents;
45 httpRequest.open("GET", url);
46 httpRequest.send();
47 }
48
49 var successes = 0;
50 var failures = 0;
51
52 function alertContents() {
53 if (httpRequest.readyState == 4) {
54 if (httpRequest.status == 200) {
55 document.getElementById("successes").click();
56 successes++;
57 } else {
58 document.getElementById("failures").click();
59 failures++;
60 }
61 }
62 }
63
64 function repeatLoadPage() {
65 setInterval(makeRequest, 300);
66 }
67 </script>
68 </body>
samuong 2016/06/29 18:37:55 the indenting for this file still looks incorrect.
roisinmcl 2016/06/29 19:45:00 Done.
69 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698