1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * TestFixture for kiosk app settings WebUI testing.
7 * @extends {testing.Test}
10 function AppListStartPageWebUITest() {}
12 AppListStartPageWebUITest
.prototype = {
13 __proto__
: testing
.Test
.prototype,
16 * Browser to app launcher start page.
18 browsePreload
: 'chrome://app-list/',
21 * Recommend apps data.
28 'iconUrl': 'icon_url_1'
33 'iconUrl': 'icon_url_2'
39 this.makeAndRegisterMockHandler(['initialize', 'launchApp']);
40 this.mockHandler
.stubs().initialize().will(callFunction(function() {
41 appList
.startPage
.setRecommendedApps(this.recommendedApps_
);
43 this.mockHandler
.stubs().launchApp(ANYTHING
);
47 TEST_F('AppListStartPageWebUITest', 'Basic', function() {
48 assertEquals(this.browsePreload
, document
.location
.href
);
50 var recommendedApp
= $('start-page').querySelector('.recommended-apps');
51 assertEquals(this.recommendedApps_
.length
, recommendedApp
.childElementCount
);
52 for (var i
= 0; i
< recommendedApp
.childElementCount
; ++i
) {
53 assertEquals(this.recommendedApps_
[i
].appId
,
54 recommendedApp
.children
[i
].appId
);
58 TEST_F('AppListStartPageWebUITest', 'ClickToLaunch', function() {
59 var recommendedApp
= $('start-page').querySelector('.recommended-apps');
60 for (var i
= 0; i
< recommendedApp
.childElementCount
; ++i
) {
61 this.mockHandler
.expects(once()).launchApp(
62 [this.recommendedApps_
[i
].appId
]);
63 cr
.dispatchSimpleEvent(recommendedApp
.children
[i
], 'click');