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

Unified 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, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/chromedriver/xmlrequest_test.html
diff --git a/chrome/test/data/chromedriver/xmlrequest_test.html b/chrome/test/data/chromedriver/xmlrequest_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..e6dc6e4ac9a7f182d174726f8deaf470b3ffddd7
--- /dev/null
+++ b/chrome/test/data/chromedriver/xmlrequest_test.html
@@ -0,0 +1,75 @@
+<html>
samuong 2016/06/28 23:23:40 add a <!DOCTYPE html> at the top- https://google.g
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ </head>
+ <body>
+ <span id='requestButton' style="cursor: pointer; text-decoration: underline">
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.
+ Make a request
+ </span>
+ <a id="link" target="_blank" href="empty.html">Link to empty.html</a>
+
+ <p>Successes:
+ <div id="successes">
+ </div>
+
+ <p>Failures:
+ <div id="failures">
+ </div>
+
+ <script type="text/javascript">
+ var successes;
+ var failures;
+
+ var eventListener = function(evt) {
+ if( evt == 'success'){
+ document.getElementById("successes").innerHTML = ++successes;
+ } else if( evt == 'failure') {
+ document.getElementById("failures").innerHTML = ++failures;
+ }
+ };
+
+ var s = document.getElementById('successes');
+ var f = document.getElementById('failures');
+
+ s.addEventListener('click', function() { eventListener('success') });
+ f.addEventListener('click', function() { eventListener('failure') });
+
+ var httpRequest;
+ document.getElementById('requestButton').addEventListener('click', repeatLoadPage);
+
+ function makeRequest() {
+ httpRequest = new XMLHttpRequest();
+ url = window.location.protocol + "//" + window.location.host + "/helloworld";
+ console.log(url)
+ httpRequest.onreadystatechange = alertContents;
+ httpRequest.open("GET", url);
+ httpRequest.send();
+ }
+
+ var successes = 0;
+ var failures = 0;
+
+ function alertContents() {
+ if (httpRequest.readyState == 4 ) {
+ 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.
+ document.getElementById("successes").click();
+ successes++;
+ console.log("Successes: " + successes);
+ 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
+ } else {
+ document.getElementById("failures").click();
+ failures++;
+ console.log("Failures: " + failures);
+ console.log(httpRequest.status)
+ }
+ } else {
+ console.log("There was a problem with the request")
+ }
+ }
+
+ function repeatLoadPage() {
+ setInterval(makeRequest,300);
samuong 2016/06/28 23:23:41 nit: space after the ','
roisinmcl 2016/06/29 17:55:13 Done.
+ }
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698