| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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(['options_browsertest_base.js']); | 5 GEN_INCLUDE(['options_browsertest_base.js']); |
| 6 GEN('#include "chrome/browser/ui/webui/options/options_browsertest.h"'); | 6 GEN('#include "chrome/browser/ui/webui/options/options_browsertest.h"'); |
| 7 | 7 |
| 8 /** @const */ var SUPERVISED_USERS_PREF = 'profile.managed_users'; | 8 /** @const */ var SUPERVISED_USERS_PREF = 'profile.managed_users'; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 resultSorted.sort(); | 406 resultSorted.sort(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 for (var i = 0; i < expectedSorted.length; ++i) { | 409 for (var i = 0; i < expectedSorted.length; ++i) { |
| 410 assertEquals(expectedSorted[i], resultSorted[i], errorMessage); | 410 assertEquals(expectedSorted[i], resultSorted[i], errorMessage); |
| 411 } | 411 } |
| 412 }, | 412 }, |
| 413 | 413 |
| 414 /** | 414 /** |
| 415 * Verifies that the correct pages are currently open/visible. | 415 * Verifies that the correct pages are currently open/visible. |
| 416 * @param {!Array.<string>} expectedPages An array of page names expected to | 416 * @param {!Array<string>} expectedPages An array of page names expected to |
| 417 * be open, with the topmost listed last. | 417 * be open, with the topmost listed last. |
| 418 * @param {string=} opt_expectedUrl The URL path, including hash, expected to | 418 * @param {string=} opt_expectedUrl The URL path, including hash, expected to |
| 419 * be open. If undefined, the topmost (last) page name in |expectedPages| | 419 * be open. If undefined, the topmost (last) page name in |expectedPages| |
| 420 * will be used. In either case, 'chrome://settings-frame/' will be | 420 * will be used. In either case, 'chrome://settings-frame/' will be |
| 421 * prepended. | 421 * prepended. |
| 422 * @private | 422 * @private |
| 423 */ | 423 */ |
| 424 verifyOpenPages_: function(expectedPages, opt_expectedUrl) { | 424 verifyOpenPages_: function(expectedPages, opt_expectedUrl) { |
| 425 // Check the topmost page. | 425 // Check the topmost page. |
| 426 expectEquals(null, PageManager.getVisibleBubble()); | 426 expectEquals(null, PageManager.getVisibleBubble()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 450 PageManager.registeredOverlayPages[name]; | 450 PageManager.registeredOverlayPages[name]; |
| 451 if (page.visible) | 451 if (page.visible) |
| 452 openPages.push(page.name); | 452 openPages.push(page.name); |
| 453 } | 453 } |
| 454 | 454 |
| 455 this.compareArrays_(expectedPages, openPages, true, 'Open pages'); | 455 this.compareArrays_(expectedPages, openPages, true, 'Open pages'); |
| 456 }, | 456 }, |
| 457 | 457 |
| 458 /* | 458 /* |
| 459 * Verifies that the correct URLs are listed in the history. Asynchronous. | 459 * Verifies that the correct URLs are listed in the history. Asynchronous. |
| 460 * @param {!Array.<string>} expectedHistory An array of URL paths expected to | 460 * @param {!Array<string>} expectedHistory An array of URL paths expected to |
| 461 * be in the tab navigation history, sorted by visit time, including the | 461 * be in the tab navigation history, sorted by visit time, including the |
| 462 * current page as the last entry. The base URL (chrome://settings-frame/) | 462 * current page as the last entry. The base URL (chrome://settings-frame/) |
| 463 * will be prepended to each. An initial 'about:blank' history entry is | 463 * will be prepended to each. An initial 'about:blank' history entry is |
| 464 * assumed and should not be included in this list. | 464 * assumed and should not be included in this list. |
| 465 * @param {Function=} callback A function to be called after the history has | 465 * @param {Function=} callback A function to be called after the history has |
| 466 * been verified successfully. May be undefined. | 466 * been verified successfully. May be undefined. |
| 467 * @private | 467 * @private |
| 468 */ | 468 */ |
| 469 verifyHistory_: function(expectedHistory, callback) { | 469 verifyHistory_: function(expectedHistory, callback) { |
| 470 var self = this; | 470 var self = this; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 __proto__: OptionsWebUIExtendedTest.prototype, | 872 __proto__: OptionsWebUIExtendedTest.prototype, |
| 873 | 873 |
| 874 /** @override */ | 874 /** @override */ |
| 875 browsePreload: 'chrome://settings-frame/nonexistantPage', | 875 browsePreload: 'chrome://settings-frame/nonexistantPage', |
| 876 }; | 876 }; |
| 877 | 877 |
| 878 TEST_F('OptionsWebUIRedirectTest', 'TestURL', function() { | 878 TEST_F('OptionsWebUIRedirectTest', 'TestURL', function() { |
| 879 assertEquals('chrome://settings-frame/', document.location.href); | 879 assertEquals('chrome://settings-frame/', document.location.href); |
| 880 this.verifyHistory_([''], testDone); | 880 this.verifyHistory_([''], testDone); |
| 881 }); | 881 }); |
| OLD | NEW |