browser_webchannel-enable-menu-button-preset.js (1784B)
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 "use strict"; 6 7 add_task(async function test() { 8 info( 9 "Test the WebChannel mechanism that it changes the preset to firefox-platform" 10 ); 11 await makeSureProfilerPopupIsDisabled(); 12 const supportedFeatures = Services.profiler.GetFeatures(); 13 14 // This test assumes that the Web Developer preset is set by default, which is 15 // not the case on Nightly and custom builds. 16 PrefsPresets.changePreset( 17 "aboutprofiling", 18 "web-developer", 19 supportedFeatures 20 ); 21 22 await withAboutProfiling(async document => { 23 const webdevPreset = document.querySelector("input[value=web-developer]"); 24 const firefoxPreset = await document.querySelector( 25 "input[value=firefox-platform]" 26 ); 27 28 // Check the presets now to make sure web-developer is selected right now. 29 ok(webdevPreset.checked, "By default the Web Developer preset is checked."); 30 ok( 31 !firefoxPreset.checked, 32 "By default the Firefox Platform preset is not checked." 33 ); 34 35 // Enable the profiler menu button with web channel. 36 await withWebChannelTestDocument(async _browser => { 37 await waitForTabTitle("WebChannel Page Ready"); 38 await waitForProfilerMenuButton(); 39 ok(true, "The profiler menu button was enabled by the WebChannel."); 40 }); 41 42 // firefox-platform preset should be selected now. 43 ok( 44 !webdevPreset.checked, 45 "Web Developer preset should not be checked anymore." 46 ); 47 ok( 48 firefoxPreset.checked, 49 "Firefox Platform preset should now be checked after enabling the popup with web channel." 50 ); 51 }); 52 });