Index: LayoutTests/http/tests/eventsource/eventsource-content-type-charset.html |
diff --git a/LayoutTests/http/tests/eventsource/eventsource-content-type-charset.html b/LayoutTests/http/tests/eventsource/eventsource-content-type-charset.html |
index 84ac6b8c134aac06608bd228f25ff765a68a6cdb..750680728eee097e31ee570c7b027f894e438e21 100644 |
--- a/LayoutTests/http/tests/eventsource/eventsource-content-type-charset.html |
+++ b/LayoutTests/http/tests/eventsource/eventsource-content-type-charset.html |
@@ -1,92 +1,3 @@ |
-<!DOCTYPE html> |
-<html> |
-<body> |
-<p>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=45372">45372</a>: https://bugs.webkit.org/show_bug.cgi?id=45372</p> |
-<p>Test EventSource with an event-stream with a Content-Type with a charset is still recognized. You should see 5 PASSED below.</p> |
-<div id="result"></div> |
-<script> |
-function log(msg) { |
- document.getElementById("result").innerHTML += msg + "<br>"; |
-} |
- |
-if (window.testRunner) { |
- testRunner.dumpAsText(); |
- testRunner.waitUntilDone(); |
-} |
- |
-function shouldGetMessage(es) |
-{ |
- if (es.sawOpen && es.sawMessage && !es.sawError) |
- log("PASSED: " + es.contentType); |
- else |
- log("FAILED: " + es.contentType); |
-} |
- |
-function shouldFail(es) |
-{ |
- if (es.sawError && !es.sawOpen && !es.sawMessages) |
- log("PASSED: " + es.contentType); |
- else |
- log("FAILED: " + es.contentType); |
-} |
- |
-var i = 0; |
-var contentTypes = [ 'text/event-stream; charset=UTF-8', |
- 'text/event-stream; charset=windows-1251', |
- 'text/event-stream; charset=utf-8', |
- 'text/event-stream; charset="UTF-8"', |
- 'text/event-stream-foobar;' |
- ]; |
- |
-var expectedResultCallback = [ shouldGetMessage, |
- shouldFail, |
- shouldGetMessage, |
- shouldGetMessage, |
- shouldFail |
- ]; |
- |
-function openListener(evt) { |
- evt.target.sawOpen = true; |
-}; |
- |
-function messageListener(evt) { |
- evt.target.sawMessage = true; |
- evt.target.successCallback(evt.target); |
- evt.target.close(); |
- next(); |
-}; |
- |
-function errorListener(evt) { |
- evt.target.sawError = true; |
- evt.target.successCallback(evt.target); |
- evt.target.close(); |
- next(); |
-}; |
- |
-function startRequest() |
-{ |
- es = new EventSource("resources/response-content-type-charset.php?contentType=" + escape(contentTypes[i])); |
- es.onopen = openListener; |
- es.onmessage = messageListener; |
- es.onerror = errorListener; |
- es.successCallback = expectedResultCallback[i]; |
- es.contentType = contentTypes[i]; |
- ++i; |
-} |
- |
-function next() { |
- if (i >= contentTypes.length) { |
- end(); |
- return; |
- } |
- startRequest(); |
-} |
- |
-function end() { |
- if (window.testRunner) |
- testRunner.notifyDone(); |
-} |
-startRequest(); |
-</script> |
-</body> |
-</html> |
+<!DOCTYPE HTML> |
+<script src="/js-test-resources/js-test.js"></script> |
+<script src="script-tests/eventsource-content-type-charset.js"></script> |