forked from mirrors/gecko-dev
		
	 c7c96baf75
			
		
	
	
		c7c96baf75
		
	
	
	
	
		
			
			Differential Revision: https://phabricator.services.mozilla.com/D4563 --HG-- extra : source : 390737876a61c5da48a1957d284d3c315fbd541a extra : intermediate-source : f0b190c1cfb5d2df482f1051bbc0ff98de71235b
		
			
				
	
	
		
			31 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| const PAGE = "https://example.com/browser/toolkit/content/tests/browser/file_plugIn.html";
 | |
| 
 | |
| add_task(async function setup_test_preference() {
 | |
|   setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
 | |
|   await SpecialPowers.pushPrefEnv({"set": [
 | |
|     ["media.useAudioChannelService.testing", true],
 | |
|     ["media.block-autoplay-until-in-foreground", true],
 | |
|   ]});
 | |
| });
 | |
| 
 | |
| add_task(async function block_plug_in() {
 | |
|   info("- open new background tab -");
 | |
|   let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
 | |
|   BrowserTestUtils.loadURI(tab.linkedBrowser, PAGE);
 | |
|   await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 | |
| 
 | |
|   info("- tab should be blocked -");
 | |
|   await waitForTabBlockEvent(tab, true);
 | |
| 
 | |
|   info("- switch tab -");
 | |
|   await BrowserTestUtils.switchTab(window.gBrowser, tab);
 | |
| 
 | |
|   info("- tab should be resumed -");
 | |
|   await waitForTabBlockEvent(tab, false);
 | |
| 
 | |
|   info("- tab should be audible -");
 | |
|   await waitForTabPlayingEvent(tab, true);
 | |
| 
 | |
|   info("- remove tab -");
 | |
|   BrowserTestUtils.removeTab(tab);
 | |
| });
 |