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

Side by Side Diff: LayoutTests/http/tests/security/subresourceIntegrity/integrity-attribute.html

Issue 208423011: SRI: Add the 'integrity' attribute, and a SubresourceIntegrity runtime flag. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test. Created 6 years, 9 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/js-test-resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 description("Some elements should have `integrity` attributes. Others sh ouldn't.");
9
10 var ASSERT_INTEGRITY = 1;
11 var ASSERT_NO_INTEGRITY = 0;
12
13 function checkElement(elementName, integrityDisposition) {
14 var el = document.createElement(elementName);
15 if (integrityDisposition == ASSERT_INTEGRITY) {
16 if ("integrity" in el)
17 testPassed("<" + elementName + "> has an 'integrity' attribu te.");
18 else
19 testFailed("<" + elementName + "> does not have an 'integrit y' attribute.");
20 } else {
21 if ("integrity" in el)
22 testFailed("<" + elementName + "> has an 'integrity' attribu te.");
23 else
24 testPassed("<" + elementName + "> does not have an 'integrit y' attribute.");
25 }
26 }
27
28 var shouldHaveIntegrity = [
29 'a',
30 'audio',
31 'embed',
32 'iframe',
33 'img',
34 'link',
35 'object',
36 'script',
37 'source',
38 'track',
39 'video',
40 ];
41
42 var shouldNotHaveIntegrity = [
43 'body',
44 'div',
45 'html',
46 'meta',
47 'span',
48 ];
49
50 for (var i = 0; i < shouldHaveIntegrity.length; i++)
51 checkElement(shouldHaveIntegrity[i], ASSERT_INTEGRITY);
52
53 for (var i = 0; i < shouldNotHaveIntegrity.length; i++)
54 checkElement(shouldNotHaveIntegrity[i], ASSERT_NO_INTEGRITY);
55 </script>
56 </body>
57 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698