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

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: Changed web_view loop in SetNetworkConnection. Fixed function names in ChromeDesktopImpl. 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 <html>
samuong 2016/06/28 23:23:40 add a <!DOCTYPE html> at the top- https://google.g
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 </head>
5 <body>
6 <span id='requestButton' style="cursor: pointer; text-decoration: unde rline">
samuong 2016/06/28 23:23:40 is the style attribute necessary here?
samuong 2016/06/28 23:23:41 keep indents to 2 spaces - https://google.github.i
roisinmcl 2016/06/29 17:55:13 Done.
7 Make a request
8 </span>
9 <a id="link" target="_blank" href="empty.html">Link to empty.html</a >
10
11 <p>Successes:
12 <div id="successes">
13 </div>
14
15 <p>Failures:
16 <div id="failures">
17 </div>
18
19 <script type="text/javascript">
20 var successes;
21 var failures;
22
23 var eventListener = function(evt) {
24 if( evt == 'success'){
25 document.getElementById("successes").innerHTML = ++successes;
26 } else if( evt == 'failure') {
27 document.getElementById("failures").innerHTML = ++fail ures;
28 }
29 };
30
31 var s = document.getElementById('successes');
32 var f = document.getElementById('failures');
33
34 s.addEventListener('click', function() { eventListener('success') });
35 f.addEventListener('click', function() { eventListener('failure') });
36
37 var httpRequest;
38 document.getElementById('requestButton').addEventListener('cli ck', repeatLoadPage);
39
40 function makeRequest() {
41 httpRequest = new XMLHttpRequest();
42 url = window.location.protocol + "//" + window.location.host + "/hel loworld";
43 console.log(url)
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 ) {
samuong 2016/06/28 23:23:41 nit: no space before the )s
roisinmcl 2016/06/29 17:55:13 Done.
55 document.getElementById("successes").click();
56 successes++;
57 console.log("Successes: " + successes);
58 console.log(httpRequest.status)
samuong 2016/06/28 23:23:40 are we using the console log or the divs to report
roisinmcl 2016/06/29 17:55:13 We should be using the divs, so I deleted the cons
59 } else {
60 document.getElementById("failures").click();
61 failures++;
62 console.log("Failures: " + failures);
63 console.log(httpRequest.status)
64 }
65 } else {
66 console.log("There was a problem with the request")
67 }
68 }
69
70 function repeatLoadPage() {
71 setInterval(makeRequest,300);
samuong 2016/06/28 23:23:41 nit: space after the ','
roisinmcl 2016/06/29 17:55:13 Done.
72 }
73 </script>
74 </body>
75 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698