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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 value: false, | 108 value: false, |
109 }, | 109 }, |
110 }, | 110 }, |
111 }, | 111 }, |
112 }); | 112 }); |
113 | 113 |
114 document.body.appendChild(appearancePage); | 114 document.body.appendChild(appearancePage); |
115 Polymer.dom.flush(); | 115 Polymer.dom.flush(); |
116 } | 116 } |
117 | 117 |
| 118 suite('AppearancePageVisibility', function() { |
| 119 setup(function() { |
| 120 appearanceBrowserProxy = new TestAppearanceBrowserProxy(); |
| 121 settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy; |
| 122 createAppearancePage(); |
| 123 }); |
| 124 |
| 125 teardown(function() { appearancePage.remove(); }); |
| 126 |
| 127 if (cr.isChromeOS) { |
| 128 test('setWallpaper', function() { |
| 129 assertTrue(!!appearancePage.$$('#setWallpaper')); |
| 130 }); |
| 131 } else { |
| 132 test('noSetWallpaper', function() { |
| 133 assertTrue(!appearancePage.$$('#setWallpaper')); |
| 134 }); |
| 135 } |
| 136 |
| 137 test('setTheme', function() { |
| 138 assertTrue(!!appearancePage.$$('#setTheme')); |
| 139 }); |
| 140 test('homeButton', function() { |
| 141 assertTrue(!!appearancePage.$$('#homeButton')); |
| 142 }); |
| 143 test('bookmarksBar', function() { |
| 144 assertTrue(!!appearancePage.$$('#bookmarksBar')); |
| 145 }); |
| 146 }); |
| 147 |
118 suite('AppearanceHandler', function() { | 148 suite('AppearanceHandler', function() { |
119 setup(function() { | 149 setup(function() { |
120 appearanceBrowserProxy = new TestAppearanceBrowserProxy(); | 150 appearanceBrowserProxy = new TestAppearanceBrowserProxy(); |
121 settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy; | 151 settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy; |
122 createAppearancePage(); | 152 createAppearancePage(); |
123 }); | 153 }); |
124 | 154 |
125 teardown(function() { appearancePage.remove(); }); | 155 teardown(function() { appearancePage.remove(); }); |
126 | 156 |
127 if (cr.isChromeOS) { | 157 if (cr.isChromeOS) { |
128 test('wallpaperManager', function() { | 158 test('wallpaperManager', function() { |
129 var button = appearancePage.$.wallpaperButton; | 159 var button = appearancePage.$$('#setWallpaper'); |
130 assertTrue(!!button); | 160 assertTrue(!!button); |
131 MockInteractions.tap(button); | 161 MockInteractions.tap(button); |
132 return appearanceBrowserProxy.whenCalled('openWallpaperManager'); | 162 return appearanceBrowserProxy.whenCalled('openWallpaperManager'); |
133 }); | 163 }); |
134 } else { | 164 } else { |
135 test('noWallpaperManager', function() { | 165 test('noWallpaperManager', function() { |
136 // The wallpaper button should not be present. | 166 // The wallpaper button should not be present. |
137 var button = appearancePage.$.wallpaperButton; | 167 var button = appearancePage.$$('#setWallpaper'); |
138 assertFalse(!!button); | 168 assertFalse(!!button); |
139 }); | 169 }); |
140 } | 170 } |
141 | 171 |
142 var THEME_ID_PREF = 'prefs.extensions.theme.id.value'; | 172 var THEME_ID_PREF = 'prefs.extensions.theme.id.value'; |
143 | 173 |
144 if (cr.isLinux && !cr.isChromeOS) { | 174 if (cr.isLinux && !cr.isChromeOS) { |
145 var USE_SYSTEM_PREF = 'prefs.extensions.theme.use_system.value'; | 175 var USE_SYSTEM_PREF = 'prefs.extensions.theme.use_system.value'; |
146 | 176 |
147 test('useDefaultThemeLinux', function() { | 177 test('useDefaultThemeLinux', function() { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 var button = appearancePage.$$('#useDefault'); | 238 var button = appearancePage.$$('#useDefault'); |
209 assertTrue(!!button); | 239 assertTrue(!!button); |
210 | 240 |
211 MockInteractions.tap(button); | 241 MockInteractions.tap(button); |
212 return appearanceBrowserProxy.whenCalled('useDefaultTheme'); | 242 return appearanceBrowserProxy.whenCalled('useDefaultTheme'); |
213 }); | 243 }); |
214 } | 244 } |
215 | 245 |
216 test('default zoom handling', function() { | 246 test('default zoom handling', function() { |
217 function getDefaultZoomText() { | 247 function getDefaultZoomText() { |
218 var zoomLevel = appearancePage.$.zoomLevel; | 248 var zoomLevel = appearancePage.$$('#zoomLevel'); |
219 return zoomLevel.options[zoomLevel.selectedIndex].textContent.trim(); | 249 return zoomLevel.options[zoomLevel.selectedIndex].textContent.trim(); |
220 } | 250 } |
221 | 251 |
222 return appearanceBrowserProxy.whenCalled('getDefaultZoom').then(function() { | 252 return appearanceBrowserProxy.whenCalled('getDefaultZoom').then(function() { |
223 assertEquals('100%', getDefaultZoomText()); | 253 assertEquals('100%', getDefaultZoomText()); |
224 | 254 |
225 appearanceBrowserProxy.setDefaultZoom(2 / 3); | 255 appearanceBrowserProxy.setDefaultZoom(2 / 3); |
226 createAppearancePage(); | 256 createAppearancePage(); |
227 return appearanceBrowserProxy.whenCalled('getDefaultZoom'); | 257 return appearanceBrowserProxy.whenCalled('getDefaultZoom'); |
228 }).then(function() { | 258 }).then(function() { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 Polymer.dom.flush(); | 312 Polymer.dom.flush(); |
283 assertEquals(homeUrlInput.value, '@@@'); // Value hasn't changed. | 313 assertEquals(homeUrlInput.value, '@@@'); // Value hasn't changed. |
284 assertTrue(homeUrlInput.invalid); | 314 assertTrue(homeUrlInput.invalid); |
285 | 315 |
286 // Should reset to default value on change event. | 316 // Should reset to default value on change event. |
287 homeUrlInput.$.input.fire('change'); | 317 homeUrlInput.$.input.fire('change'); |
288 Polymer.dom.flush(); | 318 Polymer.dom.flush(); |
289 assertEquals(homeUrlInput.value, 'test'); | 319 assertEquals(homeUrlInput.value, 'test'); |
290 }); | 320 }); |
291 }); | 321 }); |
292 }); | 322 }); |
OLD | NEW |