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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
Sheridan Rawlins 2012/03/08 21:50:58 Nit: 2012
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 GEN('#include "chrome/test/data/webui/ntp4_browsertest.h"');
6
5 /** 7 /**
6 * TestFixture for NTP4 WebUI testing. 8 * TestFixture for NTP4 WebUI testing.
7 * @extends {testing.Test} 9 * @extends {testing.Test}
8 * @constructor 10 * @constructor
9 */ 11 */
10 function NTP4WebUITest() {} 12 function NTP4WebUITest() {}
11 13
12 NTP4WebUITest.prototype = { 14 NTP4WebUITest.prototype = {
13 __proto__: testing.Test.prototype, 15 __proto__: testing.Test.prototype,
14 16
15 /** 17 /** @override */
16 * Browse to the newtab page & call preLoad().
17 */
18 browsePreload: 'chrome://newtab', 18 browsePreload: 'chrome://newtab',
19 }; 19 };
20 20
21 // Test loading new tab page and selecting each card doesn't have console 21 // Test loading new tab page and selecting each card doesn't have console
22 // errors. 22 // errors.
23 TEST_F('NTP4WebUITest', 'TestBrowsePages', function() { 23 TEST_F('NTP4WebUITest', 'TestBrowsePages', function() {
24 // This tests the ntp4 new tab page which is not used on touch builds. 24 // This tests the ntp4 new tab page which is not used on touch builds.
25 var cardSlider = ntp.getCardSlider(); 25 var cardSlider = ntp.getCardSlider();
26 assertNotEquals(null, cardSlider); 26 assertNotEquals(null, cardSlider);
27 for (var i = 0; i < cardSlider.cardCount; ++i) { 27 for (var i = 0; i < cardSlider.cardCount; i++) {
28 cardSlider.selectCard(i); 28 cardSlider.selectCard(i);
29 expectEquals(i, cardSlider.currentCard); 29 expectEquals(i, cardSlider.currentCard);
30 } 30 }
31 }); 31 });
32
33 TEST_F('NTP4WebUITest', 'NTPHasThumbnails', function() {
34 var mostVisited = document.querySelectorAll('.most-visited');
35 assertEquals(8, mostVisited.length, 'There should be 8 most visited tiles.');
36
37 var apps = document.querySelectorAll('.app');
38 assertGE(apps.length, 1, 'There should be at least one app.');
39 });
40
41 TEST_F('NTP4WebUITest', 'NTPHasNavDots', function() {
42 var navDots = document.querySelectorAll('.dot');
43 assertGE(navDots.length, 2, 'There should be at least two navdots.');
44 });
45
46 TEST_F('NTP4WebUITest', 'NTPHasSelectedPageAndDot', function() {
47 var selectedDot = document.querySelectorAll('.dot.selected');
48 assertEquals(1, selectedDot.length, 'There should be only one selected dot.');
49
50 var selectedTilePage = document.querySelectorAll('.tile-page.selected-card');
51 assertEquals(1, selectedTilePage.length,
52 'There should be only one selected tile page.');
53 });
54
55 TEST_F('NTP4WebUITest', 'NTPHasNoLoginNameWhenSignedOut', function() {
56 var userName = document.querySelector('#login-status-header .profile-name');
57 assertEquals(null, userName, 'Login name shouldn\'t exist when signed out.');
58 });
59
60 /**
61 * Test fixture for NTP4 WebUI testing with login.
62 * @extends {NTP4WebUITest}
63 * @constructor
64 */
65 function NTP4LoggedInWebUITest() {}
66
67 NTP4LoggedInWebUITest.prototype = {
68 __proto__: NTP4WebUITest.prototype,
69
70 /** @override */
71 typedefCppFixture: 'NTP4LoggedInWebUITest',
72
73 /** @override */
74 testGenPreamble: function() {
Sheridan Rawlins 2012/03/08 21:50:58 Nit: only 1 space between ': function' please.
75 GEN(' SetLoginName("user@gmail.com");');
76 },
77 };
78
79 TEST_F('NTP4LoggedInWebUITest', 'NTPHasLoginNameWhenSignedIn', function() {
80 var userName = document.querySelector('#login-status-header .profile-name');
81 assertTrue(userName != null);
82 assertEquals('user@gmail.com', userName.textContent,
83 'The user name should be present on the new tab.');
84 });
OLDNEW
« 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