OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 GEN('#include "chrome/browser/ui/webui/identity_internals_ui_browsertest.h"'); | 5 GEN('#include "chrome/browser/ui/webui/identity_internals_ui_browsertest.h"'); |
6 | 6 |
7 /** | 7 /** |
8 * Test C++ fixture for downloads WebUI testing. | 8 * Test C++ fixture for downloads WebUI testing. |
9 * @constructor | 9 * @constructor |
10 * @extends {testing.Test} | 10 * @extends {testing.Test} |
(...skipping 25 matching lines...) Expand all Loading... |
36 getTokens: function() { | 36 getTokens: function() { |
37 return document.querySelectorAll('#token-list > div'); | 37 return document.querySelectorAll('#token-list > div'); |
38 }, | 38 }, |
39 | 39 |
40 /** | 40 /** |
41 * Gets the expiration time displayed on the page for a given entry. | 41 * Gets the expiration time displayed on the page for a given entry. |
42 * @param {Element} tokenEntry Display element holding token information. | 42 * @param {Element} tokenEntry Display element holding token information. |
43 * @return {Date} Expiration date of the token. | 43 * @return {Date} Expiration date of the token. |
44 */ | 44 */ |
45 getExpirationTime: function(tokenEntry) { | 45 getExpirationTime: function(tokenEntry) { |
| 46 // Full-date format has 'at' between date and time in en-US, but |
| 47 // ECMAScript's Date.parse cannot grok it. |
46 return Date.parse(tokenEntry.querySelector('.expiration-time') | 48 return Date.parse(tokenEntry.querySelector('.expiration-time') |
47 .innerText); | 49 .innerText.replace(' at ', ' ')); |
48 }, | 50 }, |
49 | 51 |
50 /** | 52 /** |
51 * Gets the extension id displayed on the page for a given entry. | 53 * Gets the extension id displayed on the page for a given entry. |
52 * @param {Element} tokenEntry Display element holding token information. | 54 * @param {Element} tokenEntry Display element holding token information. |
53 * @return {string} Extension Id of the token. | 55 * @return {string} Extension Id of the token. |
54 */ | 56 */ |
55 getExtensionId: function(tokenEntry) { | 57 getExtensionId: function(tokenEntry) { |
56 return tokenEntry.querySelector('.extension-id').innerText; | 58 return tokenEntry.querySelector('.extension-id').innerText; |
57 }, | 59 }, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 expectEquals(tokenListEntries.length, actualTokens.length); | 157 expectEquals(tokenListEntries.length, actualTokens.length); |
156 expectEquals(tokenListEntries[0], actualTokens[0]); | 158 expectEquals(tokenListEntries[0], actualTokens[0]); |
157 expectEquals(this.getExtensionName(tokenListEntries[0]), | 159 expectEquals(this.getExtensionName(tokenListEntries[0]), |
158 tokenListEntries[0].querySelector('.extension-name').innerText); | 160 tokenListEntries[0].querySelector('.extension-name').innerText); |
159 expectEquals(this.getExtensionId(tokenListEntries[0]), | 161 expectEquals(this.getExtensionId(tokenListEntries[0]), |
160 tokenListEntries[0].querySelector('.extension-id').innerText); | 162 tokenListEntries[0].querySelector('.extension-id').innerText); |
161 expectEquals(this.getAccessToken(tokenListEntries[0]), | 163 expectEquals(this.getAccessToken(tokenListEntries[0]), |
162 tokenListEntries[0].querySelector('.access-token').innerText); | 164 tokenListEntries[0].querySelector('.access-token').innerText); |
163 expectEquals(this.getTokenStatus(tokenListEntries[0]), | 165 expectEquals(this.getTokenStatus(tokenListEntries[0]), |
164 tokenListEntries[0].querySelector('.token-status').innerText); | 166 tokenListEntries[0].querySelector('.token-status').innerText); |
| 167 // Full-date format has 'at' between date and time in en-US, but |
| 168 // ECMAScript's Date.parse cannot grok it. |
165 expectEquals(this.getExpirationTime(tokenListEntries[0]), | 169 expectEquals(this.getExpirationTime(tokenListEntries[0]), |
166 Date.parse(tokenListEntries[0].querySelector('.expiration-time') | 170 Date.parse(tokenListEntries[0].querySelector('.expiration-time') |
167 .innerText)); | 171 .innerText.replace(' at ', ' '))); |
168 var scopes = tokenListEntries[0].querySelector('.scope-list') | 172 var scopes = tokenListEntries[0].querySelector('.scope-list') |
169 .innerHTML.split('<br>'); | 173 .innerHTML.split('<br>'); |
170 var actualScopes = this.getScopes(tokenListEntries[0]); | 174 var actualScopes = this.getScopes(tokenListEntries[0]); |
171 expectEquals(scopes.length, actualScopes.length); | 175 expectEquals(scopes.length, actualScopes.length); |
172 for (var i = 0; i < scopes.length; i++) { | 176 for (var i = 0; i < scopes.length; i++) { |
173 expectEquals(scopes[i], actualScopes[i]); | 177 expectEquals(scopes[i], actualScopes[i]); |
174 } | 178 } |
175 }); | 179 }); |
176 | 180 |
177 /** | 181 /** |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 tokenRevokeDone.call(identity_internals, accessTokens); | 251 tokenRevokeDone.call(identity_internals, accessTokens); |
248 identity_internals.tokenRevokeDone = tokenRevokeDone; | 252 identity_internals.tokenRevokeDone = tokenRevokeDone; |
249 var tokenListAfter = this.getTokens(); | 253 var tokenListAfter = this.getTokens(); |
250 expectEquals(1, tokenListAfter.length); | 254 expectEquals(1, tokenListAfter.length); |
251 expectEquals(this.getAccessToken(tokenListBefore[0]), | 255 expectEquals(this.getAccessToken(tokenListBefore[0]), |
252 this.getAccessToken(tokenListAfter[0])); | 256 this.getAccessToken(tokenListAfter[0])); |
253 }.bind(this)); | 257 }.bind(this)); |
254 this.getRevokeButton(tokenListBefore[1]).click(); | 258 this.getRevokeButton(tokenListBefore[1]).click(); |
255 }); | 259 }); |
256 | 260 |
OLD | NEW |