Title: [173925] trunk/LayoutTests
Revision
173925
Author
[email protected]
Date
2014-09-24 10:30:02 -0700 (Wed, 24 Sep 2014)

Log Message

Add New Test for overrideMimeType in XMLHttpRequest.
https://bugs.webkit.org/show_bug.cgi?id=137057

Patch by Shivakumar JM <[email protected]> on 2014-09-24
Reviewed by Alexey Proskuryakov.

As part of bug: https://bugs.webkit.org/show_bug.cgi?id=136699, add more tests to test overrideMimeType for all states.

* http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-invalidstaterror-expected.txt: Added.
* http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-invalidstaterror.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (173924 => 173925)


--- trunk/LayoutTests/ChangeLog	2014-09-24 17:26:00 UTC (rev 173924)
+++ trunk/LayoutTests/ChangeLog	2014-09-24 17:30:02 UTC (rev 173925)
@@ -1,3 +1,15 @@
+2014-09-24  Shivakumar JM  <[email protected]>
+
+        Add New Test for overrideMimeType in XMLHttpRequest.
+        https://bugs.webkit.org/show_bug.cgi?id=137057
+
+        Reviewed by Alexey Proskuryakov.
+
+        As part of bug: https://bugs.webkit.org/show_bug.cgi?id=136699, add more tests to test overrideMimeType for all states.
+
+        * http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-invalidstaterror-expected.txt: Added.
+        * http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-invalidstaterror.html: Added.
+
 2014-09-24  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r173839.

Added: trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-invalidstaterror-expected.txt (0 => 173925)


--- trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-invalidstaterror-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-invalidstaterror-expected.txt	2014-09-24 17:30:02 UTC (rev 173925)
@@ -0,0 +1,17 @@
+Test XMLHttpRequest overrideMimeType for exceptions.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Testing overrideMimeType when readyState = 0
+PASS req.overrideMimeType("text/plain") did not throw exception.
+Testing overrideMimeType when readyState = 1
+PASS req.overrideMimeType("text/plain") did not throw exception.
+Testing overrideMimeType when readyState = 1
+PASS req.overrideMimeType("text/plain") did not throw exception.
+Testing overrideMimeType when readyState = 2
+PASS req.overrideMimeType("text/plain") did not throw exception.
+Testing overrideMimeType when readyState = 3
+PASS req.overrideMimeType("text/plain") threw exception Error: InvalidStateError: DOM Exception 11.
+Testing overrideMimeType when readyState = 4
+PASS req.overrideMimeType("text/plain") threw exception Error: InvalidStateError: DOM Exception 11.
+

Added: trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-invalidstaterror.html (0 => 173925)


--- trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-invalidstaterror.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-invalidstaterror.html	2014-09-24 17:30:02 UTC (rev 173925)
@@ -0,0 +1,49 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script type="text/_javascript_">
+
+description("Test XMLHttpRequest overrideMimeType for exceptions.");
+
+window.jsTestIsAsync = true;
+
+var req = new XMLHttpRequest();
+debug('Testing overrideMimeType when readyState = ' + req.readyState);
+shouldNotThrow('req.overrideMimeType("text/plain")');
+
+function processStateChange() {
+	
+    if (req.readyState == req.DONE || req.readyState == req.LOADING) {
+        debug('Testing overrideMimeType when readyState = ' + req.readyState);
+        shouldThrow('req.overrideMimeType("text/plain")');
+    } else {
+        debug('Testing overrideMimeType when readyState = ' + req.readyState);
+        shouldNotThrow('req.overrideMimeType("text/plain")');
+    }
+
+    if (req.readyState == req.DONE) {
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }     
+}
+
+function runTest(type) {
+    req.open('GET', type, true);
+    debug('Testing overrideMimeType when readyState = ' + req.readyState);
+    shouldNotThrow('req.overrideMimeType("text/plain")');
+    req._onreadystatechange_ = processStateChange;
+    req.send(null);
+    debug('Testing overrideMimeType when readyState = ' + req.readyState);
+    shouldNotThrow('req.overrideMimeType("text/plain")');
+}
+
+runTest('resources/get.txt');
+
+</script>
+<script src=""
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to