Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / chunked-file-reader.html
blob78da201850ca91b0c9a2bb256dd14148632e402b
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4 <script src="../http/tests/inspector/inspector-test.js"></script>
5 <script>
7 function initialize_ChunkedFileReaderTest()
10 InspectorTest.TestOutputStreamDelegate = function(doneCallback)
12 this._doneCallback = doneCallback;
13 this._chunkCount = 0;
16 InspectorTest.TestOutputStreamDelegate.prototype = {
17 onTransferStarted: function()
19 InspectorTest.addResult("WebInspector.OutputStreamDelegate.onTransferStarted() called");
22 onTransferFinished: function()
24 InspectorTest.addResult("Chunks transferred: " + this._chunkCount);
25 InspectorTest.addResult("WebInspector.OutputStreamDelegate.onTransferFinished() called");
26 this._doneCallback();
29 /**
30 * @param {!WebInspector.ChunkedReader} reader
32 onChunkTransferred: function(reader)
34 this._chunkCount++;
37 /**
38 * @param {!WebInspector.ChunkedReader} reader
39 * @param {!Event} event
41 onError: function(reader, event)
43 InspectorTest.addResult("WebInspector.OutputStreamDelegate.onError() called");
44 this._doneCallback();
50 function test()
52 var text = ["Латынь из моды вышла ныне:\n",
53 "Так, если правду вам сказать,\n",
54 "Он знал довольно по-латыне,\n",
55 "Чтоб эпиграфы разбирать\n"];
57 var blob = new Blob(text);
58 // Most of the characters above will be encoded as 2 bytes, so make sure we use odd
59 // chunk size to cause chunk boundaries sometimes to happen between chaacter bytes.
60 var chunkSize = 5;
61 var reader = new WebInspector.ChunkedFileReader(blob, chunkSize, new InspectorTest.TestOutputStreamDelegate(onTransferFinished));
62 var output = new WebInspector.StringOutputStream();
63 reader.start(output);
64 function onTransferFinished()
66 InspectorTest.assertEquals(text.join(""), output.data(), "Read text is different from written text");
67 InspectorTest.addResult("DONE");
68 InspectorTest.completeTest();
72 </script>
73 </head>
75 <body onload="runTest()">
76 <p>
77 This tests that ChunkedFileReader properly re-assembles chunks, especially in case these contain multibyte characters.
78 </p>
80 </body>
81 </html>