| 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 "chrome/browser/ui/webui/options/options_browsertest.h"'); | 5 GEN('#include "chrome/browser/ui/webui/options/options_browsertest.h"'); |
| 6 | 6 |
| 7 /** @const */ var MANAGED_USERS_PREF = 'profile.managed_users'; | 7 /** @const */ var SUPERVISED_USERS_PREF = 'profile.managed_users'; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Wait for the method specified by |methodName|, on the |object| object, to be | 10 * Wait for the method specified by |methodName|, on the |object| object, to be |
| 11 * called, then execute |afterFunction|. | 11 * called, then execute |afterFunction|. |
| 12 * @param {*} object Object with callable property named |methodName|. | 12 * @param {*} object Object with callable property named |methodName|. |
| 13 * @param {string} methodName The name of the property on |object| to use as a | 13 * @param {string} methodName The name of the property on |object| to use as a |
| 14 * callback. | 14 * callback. |
| 15 * @param {!Function} afterFunction A function to call after object.methodName() | 15 * @param {!Function} afterFunction A function to call after object.methodName() |
| 16 * is called. | 16 * is called. |
| 17 */ | 17 */ |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 __proto__: testing.Test.prototype, | 365 __proto__: testing.Test.prototype, |
| 366 | 366 |
| 367 /** @override */ | 367 /** @override */ |
| 368 browsePreload: 'chrome://settings-frame', | 368 browsePreload: 'chrome://settings-frame', |
| 369 | 369 |
| 370 /** @override */ | 370 /** @override */ |
| 371 typedefCppFixture: 'OptionsBrowserTest', | 371 typedefCppFixture: 'OptionsBrowserTest', |
| 372 | 372 |
| 373 testGenPreamble: function() { | 373 testGenPreamble: function() { |
| 374 // Start with no supervised users managed by this profile. | 374 // Start with no supervised users managed by this profile. |
| 375 GEN(' ClearPref("' + MANAGED_USERS_PREF + '");'); | 375 GEN(' ClearPref("' + SUPERVISED_USERS_PREF + '");'); |
| 376 }, | 376 }, |
| 377 | 377 |
| 378 /** @override */ | 378 /** @override */ |
| 379 isAsync: true, | 379 isAsync: true, |
| 380 | 380 |
| 381 /** @override */ | 381 /** @override */ |
| 382 setUp: function() { | 382 setUp: function() { |
| 383 // user-image-stream is a streaming video element used for capturing a | 383 // user-image-stream is a streaming video element used for capturing a |
| 384 // user image during OOBE. | 384 // user image during OOBE. |
| 385 this.accessibilityAuditConfig.ignoreSelectors('videoWithoutCaptions', | 385 this.accessibilityAuditConfig.ignoreSelectors('videoWithoutCaptions', |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 | 802 |
| 803 // A tip should be shown or hidden depending on whether this profile manages any | 803 // A tip should be shown or hidden depending on whether this profile manages any |
| 804 // supervised users. | 804 // supervised users. |
| 805 TEST_F('OptionsWebUIExtendedTest', 'SupervisingUsers', function() { | 805 TEST_F('OptionsWebUIExtendedTest', 'SupervisingUsers', function() { |
| 806 // We start managing no supervised users. | 806 // We start managing no supervised users. |
| 807 assertTrue($('profiles-supervised-dashboard-tip').hidden); | 807 assertTrue($('profiles-supervised-dashboard-tip').hidden); |
| 808 | 808 |
| 809 // Remove all supervised users, then add some, watching for the pref change | 809 // Remove all supervised users, then add some, watching for the pref change |
| 810 // notifications and UI updates in each case. Any non-empty pref dictionary | 810 // notifications and UI updates in each case. Any non-empty pref dictionary |
| 811 // is interpreted as having supervised users. | 811 // is interpreted as having supervised users. |
| 812 chrome.send('optionsTestSetPref', [MANAGED_USERS_PREF, {key: 'value'}]); | 812 chrome.send('optionsTestSetPref', [SUPERVISED_USERS_PREF, {key: 'value'}]); |
| 813 waitForResponse(BrowserOptions, 'updateManagesSupervisedUsers', function() { | 813 waitForResponse(BrowserOptions, 'updateManagesSupervisedUsers', function() { |
| 814 assertFalse($('profiles-supervised-dashboard-tip').hidden); | 814 assertFalse($('profiles-supervised-dashboard-tip').hidden); |
| 815 chrome.send('optionsTestSetPref', [MANAGED_USERS_PREF, {}]); | 815 chrome.send('optionsTestSetPref', [SUPERVISED_USERS_PREF, {}]); |
| 816 waitForResponse(BrowserOptions, 'updateManagesSupervisedUsers', function() { | 816 waitForResponse(BrowserOptions, 'updateManagesSupervisedUsers', function() { |
| 817 assertTrue($('profiles-supervised-dashboard-tip').hidden); | 817 assertTrue($('profiles-supervised-dashboard-tip').hidden); |
| 818 testDone(); | 818 testDone(); |
| 819 }); | 819 }); |
| 820 }); | 820 }); |
| 821 }); | 821 }); |
| 822 | 822 |
| 823 /** | 823 /** |
| 824 * TestFixture that loads the options page at a bogus URL. | 824 * TestFixture that loads the options page at a bogus URL. |
| 825 * @extends {OptionsWebUIExtendedTest} | 825 * @extends {OptionsWebUIExtendedTest} |
| 826 * @constructor | 826 * @constructor |
| 827 */ | 827 */ |
| 828 function OptionsWebUIRedirectTest() { | 828 function OptionsWebUIRedirectTest() { |
| 829 OptionsWebUIExtendedTest.call(this); | 829 OptionsWebUIExtendedTest.call(this); |
| 830 } | 830 } |
| 831 | 831 |
| 832 OptionsWebUIRedirectTest.prototype = { | 832 OptionsWebUIRedirectTest.prototype = { |
| 833 __proto__: OptionsWebUIExtendedTest.prototype, | 833 __proto__: OptionsWebUIExtendedTest.prototype, |
| 834 | 834 |
| 835 /** @override */ | 835 /** @override */ |
| 836 browsePreload: 'chrome://settings-frame/nonexistantPage', | 836 browsePreload: 'chrome://settings-frame/nonexistantPage', |
| 837 }; | 837 }; |
| 838 | 838 |
| 839 TEST_F('OptionsWebUIRedirectTest', 'TestURL', function() { | 839 TEST_F('OptionsWebUIRedirectTest', 'TestURL', function() { |
| 840 assertEquals('chrome://settings-frame/', document.location.href); | 840 assertEquals('chrome://settings-frame/', document.location.href); |
| 841 this.verifyHistory_([''], testDone); | 841 this.verifyHistory_([''], testDone); |
| 842 }); | 842 }); |
| OLD | NEW |