Skip to content

Commit 56f5b10

Browse files
committed
Make test pages' content bigger than even larger screens, to cause scrolling more reliably.
Recognize that scroll bars aren't shown in tablet browsers, just like in phones. Ignore tests that fail on Chrome for Android 40 due to the browser issues.
1 parent 83dd02b commit 56f5b10

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

javascript/atoms/test/scrolling_test.html

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
goog.require('bot.action');
88
goog.require('bot.dom');
99
goog.require('goog.dom');
10+
goog.require('goog.labs.userAgent.browser');
11+
goog.require('goog.labs.userAgent.device');
12+
goog.require('goog.labs.userAgent.platform');
1013
goog.require('goog.math.Coordinate');
1114
goog.require('goog.testing.ExpectedFailures');
1215
goog.require('goog.testing.jsunit');
@@ -38,8 +41,14 @@
3841
function testScrollsElementInToViewIfRequired() {
3942
bot.action.scrollIntoView(findElement({id: 'offscreen'}));
4043

41-
expectedFailures.expectFailureFor(goog.userAgent.product.ANDROID,
42-
'Android doesn\'t currently provide scrolling information');
44+
expectedFailures.expectFailureFor(
45+
goog.userAgent.product.ANDROID ||
46+
goog.labs.userAgent.browser.isChrome() &&
47+
goog.labs.userAgent.platform.isAndroid() &&
48+
goog.labs.userAgent.browser.isVersionOrHigher('40'),
49+
'Android doesn\'t currently provide scrolling information. ' +
50+
'Chrome for Android regressed in m40, apparently: ' +
51+
'https://code.google.com/p/chromium/issues/detail?id=448404');
4352
expectedFailures.run(function() {
4453
assertNotEquals(0, getTopLevelParent().scrollLeft);
4554
});
@@ -151,10 +160,20 @@
151160

152161
bot.action.scrollIntoView(element);
153162

163+
expectedFailures.expectFailureFor(
164+
goog.userAgent.product.ANDROID ||
165+
goog.labs.userAgent.browser.isChrome() &&
166+
goog.labs.userAgent.platform.isAndroid() &&
167+
goog.labs.userAgent.browser.isVersionOrHigher('40'),
168+
'Android doesn\'t currently provide scrolling information. ' +
169+
'Chrome for Android regressed in m40, apparently: ' +
170+
'https://code.google.com/p/chromium/issues/detail?id=448404');
171+
expectedFailures.run(function() {
172+
assertNotEquals(0, getTopLevelParent().scrollLeft);
173+
});
154174
expectedFailures.expectFailureFor(goog.userAgent.product.ANDROID,
155175
'Android doesn\'t currently provide scrolling information');
156176
expectedFailures.run(function() {
157-
assertNotEquals(0, getTopLevelParent().scrollLeft);
158177
assertNotEquals(0, frameDocument.body.scrollLeft);
159178
assertNotEquals(0, top.scrollLeft);
160179
assertNotEquals(0, middle.scrollLeft);
@@ -190,11 +209,11 @@
190209

191210
// If the scrollbar isn't taken into account, the minimum scrolling
192211
// needed would be 26 pixels, to bring the full pixel into view.
193-
// This should fail on mobile since the scrollbars aren't shown.
212+
// This should fail on mobile and tablet since the scrollbars aren't shown.
194213
// This should also fail on IE6 since scrolling only happens to
195214
// exactly the scrollbar width, which is 17 by default on Windows XP.
196215
expectedFailures.expectFailureFor(
197-
goog.userAgent.MOBILE ||
216+
goog.labs.userAgent.device.isMobile() || goog.labs.userAgent.device.isTablet() ||
198217
(goog.userAgent.IE && !goog.userAgent.isVersion(7)));
199218
expectedFailures.run(function() {
200219
assertTrue('horizontal scroll did not account for scrollbar',
@@ -205,7 +224,7 @@
205224
}
206225
</script>
207226
<div style="position: absolute; left: 150px; top: 100px; border: 2px yellow solid;"><a id="onscreen">Onscreen</a></div>
208-
<div style="position: absolute; left: 3000px; border: 2px orange solid;"><a id="offscreen">Offscreen</a></div>
227+
<div style="position: absolute; left: 8000px; border: 2px orange solid;"><a id="offscreen">Offscreen</a></div>
209228
<div style="overflow: hidden; width: 50px; height: 30px; border: 2px blue solid;" id="hidden-by-overflow-container">
210229
<a style="margin-left: 100px;" id="hidden-by-overflow">Hidden</a></div>
211230
</div>
@@ -235,7 +254,7 @@
235254
</div>
236255

237256
<iframe src="testdata/scrolling_iframe.html" style="width: 200px; height: 100px;" id="scrollable-iframe"></iframe>
238-
<div style="position: absolute; left: 3000px; top: 200px; border: 2px orange solid;">
257+
<div style="position: absolute; left: 8000px; top: 200px; border: 2px orange solid;">
239258
<iframe src="testdata/scrolling_iframe.html" style="width: 200px; height: 100px;" id="offscreen-scrollable-iframe"></iframe>
240259
</div>
241260

javascript/atoms/test/window_scroll_into_view_test.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727

2828
function tearDownPage() {
2929
// So we can see the test results
30-
window.setTimeout(function() {
31-
window.scrollTo(0, 10000);
32-
}, 0);
30+
window.scrollTo(0, 0);
3331
}
3432

3533
function testScrollToPositionAlreadyInViewDoesNotChangeScrollPosition() {
@@ -79,7 +77,7 @@
7977
}
8078
}
8179
</script>
82-
<div style="width:3000px;height:3000px"></div>
80+
<div style="width:8000px;height:8000px"></div>
8381
</body>
8482
</html>
8583

javascript/atoms/test/window_scroll_test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
}
4545
</script>
4646
</head>
47-
<body style="width: 4000px; height: 4000px; padding: 0px;margin: 0px;">
47+
<body style="width: 8000px; height: 8000px; padding: 0px;margin: 0px;">
4848
Hello
4949
</body>
5050
</html>

0 commit comments

Comments
 (0)