Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html b/third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..935089f50be2f888e66eab741b200ee6392876c5 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/preload/meta-csp.html |
| @@ -0,0 +1,23 @@ |
| +<!DOCTYPE html> |
| +<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; font-src 'none'"> |
|
Mike West
2016/08/19 09:25:41
Can you add a more complicated test as well? Somet
|
| +<script> |
| +var boundedStart = performance.now(); |
| +</script> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<link rel=preload href="../resources/Ahem.ttf" as=font crossorigin> |
| +<script> |
| + var t = async_test("Ensure preloads occur when csp meta tags are in the markup"); |
| +window.addEventListener("load", t.step_func(function() { |
| + var fonts = performance.getEntriesByName(new URL("../resources/Ahem.ttf", location.href).href); |
| + assert_equals(fonts.length, 0); |
| + window.performance.getEntriesByType('resource').forEach(function(r) { |
| + if (r.name.indexOf('testharness.js') != -1) { |
| + assert_greater_than(r.startTime, 0); |
| + assert_greater_than(boundedStart, r.startTime); |
|
kouhei (in TOK)
2016/08/19 04:56:15
Should we use internals.isPreloaded?
Charlie Harrison
2016/08/19 15:13:40
Done. isPreloaded will return true even if the res
kouhei (in TOK)
2016/08/22 05:34:03
Yes.
|
| + t.done(); |
| + } |
| + }); |
| +})); |
| +</script> |
| + |