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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/workers/data-url.html

Issue 2697003002: Fix incorrect tests for storage APIs in data: URL workers (Closed)
Patch Set: Added comment for the indexedDB test. Improved Web Sql Database test name. Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/workers/data-url-shared.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Test workers can be started with a data URL</title> 2 <title>Test workers can be started with a data URL</title>
3 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testharnessreport.js"></script>
5 <div id="log"></div> 5 <div id="log"></div>
6 <script> 6 <script>
7 // Helper assert functions -START- 7 // Helper assert functions -START-
8 function assert_worker_sends_pass(test_desc, mime_type, worker_code) { 8 function assert_worker_sends_pass(test_desc, mime_type, worker_code) {
9 async_test(function(t) { 9 async_test(function(t) {
10 var w = new Worker(`data:${mime_type},${worker_code}`); 10 var w = new Worker(`data:${mime_type},${worker_code}`);
(...skipping 23 matching lines...) Expand all
34 // Actual tests -START- 34 // Actual tests -START-
35 35
36 // Any MIME type 36 // Any MIME type
37 assert_worker_sends_pass('application/javascript MIME allowed', 'application/jav ascript', 'self.postMessage("PASS")'); 37 assert_worker_sends_pass('application/javascript MIME allowed', 'application/jav ascript', 'self.postMessage("PASS")');
38 assert_worker_sends_pass('text/plain MIME allowed', 'text/plain', 'self.postMess age("PASS")'); 38 assert_worker_sends_pass('text/plain MIME allowed', 'text/plain', 'self.postMess age("PASS")');
39 assert_worker_sends_pass('empty MIME allowed', '', 'self.postMessage("PASS")'); 39 assert_worker_sends_pass('empty MIME allowed', '', 'self.postMessage("PASS")');
40 40
41 // Communications goes both ways 41 // Communications goes both ways
42 assert_worker_sends_pass('communication goes both ways', 'application/javascript ', 'onmessage = function(e) { self.postMessage("PASS"); }'); 42 assert_worker_sends_pass('communication goes both ways', 'application/javascript ', 'onmessage = function(e) { self.postMessage("PASS"); }');
43 43
44 // test access to storage APIs
45 // once https://github.com/w3c/IndexedDB/pull/150 lands, this is spec conforming
46 assert_worker_throws('indexedDB inaccessible', 'self.indexedDB.open("someDBName" )');
47 assert_worker_throws('Web SQL Database inaccessible', 'self.openDatabase("someDB Name", "1.0", "someDBName", 1);');
48
44 // 'data:' workers are cross-origin 49 // 'data:' workers are cross-origin
45 assert_worker_throws('indexedDB inaccessible', 'self.indexedDB.open("someDBName" )');
46 assert_worker_throws('localStorage inaccessible', 'self.localStorage.testItem');
47 assert_worker_sends_pass('cross-origin worker', '', 'fetch("/").then(() => self. postMessage("FAIL"), () => self.postMessage("PASS"))'); 50 assert_worker_sends_pass('cross-origin worker', '', 'fetch("/").then(() => self. postMessage("FAIL"), () => self.postMessage("PASS"))');
48 51
49 // 'data:' workers have opaque origin 52 // 'data:' workers have opaque origin
50 assert_worker_sends_pass('worker has opaque origin', 'application/javascript', ' if (self.location.origin == "null") postMessage("PASS"); else postMessage("FAIL" );'); 53 assert_worker_sends_pass('worker has opaque origin', 'application/javascript', ' if (self.location.origin == "null") postMessage("PASS"); else postMessage("FAIL" );');
51 54
52 // invalid javascript will trigger an ErrorEvent 55 // invalid javascript will trigger an ErrorEvent
53 assert_worker_construction_fails('invalid javascript produces error', 'applicati on/javascript', '}x=3'); 56 assert_worker_construction_fails('invalid javascript produces error', 'applicati on/javascript', '}x=3');
54 57
55 // Actual tests -END- 58 // Actual tests -END-
56 </script> 59 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/workers/data-url-shared.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698