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

Unified Diff: chrome/test/data/webui/ntp4.js

Issue 9625020: Ported NTP4 UI tests to WebUI. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Some more updates per review comments. Created 8 years, 9 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/chrome_tests.gypi ('k') | chrome/test/data/webui/ntp4_browsertest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/ntp4.js
diff --git a/chrome/test/data/webui/ntp4.js b/chrome/test/data/webui/ntp4.js
index 09fc4656b2eff3884bbb1c8548e3d83c45d2c368..de5c6fcacb1e22814401e2de6145d9e62df74719 100644
--- a/chrome/test/data/webui/ntp4.js
+++ b/chrome/test/data/webui/ntp4.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+GEN('#include "chrome/test/data/webui/ntp4_browsertest.h"');
+
/**
* TestFixture for NTP4 WebUI testing.
* @extends {testing.Test}
@@ -12,20 +14,71 @@ function NTP4WebUITest() {}
NTP4WebUITest.prototype = {
__proto__: testing.Test.prototype,
- /**
- * Browse to the newtab page & call preLoad().
- */
+ /** @override */
browsePreload: 'chrome://newtab',
};
// Test loading new tab page and selecting each card doesn't have console
// errors.
TEST_F('NTP4WebUITest', 'TestBrowsePages', function() {
-// This tests the ntp4 new tab page which is not used on touch builds.
+ // This tests the ntp4 new tab page which is not used on touch builds.
var cardSlider = ntp.getCardSlider();
assertNotEquals(null, cardSlider);
- for (var i = 0; i < cardSlider.cardCount; ++i) {
+ for (var i = 0; i < cardSlider.cardCount; i++) {
cardSlider.selectCard(i);
expectEquals(i, cardSlider.currentCard);
}
});
+
+TEST_F('NTP4WebUITest', 'NTPHasThumbnails', function() {
+ var mostVisited = document.querySelectorAll('.most-visited');
+ assertEquals(8, mostVisited.length, 'There should be 8 most visited tiles.');
+
+ var apps = document.querySelectorAll('.app');
+ assertGE(apps.length, 1, 'There should be at least one app.');
+});
+
+TEST_F('NTP4WebUITest', 'NTPHasNavDots', function() {
+ var navDots = document.querySelectorAll('.dot');
+ assertGE(navDots.length, 2, 'There should be at least two navdots.');
+});
+
+TEST_F('NTP4WebUITest', 'NTPHasSelectedPageAndDot', function() {
+ var selectedDot = document.querySelectorAll('.dot.selected');
+ assertEquals(1, selectedDot.length, 'There should be only one selected dot.');
+
+ var selectedTilePage = document.querySelectorAll('.tile-page.selected-card');
+ assertEquals(1, selectedTilePage.length,
+ 'There should be only one selected tile page.');
+});
+
+TEST_F('NTP4WebUITest', 'NTPHasNoLoginNameWhenSignedOut', function() {
+ var userName = document.querySelector('#login-status-header .profile-name');
+ assertEquals(null, userName, 'Login name shouldn\'t exist when signed out.');
+});
+
+/**
+ * Test fixture for NTP4 WebUI testing with login.
+ * @extends {NTP4WebUITest}
+ * @constructor
+ */
+function NTP4LoggedInWebUITest() {}
+
+NTP4LoggedInWebUITest.prototype = {
+ __proto__: NTP4WebUITest.prototype,
+
+ /** @override */
+ typedefCppFixture: 'NTP4LoggedInWebUITest',
+
+ /** @override */
+ testGenPreamble: function() {
Sheridan Rawlins 2012/03/08 21:50:58 Nit: only 1 space between ': function' please.
+ GEN(' SetLoginName("user@gmail.com");');
+ },
+};
+
+TEST_F('NTP4LoggedInWebUITest', 'NTPHasLoginNameWhenSignedIn', function() {
+ var userName = document.querySelector('#login-status-header .profile-name');
+ assertTrue(userName != null);
+ assertEquals('user@gmail.com', userName.textContent,
+ 'The user name should be present on the new tab.');
+});
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/ntp4_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698