Home | History | Annotate | Download | only in options
      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
      3 // found in the LICENSE file.
      4 
      5 /**
      6  * TestFixture for App Launcher's Settings App testing.
      7  * @extends {testing.Test}
      8  * @constructor
      9  */
     10 function SettingsAppWebUITest() {}
     11 
     12 SettingsAppWebUITest.prototype = {
     13   __proto__: testing.Test.prototype,
     14 
     15   /**
     16    * Browse to Settings App page, in a browser.
     17    */
     18   browsePreload: 'chrome://settings-frame/options_settings_app.html',
     19 };
     20 
     21 GEN('#if defined(ENABLE_SETTINGS_APP)');
     22 
     23 // Test opening Settings App, and do some checks on section visibility.
     24 TEST_F('SettingsAppWebUITest', 'testOpenSettingsApp', function() {
     25   // Note there is no location bar in the Settings App.
     26 
     27   // Some things are hidden via a parent, so make a helper function.
     28   function isVisible(elementId) {
     29     var elem = $(elementId);
     30     return elem.offsetWidth > 0 || elem.offsetHeight > 0;
     31   }
     32   assertTrue(OptionsPage.isSettingsApp());
     33   assertTrue(isVisible('sync-users-section'));
     34   assertTrue(isVisible('sync-section'));
     35 
     36   // Spot-check some regular settings items that should be hidden.
     37   assertFalse(isVisible('change-home-page-section'));
     38   assertFalse(isVisible('default-search-engine'));
     39   assertFalse(isVisible('hotword-search'));
     40   assertFalse(isVisible('privacy-section'));
     41   assertFalse(isVisible('startup-section'));
     42 });
     43 
     44 // Check functionality of LoadTimeData.overrideValues(), which the Settings App
     45 // uses. Do spot checks, so the test is not too fragile. Some of the content
     46 // strings rely on waiting for sync sign-in status, or platform-specifics.
     47 TEST_F('SettingsAppWebUITest', 'testStrings', function() {
     48   // Ensure we check against the override values.
     49   assertTrue(!!loadTimeData.getValue('settingsApp'));
     50 
     51   // Check a product-specific label, to ensure it uses "App Launcher", and not
     52   // Chrome / Chromium.
     53   var languagesLabelElement =
     54       document.querySelector('[i18n-content="languageSectionLabel"]');
     55   assertNotEquals(-1, languagesLabelElement.innerHTML.indexOf('App Launcher'));
     56 });
     57 
     58 GEN('#endif  // defined(ENABLE_SETTINGS_APP)');
     59