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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html

Issue 1745963002: CREDENTIAL: Do type checks for credential constructors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
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({ 8 var credential = new PasswordCredential({
9 id: 'id', 9 id: 'id',
10 password: 'pencil', 10 password: 'pencil',
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 credential.idName = 'yay'; 80 credential.idName = 'yay';
81 assert_equals(credential.idName, 'yay'); 81 assert_equals(credential.idName, 'yay');
82 82
83 credential.passwordName = 'boo'; 83 credential.passwordName = 'boo';
84 assert_equals(credential.passwordName, 'boo'); 84 assert_equals(credential.passwordName, 'boo');
85 85
86 var additionalData = new FormData(); 86 var additionalData = new FormData();
87 credential.additionalData = additionalData; 87 credential.additionalData = additionalData;
88 assert_equals(credential.additionalData, additionalData); 88 assert_equals(credential.additionalData, additionalData);
89 }, 'Verify the basics of "idName", "passwordName", and "additionalData"'); 89 }, 'Verify the basics of "idName", "passwordName", and "additionalData"');
90
91 test(function() {
92 assert_throws(new TypeError(),
93 () => { new PasswordCredential(); });
94 assert_throws(new TypeError(),
95 () => { new PasswordCredential({}); });
96 assert_throws(new TypeError(),
97 () => { new PasswordCredential({ 'id': undefined }); });
98 assert_throws(new TypeError(),
99 () => { new PasswordCredential({ 'id': '' }); });
100 assert_throws(new TypeError(),
101 () => { new PasswordCredential({ 'password': undefined }); });
102 assert_throws(new TypeError(),
103 () => { new PasswordCredential({ 'password': '' }); });
104 assert_throws(new TypeError(),
105 () => { new PasswordCredential({ 'id': undefined, 'password': undefined }); });
106 assert_throws(new TypeError(),
107 () => { new PasswordCredential({ 'id': undefined, 'password': '' }); });
108 assert_throws(new TypeError(),
109 () => { new PasswordCredential({ 'id': undefined, 'password': undefined }); });
110 }, 'PasswordCredential objects require IDs and Passwords');
90 </script> 111 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698