Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / files / file-reader-result-twice.html
blob8e144bef3f42ba1fe52dbd01bb4780e827264cf9
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p>Test that FileReader.result returns the same result regardless of whether it's from cache or not by getting it twice.</p>
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
7 <script type="text/javascript">
8 function setupHandlers(test, reader, expectedResult)
10 reader.onabort = test.step_func(function() {
11 assert_unreached("onabort invoked on reader");
12 });
13 reader.onerror = test.step_func(function() {
14 assert_unreached("onerror invoked on reader");
15 });
16 reader.onloadend = test.step_func(function() {
17 assert_equals(reader.readyState, reader.DONE,
18 "reader.readyState");
19 assert_equals(reader.error, null, "reader.error");
20 // Read result attribute twice to go through Blink's code path for
21 // caching converted result and reading from the cache.
22 assert_equals(reader.result, expectedResult, "reader.result");
23 assert_equals(reader.result, expectedResult, "reader.result");
24 test.done();
25 });
28 var blob = new Blob(["HelloWorld"], {"type": "text/plain;charset=us-ascii"});
30 var testBinaryString = async_test("Read from a blob as a binary string");
31 testBinaryString.step(function() {
32 var reader = new FileReader();
33 reader.readAsBinaryString(blob);
34 setupHandlers(testBinaryString, reader, "HelloWorld");
35 });
37 var testText = async_test("Read from a blob as a text");
38 testText.step(function() {
39 var reader = new FileReader();
40 reader.readAsText(blob);
41 setupHandlers(testText, reader, "HelloWorld");
42 });
44 var testDataURL = async_test("Read from a blob as a data URL");
45 testDataURL.step(function() {
46 var reader = new FileReader();
47 reader.readAsDataURL(blob);
48 setupHandlers(testDataURL, reader, "data:text/plain;charset=us-ascii;base64,SGVsbG9Xb3JsZA==");
49 });
50 </script>
51 </body>
52 </html>