Chromium Code Reviews| Index: chrome/test/data/local_ntp_browsertest.js |
| diff --git a/chrome/test/data/local_ntp_browsertest.js b/chrome/test/data/local_ntp_browsertest.js |
| index 57f5b7ba72a18ae2bfdfd256f0f63378ecafad6d..50028119b4a159aed3b89021929fb841fc3b129d 100644 |
| --- a/chrome/test/data/local_ntp_browsertest.js |
| +++ b/chrome/test/data/local_ntp_browsertest.js |
| @@ -66,14 +66,24 @@ function runTests() { |
| /** |
| + * Checks whether a given HTMLElement exists and is visible. |
| + * @param {HTMLElement|undefined} elem An HTMLElement. |
| + * @return {boolean} True if the element exists and is visible. |
| + */ |
| +function elementIsVisible(elem) { |
| + return elem && elem.offsetWidth > 0 && elem.offsetHeight > 0; |
| +} |
| + |
| + |
| +/** |
| * Tests that Google NTPs show a fakebox and logo. |
| */ |
| function testShowsFakeboxAndLogoIfGoogle() { |
| var localNTP = LocalNTP(); |
| configData.isGooglePage = true; |
| localNTP.init(); |
| - assert($('fakebox')); |
| - assert($('logo')); |
| + assert(elementIsVisible($('fakebox'))); |
| + assert(elementIsVisible($('logo'))); |
| } |
| @@ -84,6 +94,6 @@ function testDoesNotShowFakeboxIfNotGoogle() { |
| var localNTP = LocalNTP(); |
| configData.isGooglePage = false; |
| localNTP.init(); |
| - assert(!$('fakebox')); |
| - assert(!$('logo')); |
| + assert(!elementIsVisible($('fakebox'))); |
| + assert(!elementIsVisible($('logo'))); |
|
Marc Treib
2017/02/07 14:37:11
Before, the elements didn't exist at all; now they
|
| } |