Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @suppress {checkTypes} | 6 * @suppress {checkTypes} |
| 7 * | 7 * |
| 8 * @fileoverview | 8 * @fileoverview |
| 9 * Browser test for the scenario below: | 9 * Browser test for the scenario below: |
| 10 * 1. Resize the client window to various sizes and verify the existence of | 10 * 1. Resize the client window to various sizes and verify the existence of |
| 11 * horizontal and/or vertical scroll-bars. | 11 * horizontal and/or vertical scroll-bars. |
| 12 * 2. TODO(jamiewalch): Connect to a host and toggle various combinations of | 12 * 2. TODO(jamiewalch): Connect to a host and toggle various combinations of |
| 13 * scale and resize; repeat test 1. | 13 * scale and resize; repeat test 1. |
| 14 * 3. TODO(jamiewalch): Disconnect; repeat test 1. | 14 * 3. TODO(jamiewalch): Disconnect; repeat test 1. |
| 15 */ | 15 */ |
| 16 | 16 |
| 17 'use strict'; | 17 'use strict'; |
|
kelvinp
2015/05/11 17:20:11
Looks like this test is currently not enabled.
Sho
| |
| 18 | 18 |
| 19 /** @constructor */ | 19 /** @constructor */ |
| 20 browserTest.Scrollbars = function() { | 20 browserTest.Scrollbars = function() { |
| 21 this.scroller_ = document.getElementById('scroller'); | 21 this.scroller_ = document.getElementById('scroller'); |
| 22 this.SCROLLBAR_WIDTH_ = 16; | 22 this.SCROLLBAR_WIDTH_ = 16; |
| 23 this.BORDER_WIDTH_ = 1; | 23 this.BORDER_WIDTH_ = 1; |
| 24 | 24 |
| 25 // The top border is already accounted for by getBoundingClientRect, but | 25 // The top border is already accounted for by getBoundingClientRect, but |
| 26 // the bottom border is not. | 26 // the bottom border is not. |
| 27 var marker = document.getElementById('bottom-marker'); | 27 var marker = document.getElementById('bottom-marker'); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 | 174 |
| 175 /** | 175 /** |
| 176 * @param {number} width | 176 * @param {number} width |
| 177 * @param {number} height | 177 * @param {number} height |
| 178 * @return {Promise} A promise that will be fulfilled when the window has | 178 * @return {Promise} A promise that will be fulfilled when the window has |
| 179 * been resized and it's safe to test scroll-bar visibility. | 179 * been resized and it's safe to test scroll-bar visibility. |
| 180 * @private | 180 * @private |
| 181 */ | 181 */ |
| 182 browserTest.Scrollbars.prototype.resize_ = function(width, height) { | 182 browserTest.Scrollbars.prototype.resize_ = function(width, height) { |
| 183 var win = chrome.app.window.current(); | 183 var win = chrome.app.window.current(); |
| 184 win.resizeTo(width, height); | 184 win.outerBounds.width = width; |
| 185 win.outerBounds.height = height; | |
| 185 // Chrome takes a while to update the scroll-bars, so don't resolve | 186 // Chrome takes a while to update the scroll-bars, so don't resolve |
| 186 // immediately. Waiting for the onBoundsChanged event would be cleaner, | 187 // immediately. Waiting for the onBoundsChanged event would be cleaner, |
| 187 // but isn't reliable. | 188 // but isn't reliable. |
| 188 return base.Promise.sleep(500); | 189 return base.Promise.sleep(500); |
| 189 }; | 190 }; |
| 190 | 191 |
| 191 | 192 |
| 192 /** | 193 /** |
| 193 * @param {number} width | 194 * @param {number} width |
| 194 * @param {number} height | 195 * @param {number} height |
| 195 * @param {boolean} horizontalExpected | 196 * @param {boolean} horizontalExpected |
| 196 * @param {boolean} verticalExpected | 197 * @param {boolean} verticalExpected |
| 197 * @return {Promise} A promise that will be fulfilled when the window has | 198 * @return {Promise} A promise that will be fulfilled when the window has |
| 198 * been resized and it's safe to test scroll-bar visibility. | 199 * been resized and it's safe to test scroll-bar visibility. |
| 199 * @private | 200 * @private |
| 200 */ | 201 */ |
| 201 browserTest.Scrollbars.prototype.resizeAndVerifyScroll_ = | 202 browserTest.Scrollbars.prototype.resizeAndVerifyScroll_ = |
| 202 function(width, height, horizontalExpected, verticalExpected) { | 203 function(width, height, horizontalExpected, verticalExpected) { |
| 203 return this.resize_(width, height).then( | 204 return this.resize_(width, height).then( |
| 204 this.verifyScrollbarState_.bind( | 205 this.verifyScrollbarState_.bind( |
| 205 this, horizontalExpected, verticalExpected)); | 206 this, horizontalExpected, verticalExpected)); |
| 206 }; | 207 }; |
| OLD | NEW |