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

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, 4 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
2 // resource-timing-sizes-sync-xhr-transfer-size.html and
3 // resource-timing-sizes-sync-xhr-transfer-size-worker.html
4
5 if (typeof document === 'undefined') {
6 importScripts('/resources/testharness.js');
7 }
8
9 const minSize = 100;
10 const url = new URL(cacheBust('/resources/dummy.xml'), location.href).href;
11 var t = async_test('PerformanceResourceTiming sync XHR transferSize test');
12
13 function cacheBust(url) {
14 return url + '?bust=' + Math.random().toString().substring(2);
15 }
16
17 function check() {
18 var entries = performance.getEntriesByName(url);
19 assert_equals(entries.length, 1, 'entries.length');
20 var entry = entries[0];
21 assert_greater_than(entry.transferSize, minSize, 'transferSize');
22 t.done();
23 }
24
25 function run() {
26 var xhr = new XMLHttpRequest();
27 xhr.open('GET', url, false);
28 xhr.send();
29 setTimeout(t.step_func(check), 0);
30 }
31
32 run();
33
34 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698