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

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: Moved fuction to top of setNetworkConnection 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
« no previous file with comments | « chrome/test/chromedriver/test/run_py_tests.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6663d6fdb440345c06becaf1ad212c696d4955e2
--- /dev/null
+++ b/chrome/test/data/chromedriver/xmlrequest_test.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ </head>
+ <body>
+ <span id='requestButton'>
+ 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 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";
+ 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++;
+ } else {
+ document.getElementById("failures").click();
+ failures++;
+ }
+ }
+ }
+
+ function repeatLoadPage() {
+ setInterval(makeRequest, 300);
+ }
+ </script>
+ </body>
+</html>
« no previous file with comments | « chrome/test/chromedriver/test/run_py_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698