Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @implements {settings.AppearanceBrowserProxy} | 7 * @implements {settings.AppearanceBrowserProxy} |
| 8 * @extends {settings.TestBrowserProxy} | 8 * @extends {settings.TestBrowserProxy} |
| 9 */ | 9 */ |
| 10 var TestAppearanceBrowserProxy = function() { | 10 var TestAppearanceBrowserProxy = function() { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 theme: { | 103 theme: { |
| 104 id: { | 104 id: { |
| 105 value: '', | 105 value: '', |
| 106 }, | 106 }, |
| 107 use_system: { | 107 use_system: { |
| 108 value: false, | 108 value: false, |
| 109 }, | 109 }, |
| 110 }, | 110 }, |
| 111 }, | 111 }, |
| 112 }); | 112 }); |
| 113 appearancePage.set('pageVisibility', {}); | |
| 113 | 114 |
| 114 document.body.appendChild(appearancePage); | 115 document.body.appendChild(appearancePage); |
| 115 Polymer.dom.flush(); | 116 Polymer.dom.flush(); |
| 116 } | 117 } |
| 117 | 118 |
| 119 suite('AppearancePageVisibility', function() { | |
| 120 setup(function() { | |
| 121 appearanceBrowserProxy = new TestAppearanceBrowserProxy(); | |
| 122 settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy; | |
| 123 createAppearancePage(); | |
| 124 }); | |
| 125 | |
| 126 teardown(function() { | |
| 127 appearancePage.remove(); | |
| 128 }); | |
| 129 | |
| 130 if (cr.isChromeOS) { | |
| 131 test('setWallpaper', function() { | |
| 132 assertTrue(!!appearancePage.$$('#setWallpaper')); | |
| 133 }); | |
| 134 } else { | |
| 135 test('noSetWallpaper', function() { | |
| 136 assertTrue(!appearancePage.$$('#setWallpaper')); | |
| 137 }); | |
| 138 } | |
| 139 | |
| 140 test('setTheme', function() { | |
| 141 assertTrue(!!appearancePage.$$('#setTheme')); | |
| 142 }); | |
| 143 | |
| 144 test('homeButton', function() { | |
| 145 assertTrue(!!appearancePage.$$('#homeButton')); | |
|
dpapad
2017/05/04 01:03:24
Now that we don't use dom-if, these tests are insu
| |
| 146 }); | |
| 147 | |
| 148 test('bookmarksBar', function() { | |
| 149 assertTrue(!!appearancePage.$$('#bookmarksBar')); | |
| 150 }); | |
| 151 }); | |
| 152 | |
| 118 suite('AppearanceHandler', function() { | 153 suite('AppearanceHandler', function() { |
| 119 setup(function() { | 154 setup(function() { |
| 120 appearanceBrowserProxy = new TestAppearanceBrowserProxy(); | 155 appearanceBrowserProxy = new TestAppearanceBrowserProxy(); |
| 121 settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy; | 156 settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy; |
| 122 createAppearancePage(); | 157 createAppearancePage(); |
| 123 }); | 158 }); |
| 124 | 159 |
| 125 teardown(function() { appearancePage.remove(); }); | 160 teardown(function() { appearancePage.remove(); }); |
| 126 | 161 |
| 127 if (cr.isChromeOS) { | 162 if (cr.isChromeOS) { |
| 128 test('wallpaperManager', function() { | 163 test('wallpaperManager', function() { |
| 129 var button = appearancePage.$.wallpaperButton; | 164 var button = appearancePage.$$('#setWallpaper'); |
| 130 assertTrue(!!button); | 165 assertTrue(!!button); |
| 131 MockInteractions.tap(button); | 166 MockInteractions.tap(button); |
| 132 return appearanceBrowserProxy.whenCalled('openWallpaperManager'); | 167 return appearanceBrowserProxy.whenCalled('openWallpaperManager'); |
| 133 }); | 168 }); |
| 134 } else { | 169 } else { |
| 135 test('noWallpaperManager', function() { | 170 test('noWallpaperManager', function() { |
| 136 // The wallpaper button should not be present. | 171 // The wallpaper button should not be present. |
| 137 var button = appearancePage.$.wallpaperButton; | 172 var button = appearancePage.$$('#setWallpaper'); |
| 138 assertFalse(!!button); | 173 assertFalse(!!button); |
| 139 }); | 174 }); |
| 140 } | 175 } |
| 141 | 176 |
| 142 var THEME_ID_PREF = 'prefs.extensions.theme.id.value'; | 177 var THEME_ID_PREF = 'prefs.extensions.theme.id.value'; |
| 143 | 178 |
| 144 if (cr.isLinux && !cr.isChromeOS) { | 179 if (cr.isLinux && !cr.isChromeOS) { |
| 145 var USE_SYSTEM_PREF = 'prefs.extensions.theme.use_system.value'; | 180 var USE_SYSTEM_PREF = 'prefs.extensions.theme.use_system.value'; |
| 146 | 181 |
| 147 test('useDefaultThemeLinux', function() { | 182 test('useDefaultThemeLinux', function() { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 var button = appearancePage.$$('#useDefault'); | 243 var button = appearancePage.$$('#useDefault'); |
| 209 assertTrue(!!button); | 244 assertTrue(!!button); |
| 210 | 245 |
| 211 MockInteractions.tap(button); | 246 MockInteractions.tap(button); |
| 212 return appearanceBrowserProxy.whenCalled('useDefaultTheme'); | 247 return appearanceBrowserProxy.whenCalled('useDefaultTheme'); |
| 213 }); | 248 }); |
| 214 } | 249 } |
| 215 | 250 |
| 216 test('default zoom handling', function() { | 251 test('default zoom handling', function() { |
| 217 function getDefaultZoomText() { | 252 function getDefaultZoomText() { |
| 218 var zoomLevel = appearancePage.$.zoomLevel; | 253 var zoomLevel = appearancePage.$$('#zoomLevel'); |
| 219 return zoomLevel.options[zoomLevel.selectedIndex].textContent.trim(); | 254 return zoomLevel.options[zoomLevel.selectedIndex].textContent.trim(); |
| 220 } | 255 } |
| 221 | 256 |
| 222 return appearanceBrowserProxy.whenCalled('getDefaultZoom').then(function() { | 257 return appearanceBrowserProxy.whenCalled('getDefaultZoom').then(function() { |
| 223 assertEquals('100%', getDefaultZoomText()); | 258 assertEquals('100%', getDefaultZoomText()); |
| 224 | 259 |
| 225 appearanceBrowserProxy.setDefaultZoom(2 / 3); | 260 appearanceBrowserProxy.setDefaultZoom(2 / 3); |
| 226 createAppearancePage(); | 261 createAppearancePage(); |
| 227 return appearanceBrowserProxy.whenCalled('getDefaultZoom'); | 262 return appearanceBrowserProxy.whenCalled('getDefaultZoom'); |
| 228 }).then(function() { | 263 }).then(function() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 Polymer.dom.flush(); | 317 Polymer.dom.flush(); |
| 283 assertEquals(homeUrlInput.value, '@@@'); // Value hasn't changed. | 318 assertEquals(homeUrlInput.value, '@@@'); // Value hasn't changed. |
| 284 assertTrue(homeUrlInput.invalid); | 319 assertTrue(homeUrlInput.invalid); |
| 285 | 320 |
| 286 // Should reset to default value on change event. | 321 // Should reset to default value on change event. |
| 287 homeUrlInput.$.input.fire('change'); | 322 homeUrlInput.$.input.fire('change'); |
| 288 Polymer.dom.flush(); | 323 Polymer.dom.flush(); |
| 289 assertEquals(homeUrlInput.value, 'test'); | 324 assertEquals(homeUrlInput.value, 'test'); |
| 290 }); | 325 }); |
| 291 }); | 326 }); |
| 292 }); | 327 }); |
| OLD | NEW |