|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
4 */ |
|
5 |
|
6 function check_state(aTag, aExpectedClicktoplay, aExpectedDisabled) { |
|
7 do_check_eq(aTag.clicktoplay, aExpectedClicktoplay); |
|
8 do_check_eq(aTag.disabled, aExpectedDisabled); |
|
9 } |
|
10 |
|
11 function run_test() { |
|
12 let tag = get_test_plugintag(); |
|
13 tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED; |
|
14 check_state(tag, false, false); |
|
15 |
|
16 /* test going to click-to-play from always enabled and back */ |
|
17 tag.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY; |
|
18 check_state(tag, true, false); |
|
19 tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED; |
|
20 check_state(tag, false, false); |
|
21 |
|
22 /* test going to disabled from always enabled and back */ |
|
23 tag.enabledState = Ci.nsIPluginTag.STATE_DISABLED; |
|
24 check_state(tag, false, true); |
|
25 tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED; |
|
26 check_state(tag, false, false); |
|
27 |
|
28 /* test going to click-to-play from disabled and back */ |
|
29 tag.enabledState = Ci.nsIPluginTag.STATE_DISABLED; |
|
30 check_state(tag, false, true); |
|
31 tag.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY; |
|
32 check_state(tag, true, false); |
|
33 tag.enabledState = Ci.nsIPluginTag.STATE_DISABLED; |
|
34 check_state(tag, false, true); |
|
35 |
|
36 /* put everything back to normal and check that that succeeded */ |
|
37 tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED; |
|
38 check_state(tag, false, false); |
|
39 } |