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

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 hard coded network values to constants. Fixed style issues. 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..1468be024d51e79d890d9fe7875e279a9c7db397
--- /dev/null
+++ b/chrome/test/data/chromedriver/xmlrequest_test.html
@@ -0,0 +1,86 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ </head>
+ <body>
+ <span id='requestButton' style="cursor: pointer; text-decoration: underline">
+ Make a request
+ </span>
+ <a id="link" target="_blank" href="empty.html">Link to empty.html</a>
+
+ <p>Successes:</p>
+ <div id="successes">
+
+ </div>
+ <p>Failures:</p>
+ <div id="failures">
+
+ </div>
+
+ <script type="text/javascript">
+
+ var successes;
+ var failures;
+
+ var eventListener = function(evt) {
+ if( evt == 'success'){
+ document.getElementById("successes").innerHTML = ++successes; //+= "success ";
+ } else if( evt == 'failure') {
+ document.getElementById("failures").innerHTML = ++failures;//+= "failure ";
+ }
+ };
+
+ 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 ) {
+ document.getElementById("successes").click();
+ successes++;
+ console.log("Successes: " + successes);
+ console.log(httpRequest.status)
+ } 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);
+ }
+
+ </script>
+ </body>
+</html>
samuong 2016/06/20 21:43:23 this file should be formatted according to https:/
roisinmcl 2016/06/21 18:55:11 Done.

Powered by Google App Engine
This is Rietveld 408576698