1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/test/unit/test_bug854467.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + */ 1.8 + 1.9 +function check_state(aTag, aExpectedClicktoplay, aExpectedDisabled) { 1.10 + do_check_eq(aTag.clicktoplay, aExpectedClicktoplay); 1.11 + do_check_eq(aTag.disabled, aExpectedDisabled); 1.12 +} 1.13 + 1.14 +function run_test() { 1.15 + let tag = get_test_plugintag(); 1.16 + tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED; 1.17 + check_state(tag, false, false); 1.18 + 1.19 + /* test going to click-to-play from always enabled and back */ 1.20 + tag.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY; 1.21 + check_state(tag, true, false); 1.22 + tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED; 1.23 + check_state(tag, false, false); 1.24 + 1.25 + /* test going to disabled from always enabled and back */ 1.26 + tag.enabledState = Ci.nsIPluginTag.STATE_DISABLED; 1.27 + check_state(tag, false, true); 1.28 + tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED; 1.29 + check_state(tag, false, false); 1.30 + 1.31 + /* test going to click-to-play from disabled and back */ 1.32 + tag.enabledState = Ci.nsIPluginTag.STATE_DISABLED; 1.33 + check_state(tag, false, true); 1.34 + tag.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY; 1.35 + check_state(tag, true, false); 1.36 + tag.enabledState = Ci.nsIPluginTag.STATE_DISABLED; 1.37 + check_state(tag, false, true); 1.38 + 1.39 + /* put everything back to normal and check that that succeeded */ 1.40 + tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED; 1.41 + check_state(tag, false, false); 1.42 +}