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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/request-worker.js

Issue 340943002: ServiceWorker: Update IDLs to use ScalarValueString (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add URLs and one real test case Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 importScripts('worker-test-helpers.js'); 1 importScripts('worker-test-helpers.js');
2 2
3 test(function() { 3 test(function() {
4 var headers = new HeaderMap; 4 var headers = new HeaderMap;
5 headers.set('User-Agent', 'Mozilla/5.0'); 5 headers.set('User-Agent', 'Mozilla/5.0');
6 headers.set('Accept', 'text/html'); 6 headers.set('Accept', 'text/html');
7 headers.set('X-ServiceWorker-Test', 'request test field'); 7 headers.set('X-ServiceWorker-Test', 'request test field');
8 8
9 var request = new Request({ 9 var request = new Request({
10 url: 'https://www.example.com/test.html', 10 url: 'https://www.example.com/test.html',
11 method: 'GET', 11 method: 'GET',
12 headers: headers 12 headers: headers
13 }); 13 });
14 14
15 assert_equals(request.url, 'https://www.example.com/test.html', 'Request.url should match'); 15 assert_equals(request.url, 'https://www.example.com/test.html', 'Request.url should match');
16 assert_equals(request.method, 'GET', 'Request.method should match'); 16 assert_equals(request.method, 'GET', 'Request.method should match');
17 assert_equals(request.origin, 'https://www.example.com', 'Request.origin sho uld match'); 17 assert_equals(request.origin, 'https://www.example.com', 'Request.origin sho uld match');
18 assert_true(request.headers instanceof HeaderMap, 'Request.headers should be HeaderMap'); 18 assert_true(request.headers instanceof HeaderMap, 'Request.headers should be HeaderMap');
19 assert_equals(request.headers.size, 3, 'Request.headers.size should match'); 19 assert_equals(request.headers.size, 3, 'Request.headers.size should match');
20 // Note: detailed behavioral tests for HeaderMap are in another test, 20 // Note: detailed behavioral tests for HeaderMap are in another test,
21 // http/tests/serviceworker/headermap.html. 21 // http/tests/serviceworker/headermap.html.
22 22
23 request.url = 'http://localhost/'; 23 request.url = 'http://localhost/';
24 assert_equals(request.url, 'http://localhost/', 'Request.url should be writa ble'); 24 assert_equals(request.url, 'http://localhost/', 'Request.url should be writa ble');
25 request.url = 'http://localhost/\uD800'; // Unmatched lead surrogate.
26 assert_equals(request.url,
27 'http://localhost/' + encodeURIComponent('\uFFFD'),
28 'Request.url should have unmatched surrogates replaced.');
25 request.method = 'POST'; 29 request.method = 'POST';
26 assert_equals(request.method, 'POST', 'Request.method should be writable'); 30 assert_equals(request.method, 'POST', 'Request.method should be writable');
27 assert_throws({name: 'TypeError'}, function() { request.method = 'invalid \u 0100'; }, 31 assert_throws({name: 'TypeError'}, function() { request.method = 'invalid \u 0100'; },
28 'Request.method should throw on invalid ByteString'); 32 'Request.method should throw on invalid ByteString');
29 33
30 }, 'Request in ServiceWorkerGlobalScope'); 34 }, 'Request in ServiceWorkerGlobalScope');
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698