author | Ehsan Akhgari <ehsan@mozilla.com> |
Tue, 28 Jul 2015 22:43:08 -0400 | |
changeset 255287 | 1878dfd5a1931e50442cd132426a0e088cbdefed |
parent 255286 | e5137e5dc19db750781699836ccfcafc519940e4 |
child 255288 | da2876c5f5acbc86183aaa64e1b11f6c0a6b6cc5 |
push id | 62996 |
push user | eakhgari@mozilla.com |
push date | Wed, 29 Jul 2015 21:23:07 +0000 |
treeherder | mozilla-inbound@1878dfd5a193 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jaws |
bugs | 1188718 |
milestone | 42.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/base/content/tabbrowser.xml | file | annotate | diff | comparison | revisions | |
browser/base/content/test/general/browser_audioTabIcon.js | file | annotate | diff | comparison | revisions |
--- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -5915,17 +5915,18 @@ <handler event="dragstart" phase="capturing"> this.style.MozUserFocus = ''; </handler> <handler event="mousedown" phase="capturing"> <![CDATA[ if (this.selected) { this.style.MozUserFocus = 'ignore'; this.clientTop; // just using this to flush style updates - } else if (this.mOverCloseButton) { + } else if (this.mOverCloseButton || + this._overPlayingIcon) { // Prevent tabbox.xml from selecting the tab. event.stopPropagation(); } ]]> </handler> <handler event="mouseup"> this.style.MozUserFocus = ''; </handler>
--- a/browser/base/content/test/general/browser_audioTabIcon.js +++ b/browser/base/content/test/general/browser_audioTabIcon.js @@ -5,51 +5,68 @@ function* wait_for_tab_playing_event(tab if (event.detail.changed.indexOf("soundplaying") >= 0) { is(tab.hasAttribute("soundplaying"), expectPlaying, "The tab should " + (expectPlaying ? "" : "not ") + "be playing"); return true; } return false; }); } -function* test_tooltip(icon, expectedTooltip) { - function disable_non_test_mouse(disable) { - let utils = window.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils); - utils.disableNonTestMouseEvents(disable); - } +function disable_non_test_mouse(disable) { + let utils = window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); + utils.disableNonTestMouseEvents(disable); +} - let tooltip = document.getElementById("tabbrowser-tab-tooltip"); - +function* hover_icon(icon, tooltip) { disable_non_test_mouse(true); let popupShownPromise = BrowserTestUtils.waitForEvent(tooltip, "popupshown"); EventUtils.synthesizeMouse(icon, 1, 1, {type: "mouseover"}); EventUtils.synthesizeMouse(icon, 2, 2, {type: "mousemove"}); EventUtils.synthesizeMouse(icon, 3, 3, {type: "mousemove"}); EventUtils.synthesizeMouse(icon, 4, 4, {type: "mousemove"}); - yield popupShownPromise; + return popupShownPromise; +} - is(tooltip.getAttribute("label"), expectedTooltip, "Correct tooltip expected"); - +function leave_icon(icon) { EventUtils.synthesizeMouse(icon, 0, 0, {type: "mouseout"}); + EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"}); + EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"}); + EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"}); disable_non_test_mouse(false); } +function* test_tooltip(icon, expectedTooltip) { + let tooltip = document.getElementById("tabbrowser-tab-tooltip"); + + yield hover_icon(icon, tooltip); + is(tooltip.getAttribute("label"), expectedTooltip, "Correct tooltip expected"); + leave_icon(icon); +} + function* test_mute_tab(tab, icon, expectMuted) { let mutedPromise = BrowserTestUtils.waitForEvent(tab, "TabAttrModified", false, (event) => { if (event.detail.changed.indexOf("muted") >= 0) { is(tab.hasAttribute("muted"), expectMuted, "The tab should " + (expectMuted ? "" : "not ") + "be muted"); return true; } return false; }); + let activeTab = gBrowser.selectedTab; + + let tooltip = document.getElementById("tabbrowser-tab-tooltip"); + + yield hover_icon(icon, tooltip); EventUtils.synthesizeMouseAtCenter(icon, {button: 0}); + leave_icon(icon); + + is(gBrowser.selectedTab, activeTab, "Clicking on mute should not change the currently selected tab"); return mutedPromise; } function* test_playing_icon_on_tab(tab, browser, isPinned) { let icon = document.getAnonymousElementByAttribute(tab, "anonid", isPinned ? "overlay-icon" : "soundplaying-icon"); @@ -84,16 +101,24 @@ function* test_on_browser(browser) { yield test_playing_icon_on_tab(tab, browser, false); gBrowser.pinTab(tab); // Test the icon in a pinned tab. yield test_playing_icon_on_tab(tab, browser, true); gBrowser.unpinTab(tab); + + // Retest with another browser in the foreground tab + if (gBrowser.selectedBrowser.currentURI.spec == PAGE) { + yield BrowserTestUtils.withNewTab({ + gBrowser, + url: "data:text/html,test" + }, () => test_on_browser(browser)); + } } add_task(function*() { yield new Promise((resolve) => { SpecialPowers.pushPrefEnv({"set": [ ["media.useAudioChannelService", true], ["browser.tabs.showAudioPlayingIcon", true], ]}, resolve);