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

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

Issue 2884703002: Implement CredentialsContainer::create (Closed)
Patch Set: RaisesException Created 3 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Credential Manager: create() basics.</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="/serviceworker/resources/interfaces.js"></script>
6 <script>
7 promise_test(function(t) {
8 var credential_data = {
9 id: 'id',
10 password: 'pencil',
11 };
12
13 return navigator.credentials.create({password: credential_data})
14 .then(function(credential) {
15 assert_equals(credential.idName, 'username');
16 assert_equals(credential.passwordName, 'password');
17 assert_equals(credential.additionalData, null);
18 });
19 }, "navigator.credentials.create() with valid PasswordCredentialData");
20
21 promise_test(function(t) {
22 var f = document.createElement('form');
23 f.innerHTML = "<input type='text' name='theId' value='musterman' autocomplet e='username'>"
24 + "<input type='text' name='thePassword' value='sekrit' autocomplete='cu rrent-password'>"
25 + "<input type='text' name='theIcon' value='https://example.com/photo' a utocomplete='photo'>"
26 + "<input type='text' name='theExtraField' value='extra'>"
27 + "<input type='text' name='theName' value='friendly name' autocomplete= 'name'>";
28
29 return navigator.credentials.create({password: f})
30 .then(function(credential) {
31 assert_equals(credential.idName, 'theId');
32 assert_equals(credential.passwordName, 'thePassword');
33
34 assert_equals(credential.additionalData.get('theId'), 'musterman');
35 assert_equals(credential.additionalData.get('thePassword'), 'sekrit' );
36 assert_equals(credential.additionalData.get('theIcon'),
37 'https://example.com/photo');
38 assert_equals(credential.additionalData.get('theName'), 'friendly na me');
39 assert_equals(credential.additionalData.get('theExtraField'), 'extra ');
40 });
41 }, "navigator.credentials.create() with valid HTMLFormElement");
42 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698