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

Side by Side Diff: LayoutTests/manifest/link-manifest-url.html

Issue 270283007: Implement the logic to find the correct <link> for Manifest in Document. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@link_manifest
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | Source/core/dom/Document.h » ('j') | Source/core/dom/Document.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel='manifest' href='foo.json'>
5 </head>
6 <body>
7 <script src="../resources/testharness.js"></script>
8 <script src="../resources/testharnessreport.js"></script>
9 <script>
10 var links = document.getElementsByTagName('link');
11
12 test(function() {
13 assert_equals(links[0], window.internals.linkManifest(document));
14 }, "Test that the parser correctly find the manifest");
15
16 test(function() {
17 links[0].href = 'foobar.json';
18 assert_equals(links[0].href, window.internals.linkManifest(document).href);
19 }, "Test that changing the href will change the known URL");
20
21 test(function() {
22 links[0].href = 'htp:/blah';
23 assert_equals(links[0], window.internals.linkManifest(document));
24 }, "Test that invalid URL are accepted");
25
26 test(function() {
27 links[0].href = '';
28 assert_equals(links[0], window.internals.linkManifest(document));
29 }, "Test that empty URL are accepted");
30
31 test(function() {
32 links[0].href = 'http://example.com/manifest.json';
33 assert_equals(links[0], window.internals.linkManifest(document));
34 }, "Test that cross-origin URL are accepted");
35
36 test(function() {
37 links[0].rel = "foo bar manifest";
38 links[0].href = 'http://example.com/manifest.json';
39 assert_equals(links[0], window.internals.linkManifest(document));
40 }, "Test that having multiple tokens in @rel will keep thi link as a manifest" );
41
42 test(function() {
43 var link = document.createElement('link');
44 link.rel = 'manifest';
45 link.href = 'foobar.json';
46 document.head.appendChild(link);
47 assert_equals(links[0], window.internals.linkManifest(document));
48
49 link = document.createElement('link');
50 link.rel = 'manifest';
51 link.href = 'manifest.json';
52 document.head.insertBefore(link, links[0]);
53 assert_equals(links[0], window.internals.linkManifest(document));
54 }, "Test that the first manifest is always being used");
55
56 test(function() {
57 // Remove all current links.
58 while (document.head.firstChild)
59 document.head.removeChild(document.head.firstChild);
60
61 // Add link to the body.
62 var link = document.createElement('link');
63 link.rel = 'manifest';
64 link.href = 'manifest.json';
65 document.body.appendChild(link);
66
67 assert_not_equals(links[0], window.internals.linkManifest(document));
68 }, "Test that links outside of the head are ignored");
69
70 test(function() {
71 // Add a clean <link rel='manifest'>.
72 var link = document.createElement('link');
73 link.rel = 'manifest';
74 link.href = 'foobar.json';
75 link.type = 'application/manifest+json';
76 document.head.appendChild(link);
77
78 links[0].crossOrigin = 'use-credentials';
79 assert_equals(links[0], window.internals.linkManifest(document));
80
81 links[0].setAttribute('hreflang', 'klingon');
82 assert_equals(links[0], window.internals.linkManifest(document));
83
84 links[0].type = 'image/gif';
85 assert_equals(links[0], window.internals.linkManifest(document));
86
87 links[0].setAttribute('sizes', '16x16');
88 assert_equals(links[0], window.internals.linkManifest(document));
89 }, "Test that attributes on the element do not affect which one is used.");
90
91 </script>
92 </body>
93 </html>
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Document.h » ('j') | Source/core/dom/Document.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698