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 3 // found in the LICENSE file. 4 5 /** 6 * TestFixture for browser options WebUI testing. 7 * @extends {testing.Test} 8 * @constructor 9 */ 10 function BrowserOptionsWebUITest() {} 11 12 BrowserOptionsWebUITest.prototype = { 13 __proto__: testing.Test.prototype, 14 15 /** @override */ 16 browsePreload: 'chrome://chrome/settings/', 17 }; 18 19 // Test opening the browser options has correct location. 20 // Times out on Mac debug only. See http://crbug.com/121030 21 GEN('#if defined(OS_MACOSX) && !defined(NDEBUG)'); 22 GEN('#define MAYBE_testOpenBrowserOptions ' + 23 'DISABLED_testOpenBrowserOptions'); 24 GEN('#else'); 25 GEN('#define MAYBE_testOpenBrowserOptions testOpenBrowserOptions'); 26 GEN('#endif // defined(OS_MACOSX)'); 27 TEST_F('BrowserOptionsWebUITest', 'MAYBE_testOpenBrowserOptions', function() { 28 assertEquals(this.browsePreload, document.location.href); 29 expectFalse($('navigation').classList.contains('background')); 30 }); 31 32 /** 33 * TestFixture for the uber page when the browser options page has an overlay. 34 * @extends {testing.Test} 35 * @constructor 36 */ 37 function BrowserOptionsOverlayWebUITest() {} 38 39 BrowserOptionsOverlayWebUITest.prototype = { 40 __proto__: testing.Test.prototype, 41 42 /** @override */ 43 browsePreload: 'chrome://chrome/settings/autofill', 44 45 /** @override */ 46 isAsync: true, 47 }; 48 49 TEST_F('BrowserOptionsOverlayWebUITest', 'testNavigationInBackground', 50 function() { 51 assertEquals(this.browsePreload, document.location.href); 52 53 if ($('navigation').classList.contains('background')) { 54 testDone(); 55 return; 56 } 57 58 // Wait for the message to be posted to the Uber page. 59 window.addEventListener('message', function(e) { 60 if (e.data.method == 'beginInterceptingEvents') { 61 window.setTimeout(function() { 62 assertTrue($('navigation').classList.contains('background')); 63 testDone(); 64 }); 65 } 66 }); 67 }); 68 69 /** 70 * @extends {testing.Test} 71 * @constructor 72 */ 73 function BrowserOptionsFrameWebUITest() {} 74 75 BrowserOptionsFrameWebUITest.prototype = { 76 __proto__: testing.Test.prototype, 77 78 /** @override */ 79 browsePreload: 'chrome://settings-frame/', 80 }; 81 82 TEST_F('BrowserOptionsFrameWebUITest', 'testAdvancedSettingsHiddenByDefault', 83 function() { 84 assertEquals(this.browsePreload, document.location.href); 85 expectTrue($('advanced-settings').hidden); 86 }); 87 88 /** 89 * @extends {testing.Test} 90 * @constructor 91 */ 92 function AdvancedSettingsWebUITest() {} 93 94 AdvancedSettingsWebUITest.prototype = { 95 __proto__: testing.Test.prototype, 96 97 /** @override */ 98 browsePreload: 'chrome://settings-frame/autofill', 99 }; 100 101 TEST_F('AdvancedSettingsWebUITest', 'testAdvancedSettingsShown', function() { 102 assertEquals(this.browsePreload, document.location.href); 103 expectFalse($('advanced-settings').hidden); 104 }); 105