Chromium Code Reviews| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 expectEquals('token1', this.getAccessToken(tokenListEntries[1])); | 219 expectEquals('token1', this.getAccessToken(tokenListEntries[1])); |
| 220 expectEquals('Token Present', this.getTokenStatus(tokenListEntries[1])); | 220 expectEquals('Token Present', this.getTokenStatus(tokenListEntries[1])); |
| 221 expectLT(this.getExpirationTime(tokenListEntries[1]) - new Date(), | 221 expectLT(this.getExpirationTime(tokenListEntries[1]) - new Date(), |
| 222 3600 * 1000); | 222 3600 * 1000); |
| 223 var scopes = this.getScopes(tokenListEntries[1]); | 223 var scopes = this.getScopes(tokenListEntries[1]); |
| 224 expectEquals(3, scopes.length); | 224 expectEquals(3, scopes.length); |
| 225 expectEquals('scope_1_1', scopes[0]); | 225 expectEquals('scope_1_1', scopes[0]); |
| 226 expectEquals('scope_2_1', scopes[1]); | 226 expectEquals('scope_2_1', scopes[1]); |
| 227 expectEquals('', scopes[2]); | 227 expectEquals('', scopes[2]); |
| 228 }); | 228 }); |
| 229 | |
| 230 /** | |
| 231 * Fixture for asynchronous testing of Identity Internals Web UI with multiple | |
| 232 * tokens in Identity API token cache. | |
| 233 * @extends {IdentityInternalsMultipleTokensWebUITest} | |
| 234 * @constructor | |
| 235 */ | |
| 236 function IdentityInternalsWebUITestAsync() {} | |
| 237 | |
| 238 IdentityInternalsWebUITestAsync.prototype = { | |
| 239 __proto__: IdentityInternalsMultipleTokensWebUITest.prototype, | |
| 240 | |
| 241 /** @override */ | |
| 242 isAsync: true, | |
| 243 }; | |
| 244 | |
| 245 TEST_F('IdentityInternalsWebUITestAsync', 'revokeToken', function() { | |
| 246 var tokenListBefore = this.getTokens(); | |
| 247 expectEquals(2, tokenListBefore.length); | |
| 248 var tokenRevokeDone = identity_internals.tokenRevokeDone; | |
| 249 identity_internals.tokenRevokeDone = this.continueTest( | |
|
Elliot Glaysher
2014/07/21 21:56:03
This test was removed because I don't believe we c
fgorski
2014/07/23 19:02:09
Is there a long term solution to a problem. I was
Elliot Glaysher
2014/07/23 20:20:04
There isn't a generic way to do this (and long ter
| |
| 250 WhenTestDone.ALWAYS, function(accessTokens) { | |
| 251 tokenRevokeDone.call(identity_internals, accessTokens); | |
| 252 identity_internals.tokenRevokeDone = tokenRevokeDone; | |
| 253 var tokenListAfter = this.getTokens(); | |
| 254 expectEquals(1, tokenListAfter.length); | |
| 255 expectEquals(this.getAccessToken(tokenListBefore[0]), | |
| 256 this.getAccessToken(tokenListAfter[0])); | |
| 257 }.bind(this)); | |
| 258 this.getRevokeButton(tokenListBefore[1]).click(); | |
| 259 }); | |
| 260 | |
| OLD | NEW |