| 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 13 matching lines...) Expand all Loading... |
| 24 /** | 24 /** |
| 25 * Browse to the downloads page & call our preLoad(). | 25 * Browse to the downloads page & call our preLoad(). |
| 26 */ | 26 */ |
| 27 browsePreload: 'chrome://identity-internals', | 27 browsePreload: 'chrome://identity-internals', |
| 28 | 28 |
| 29 /** @override */ | 29 /** @override */ |
| 30 typedefCppFixture: 'IdentityInternalsUIBrowserTest', | 30 typedefCppFixture: 'IdentityInternalsUIBrowserTest', |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * Gets all of the token entries on the page. | 33 * Gets all of the token entries on the page. |
| 34 * return {Element[]} Elements displaying token information. | 34 * @return {!NodeList} Elements displaying token information. |
| 35 */ | 35 */ |
| 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 */ |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 * Fixture for asynchronous testing of Identity Internals Web UI with multiple | 227 * Fixture for asynchronous testing of Identity Internals Web UI with multiple |
| 228 * tokens in Identity API token cache. | 228 * tokens in Identity API token cache. |
| 229 * @extends {IdentityInternalsMultipleTokensWebUITest} | 229 * @extends {IdentityInternalsMultipleTokensWebUITest} |
| 230 * @constructor | 230 * @constructor |
| 231 */ | 231 */ |
| 232 function IdentityInternalsWebUITestAsync() {} | 232 function IdentityInternalsWebUITestAsync() {} |
| 233 | 233 |
| 234 IdentityInternalsWebUITestAsync.prototype = { | 234 IdentityInternalsWebUITestAsync.prototype = { |
| 235 __proto__: IdentityInternalsMultipleTokensWebUITest.prototype, | 235 __proto__: IdentityInternalsMultipleTokensWebUITest.prototype, |
| 236 | 236 |
| 237 /** @inhritDoc */ | 237 /** @override */ |
| 238 isAsync: true, | 238 isAsync: true, |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 TEST_F('IdentityInternalsWebUITestAsync', 'revokeToken', function() { | 241 TEST_F('IdentityInternalsWebUITestAsync', 'revokeToken', function() { |
| 242 var tokenListBefore = this.getTokens(); | 242 var tokenListBefore = this.getTokens(); |
| 243 expectEquals(2, tokenListBefore.length); | 243 expectEquals(2, tokenListBefore.length); |
| 244 var tokenRevokeDone = identity_internals.tokenRevokeDone; | 244 var tokenRevokeDone = identity_internals.tokenRevokeDone; |
| 245 identity_internals.tokenRevokeDone = this.continueTest( | 245 identity_internals.tokenRevokeDone = this.continueTest( |
| 246 WhenTestDone.ALWAYS, function (accessTokens) { | 246 WhenTestDone.ALWAYS, function(accessTokens) { |
| 247 tokenRevokeDone.call(identity_internals, accessTokens); | 247 tokenRevokeDone.call(identity_internals, accessTokens); |
| 248 identity_internals.tokenRevokeDone = tokenRevokeDone; | 248 identity_internals.tokenRevokeDone = tokenRevokeDone; |
| 249 var tokenListAfter = this.getTokens(); | 249 var tokenListAfter = this.getTokens(); |
| 250 expectEquals(1, tokenListAfter.length); | 250 expectEquals(1, tokenListAfter.length); |
| 251 expectEquals(this.getAccessToken(tokenListBefore[0]), | 251 expectEquals(this.getAccessToken(tokenListBefore[0]), |
| 252 this.getAccessToken(tokenListAfter[0])); | 252 this.getAccessToken(tokenListAfter[0])); |
| 253 }.bind(this)); | 253 }.bind(this)); |
| 254 this.getRevokeButton(tokenListBefore[1]).click(); | 254 this.getRevokeButton(tokenListBefore[1]).click(); |
| 255 }); | 255 }); |
| 256 | 256 |
| OLD | NEW |