| 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/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} |
| 11 */ | 11 */ |
| 12 function IdentityInternalsUIBrowserTest() {} | 12 function IdentityInternalsUIBrowserTest() {} |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Base fixture for Downloads WebUI testing. | 15 * Base fixture for Downloads WebUI testing. |
| 16 * @extends {testing.Test} | 16 * @extends {testing.Test} |
| 17 * @constructor | 17 * @constructor |
| 18 */ | 18 */ |
| 19 function BaseIdentityInternalsWebUITest() {} | 19 function BaseIdentityInternalsWebUITest() {} |
| 20 | 20 |
| 21 BaseIdentityInternalsWebUITest.prototype = { | 21 BaseIdentityInternalsWebUITest.prototype = { |
| 22 __proto__: testing.Test.prototype, | 22 __proto__: testing.Test.prototype, |
| 23 | 23 |
| 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 browsePreloadAndWaitForMain: '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 {!NodeList} 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'); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 IdentityInternalsWebUITestAsync.prototype = { | 238 IdentityInternalsWebUITestAsync.prototype = { |
| 239 __proto__: IdentityInternalsMultipleTokensWebUITest.prototype, | 239 __proto__: IdentityInternalsMultipleTokensWebUITest.prototype, |
| 240 | 240 |
| 241 /** @override */ | 241 /** @override */ |
| 242 isAsync: true, | 242 isAsync: true, |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 TEST_F('IdentityInternalsWebUITestAsync', 'revokeToken', function() { | 245 TEST_F('IdentityInternalsWebUITestAsync', 'revokeToken', function() { |
| 246 var tokenListBefore = this.getTokens(); | 246 var tokenListBefore = this.getTokens(); |
| 247 expectEquals(2, tokenListBefore.length); | 247 expectEquals(2, tokenListBefore.length); |
| 248 var tokenRevokeDone = identity_internals.tokenRevokeDone; | 248 window.revokeTokenTest = this.continueTest( |
| 249 identity_internals.tokenRevokeDone = this.continueTest( | |
| 250 WhenTestDone.ALWAYS, function(accessTokens) { | 249 WhenTestDone.ALWAYS, function(accessTokens) { |
| 251 tokenRevokeDone.call(identity_internals, accessTokens); | |
| 252 identity_internals.tokenRevokeDone = tokenRevokeDone; | |
| 253 var tokenListAfter = this.getTokens(); | 250 var tokenListAfter = this.getTokens(); |
| 254 expectEquals(1, tokenListAfter.length); | 251 expectEquals(1, tokenListAfter.length); |
| 255 expectEquals(this.getAccessToken(tokenListBefore[0]), | 252 expectEquals(this.getAccessToken(tokenListBefore[0]), |
| 256 this.getAccessToken(tokenListAfter[0])); | 253 this.getAccessToken(tokenListAfter[0])); |
| 257 }.bind(this)); | 254 }.bind(this)); |
| 258 this.getRevokeButton(tokenListBefore[1]).click(); | 255 this.getRevokeButton(tokenListBefore[1]).click(); |
| 259 }); | 256 }); |
| 260 | |
| OLD | NEW |