OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Credential Manager: PasswordCredential basics.</title> | 2 <title>Credential Manager: PasswordCredential basics.</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src="/serviceworker/resources/interfaces.js"></script> | 5 <script src="/serviceworker/resources/interfaces.js"></script> |
6 <script> | 6 <script> |
7 test(function() { | 7 test(function() { |
8 var credential = new PasswordCredential('id', 'pencil', 'name', 'https://exa mple.com/icon.png'); | 8 var credential = new PasswordCredential('id', 'pencil', 'name', 'https://exa mple.com/icon.png'); |
9 | 9 |
10 verify_interface('PasswordCredential', credential, { | 10 verify_interface('PasswordCredential', credential, { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 assert_equals(fd.has('n3'), false); | 69 assert_equals(fd.has('n3'), false); |
70 | 70 |
71 assert_array_equals(fd.getAll('n1'), []); | 71 assert_array_equals(fd.getAll('n1'), []); |
72 assert_array_equals(fd.getAll('n2'), []); | 72 assert_array_equals(fd.getAll('n2'), []); |
73 assert_array_equals(fd.getAll('n3'), []); | 73 assert_array_equals(fd.getAll('n3'), []); |
74 | 74 |
75 for(var entry of fd) { | 75 for(var entry of fd) { |
76 assert_unreached("There should be nothing to iterate here."); | 76 assert_unreached("There should be nothing to iterate here."); |
77 } | 77 } |
78 }, 'Verify properties of opaque FormData.'); | 78 }, 'Verify properties of opaque FormData.'); |
79 | |
80 (function() { | |
philipj_slow
2015/09/02 12:12:48
I guess this is consistent with other tests around
| |
81 var t = async_test("Verify properties of opaque Requests."); | |
82 | |
83 var credential = new PasswordCredential('id', 'pencil'); | |
84 var fd = credential.toFormData(); | |
85 fd.append('n1', 'v1'); | |
86 fd.append('n2', 'v2'); | |
87 fd.append('n3', 'v3'); | |
88 fd.append('n1', 'v4'); | |
89 fd.append('n2', 'v5'); | |
90 fd.append('n3', 'v6'); | |
91 | |
92 t.step(function () { | |
93 var r = new Request("http://127.0.0.1:8000", { body: fd, method: "POST" }); | |
94 r.arrayBuffer().then( | |
95 t.step_func(function (data) { | |
philipj_slow
2015/09/02 12:12:48
t.unreached_func("The arrayBuffer() method should
| |
96 assert_unreached("The arrayBuffer() method should reject.") | |
97 }), | |
98 t.step_func(function (e) { | |
philipj_slow
2015/09/02 12:12:48
Can use step_func_done if you like, it doesn't mak
| |
99 assert_equals(e.name, "TypeError"); | |
100 t.done(); | |
101 })); | |
102 }); | |
103 t.step(function () { | |
104 var r = new Request("http://127.0.0.1:8000", { body: fd, method: "POST" }); | |
105 r.blob().then( | |
philipj_slow
2015/09/02 12:12:48
It looks like you could share all of the duplicate
| |
106 t.step_func(function (data) { | |
107 assert_unreached("The blob() method should reject.") | |
108 }), | |
109 t.step_func(function (e) { | |
110 assert_equals(e.name, "TypeError"); | |
111 t.done(); | |
112 })); | |
113 }); | |
114 t.step(function () { | |
115 var r = new Request("http://127.0.0.1:8000", { body: fd, method: "POST" }); | |
116 r.json().then( | |
117 t.step_func(function (data) { | |
118 assert_unreached("The json() method should reject.") | |
119 }), | |
120 t.step_func(function (e) { | |
121 assert_equals(e.name, "TypeError"); | |
122 t.done(); | |
123 })); | |
124 }); | |
125 t.step(function () { | |
126 var r = new Request("http://127.0.0.1:8000", { body: fd, method: "POST" }); | |
127 r.text().then( | |
128 t.step_func(function (data) { | |
129 assert_unreached("The text() method should reject.") | |
130 }), | |
131 t.step_func(function (e) { | |
132 assert_equals(e.name, "TypeError"); | |
133 t.done(); | |
134 })); | |
135 }); | |
136 | |
137 | |
138 }()); | |
79 </script> | 139 </script> |
OLD | NEW |