1 // Copyright (c) 2012 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 extension settings WebUI testing.
7 * @extends {testing.Test}
10 function HelpPageWebUITest() {}
12 HelpPageWebUITest
.prototype = {
13 __proto__
: testing
.Test
.prototype,
16 runAccessibilityChecks
: true,
19 accessibilityIssuesAreErrors
: true,
21 browsePreload
: 'chrome://help-frame/',
24 // Test opening extension settings has correct location.
25 TEST_F('HelpPageWebUITest', 'testOpenHelpPage', function() {
26 assertEquals(this.browsePreload
, document
.location
.href
);
29 GEN('#if defined(OS_LINUX) || defined(GOOGLE_CHROME_BUILD)');
31 // Test that repeated calls to setUpdateStatus work.
32 TEST_F('HelpPageWebUITest', 'testUpdateState', function() {
33 var relaunch
= $('relaunch');
34 var container
= $('update-status-container');
35 var update
= $('request-update');
37 help
.HelpPage
.setUpdateStatus('updated', '');
38 expectTrue(relaunch
.hidden
);
39 expectTrue(cr
.isChromeOS
== container
.hidden
);
40 expectTrue(!cr
.isChromeOS
|| !update
.hidden
&& !update
.disabled
);
42 help
.HelpPage
.setUpdateStatus('disabled', '');
43 expectTrue(relaunch
.hidden
);
44 expectTrue(container
.hidden
);
45 expectTrue(!cr
.isChromeOS
|| update
.hidden
);
47 help
.HelpPage
.setUpdateStatus('nearly_updated', '');
48 expectTrue(!relaunch
.hidden
);
49 expectTrue(!container
.hidden
);
50 expectTrue(!cr
.isChromeOS
|| update
.hidden
);
52 help
.HelpPage
.setUpdateStatus('disabled', '');
53 expectTrue($('relaunch').hidden
);
54 expectTrue($('update-status-container').hidden
);
55 expectTrue(!cr
.isChromeOS
|| update
.hidden
);
60 GEN('#if defined(OS_CHROMEOS)');
62 // Test that the request update button is shown and hidden properly.
63 TEST_F('HelpPageWebUITest', 'testRequestUpdate', function() {
64 var container
= $('update-status-container');
65 var update
= $('request-update');
67 help
.HelpPage
.setUpdateStatus('updated', '');
68 expectTrue(container
.hidden
);
69 expectTrue(!update
.hidden
&& !update
.disabled
);
72 expectTrue(!update
.hidden
&& update
.disabled
);
73 expectFalse(container
.hidden
);
75 help
.HelpPage
.setUpdateStatus('checking', '');
76 expectFalse(container
.hidden
);
77 expectTrue(!update
.hidden
&& update
.disabled
);
79 help
.HelpPage
.setUpdateStatus('failed', 'Error');
80 expectFalse(container
.hidden
);
81 expectTrue(!update
.hidden
&& !update
.disabled
);
84 help
.HelpPage
.setUpdateStatus('checking', '');
85 expectFalse(container
.hidden
);
86 expectTrue(!update
.hidden
&& update
.disabled
);
88 help
.HelpPage
.setUpdateStatus('nearly_updated', '');
89 expectFalse(container
.hidden
);
90 expectTrue(update
.hidden
);
92 help
.HelpPage
.setUpdateStatus('updated', '');
93 expectFalse(container
.hidden
);
94 expectTrue(!update
.hidden
&& update
.disabled
);