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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/misc/resources/resource-timing-sizes-sync-xhr-transfer-size.js

Issue 2163183002: Fix PerformanceResourceTiming transferSize field for sync XHR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resource_timing_sizes_worker_tests
Patch Set: Rebase Created 4 years, 5 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
OLDNEW
(Empty)
1 // This test code is shared between resource-timing-sizes-redirect.html and
Kunihiko Sakamoto 2016/07/21 04:05:43 Please update this comment.
Adam Rice 2016/07/21 04:13:51 Sorry. Done.
2 // resource-timing-sizes-redirect-worker.html
3
4 if (typeof document === 'undefined') {
5 importScripts('/resources/testharness.js');
6 }
7
8 const minSize = 100;
9 const url = new URL(cacheBust('/resources/dummy.xml'), location.href).href;
10 var t = async_test('PerformanceResourceTiming sync XHR transferSize test');
11
12 function cacheBust(url) {
13 return url + '?bust=' + Math.random().toString().substring(2);
14 }
15
16 function check() {
17 var entries = performance.getEntriesByName(url);
18 assert_equals(entries.length, 1, 'entries.length');
19 var entry = entries[0];
20 assert_greater_than(entry.transferSize, minSize, 'transferSize');
21 t.done();
22 }
23
24 function run() {
25 var xhr = new XMLHttpRequest();
26 xhr.open('GET', url, false);
27 xhr.send();
28 setTimeout(t.step_func(check), 0);
29 }
30
31 run();
32
33 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698