Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3608)

Unified Diff: chrome/test/data/local_ntp_browsertest.js

Issue 2684593002: [Local NTP] Cleanup: Don't create HTML elements dynamically (Closed)
Patch Set: go back to dynamically creating the iframe Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/local_ntp_browsertest.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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')));
}
« no previous file with comments | « chrome/test/data/local_ntp_browsertest.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698