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

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: 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
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..33cbe191700461e3b367dd523d27b10720f71fe8 100644
--- a/chrome/test/data/webui/ntp4.js
+++ b/chrome/test/data/webui/ntp4.js
@@ -21,11 +21,65 @@ NTP4WebUITest.prototype = {
// 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.
- var cardSlider = ntp.getCardSlider();
- assertNotEquals(null, cardSlider);
- for (var i = 0; i < cardSlider.cardCount; ++i) {
- cardSlider.selectCard(i);
- expectEquals(i, cardSlider.currentCard);
+//This tests the ntp4 new tab page which is not used on touch builds.
Sheridan Rawlins 2012/03/07 22:25:36 spacing seems off - should be 2 spaces; see javasc
Danh Nguyen 2012/03/08 16:44:19 I'm not sure how that happened.  I must have messe
+ var cardSlider = ntp.getCardSlider();
+ assertNotEquals(null, cardSlider);
+ for (var i = 0; i < cardSlider.cardCount; ++i) {
Sheridan Rawlins 2012/03/07 22:25:36 arv@chromium.org prefers i++ in JavaScript.
Dan Beam 2012/03/07 22:49:45 Then why'd you write it this way, scr@? :P http://
Danh Nguyen 2012/03/08 16:44:19 Easy fix. :-) Done.
+ 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.');
Sheridan Rawlins 2012/03/07 22:25:36 alignment is off.
Dan Beam 2012/03/07 22:49:45 scr: you might want to explain how it's off
Sheridan Rawlins 2012/03/07 23:00:38 Sho 'nuff. Please either start a new line after t
Danh Nguyen 2012/03/08 16:44:19 Done.
+});
+
+TEST_F('NTP4WebUITest', 'NTPHasNoLoginNameWhenSignedOut', function() {
+ assertEquals(null,
Sheridan Rawlins 2012/03/07 22:25:36 alignment is off - either move null down or indent
Danh Nguyen 2012/03/08 16:44:19 Done.
+ document.querySelector('#login-status-header .profile-name'),
+ 'Login name shouldn\'t exist when signed out.');
+});
+
+/**
+ * Test fixture for NTP4 WebUI testing with login.
Sheridan Rawlins 2012/03/07 22:25:36 @extends {NTP4WebUITest} @constructor
Danh Nguyen 2012/03/08 16:44:19 Done.
+ */
+function NTP4LoggedInWebUITest() {}
+
+NTP4LoggedInWebUITest.prototype = {
+ __proto__: NTP4WebUITest.prototype,
+
+ // C++ class for login setup.
Sheridan Rawlins 2012/03/07 22:25:36 JSDoc style comments for members/methods please.
Danh Nguyen 2012/03/08 16:44:19 Done.
+ typedefCppFixture: 'NTP4LoggedInWebUITest',
+
+ // Inserts C++ statement to set up login.
Sheridan Rawlins 2012/03/07 22:25:36 JSDoc style comments.
Danh Nguyen 2012/03/08 16:44:19 Done.
+ testGenPreamble: function() {
+ print(' SetLoginName("user@gmail.com");');
Sheridan Rawlins 2012/03/07 22:25:36 Please use GEN - print is v8, but node.js uses con
Danh Nguyen 2012/03/08 16:44:19 Done.
}
+};
+
+GEN('#include "chrome/test/data/webui/ntp4_test.h"');
Sheridan Rawlins 2012/03/07 22:25:36 Move to the top please so it is closer to the desi
Danh Nguyen 2012/03/08 16:44:19 Done.
+
+TEST_F('NTP4LoggedInWebUITest', 'NTPHasLoginNameWhenSignedIn', function() {
+ userName = document.querySelector('#login-status-header .profile-name');
Sheridan Rawlins 2012/03/07 22:25:36 var
Danh Nguyen 2012/03/08 16:44:19 Done.
+ assertTrue(userName != null);
+ assertEquals('user@gmail.com', userName.firstChild.wholeText,
Dan Beam 2012/03/07 22:49:45 what's wholeText? I've only ever heard of innerTex
Danh Nguyen 2012/03/08 16:44:19 https://developer.mozilla.org/en/DOM/Text.wholeTex
+ 'The user name should be present on the new tab.');
Sheridan Rawlins 2012/03/07 22:25:36 alignment is off.
Sheridan Rawlins 2012/03/07 23:00:38 (See previous alignment comments for style suggest
Danh Nguyen 2012/03/08 16:44:19 Done.
Danh Nguyen 2012/03/08 16:44:19 Done.
Danh Nguyen 2012/03/08 16:44:19 Done.
});

Powered by Google App Engine
This is Rietveld 408576698