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

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

Issue 1446963002: CREDENTIAL: Teach Fetch to handle PasswordCredential objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@opaque
Patch Set: Better Created 5 years, 1 month 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',
11 name: 'name', 11 name: 'name',
12 iconURL: 'https://example.com/icon.png' 12 iconURL: 'https://example.com/icon.png'
13 }); 13 });
14 14
15 verify_interface('PasswordCredential', credential, { 15 verify_interface('PasswordCredential', credential, {
16 id: 'string', 16 id: 'string',
17 name: 'string', 17 name: 'string',
18 iconURL: 'string', 18 iconURL: 'string',
19 type: 'string' 19 type: 'string'
20 }); 20 });
21 21
22 assert_equals(credential.id, 'id'); 22 assert_equals(credential.id, 'id');
23 assert_equals(credential.name, 'name'); 23 assert_equals(credential.name, 'name');
24 assert_equals(credential.iconURL, 'https://example.com/icon.png'); 24 assert_equals(credential.iconURL, 'https://example.com/icon.png');
25 assert_equals(credential.type, 'password'); 25 assert_equals(credential.type, 'password');
26 26 assert_equals(credential.idName, 'username');
27 assert_true(credential.toFormData() instanceof FormData); 27 assert_equals(credential.passwordName, 'password');
28 assert_equals(credential.additionalData, null);
28 }, 'Interfaces and attributes of PasswordCredential'); 29 }, 'Interfaces and attributes of PasswordCredential');
29 30
30 test(function() { 31 test(function() {
31 assert_throws(new SyntaxError(), function () { 32 assert_throws(new SyntaxError(), function () {
32 var credential = new PasswordCredential({ 33 var credential = new PasswordCredential({
33 id: 'id', 34 id: 'id',
34 password: 'pencil', 35 password: 'pencil',
35 name: 'name', 36 name: 'name',
36 iconURL: '-' 37 iconURL: '-'
37 }); 38 });
38 }); 39 });
39 }, 'Construct a PasswordCredential with an invalid icon URL.'); 40 }, 'Construct a PasswordCredential with an invalid icon URL.');
40 41
41 test(function() { 42 test(function() {
42 var credential = new PasswordCredential({ 43 var credential = new PasswordCredential({
43 id: 'id', 44 id: 'id',
44 password: 'pencil', 45 password: 'pencil',
45 name: 'name', 46 name: 'name',
46 }); 47 });
47 48
48 assert_equals(credential.id, 'id'); 49 assert_equals(credential.id, 'id');
49 assert_equals(credential.name, 'name'); 50 assert_equals(credential.name, 'name');
50 assert_equals(credential.iconURL, ''); 51 assert_equals(credential.iconURL, '');
51 assert_equals(credential.type, 'password'); 52 assert_equals(credential.type, 'password');
52 assert_true(credential.toFormData() instanceof FormData); 53 assert_equals(credential.idName, 'username');
54 assert_equals(credential.passwordName, 'password');
55 assert_equals(credential.additionalData, null);
53 56
54 }, 'Construct a PasswordCredential with an empty icon URL.'); 57 }, 'Construct a PasswordCredential with an empty icon URL.');
55 58
56 test(function() { 59 test(function() {
57 var credential = new PasswordCredential({ 60 var credential = new PasswordCredential({
58 id: 'id', 61 id: 'id',
59 password: 'pencil', 62 password: 'pencil',
60 }); 63 });
61 64
62 assert_equals(credential.id, 'id'); 65 assert_equals(credential.id, 'id');
63 assert_equals(credential.name, ''); 66 assert_equals(credential.name, '');
64 assert_equals(credential.iconURL, ''); 67 assert_equals(credential.iconURL, '');
65 assert_equals(credential.type, 'password'); 68 assert_equals(credential.type, 'password');
66 assert_true(credential.toFormData() instanceof FormData); 69 assert_equals(credential.idName, 'username');
70 assert_equals(credential.passwordName, 'password');
71 assert_equals(credential.additionalData, null);
67 }, 'Construct a PasswordCredential with an empty name and icon URL.'); 72 }, 'Construct a PasswordCredential with an empty name and icon URL.');
73
74 test(function() {
75 var credential = new PasswordCredential({
76 id: 'id',
77 password: 'pencil',
78 });
79
80 credential.idName = 'yay';
81 assert_equals(credential.idName, 'yay');
82
83 credential.passwordName = 'boo';
84 assert_equals(credential.passwordName, 'boo');
85
86 credential.additionalData = new FormData();
87 assert_true(credential.additionalData instanceof FormData);
philipj_slow 2015/11/17 15:53:59 Maybe assert that it is the same object that was a
Mike West 2015/11/18 09:12:50 Sounds good.
88 }, 'Poke at the Fetch-related bits');
philipj_slow 2015/11/17 15:53:59 An honest name, but maybe "something something bas
Mike West 2015/11/18 09:12:50 :)
68 </script> 89 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698