зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1450658 - Add preference to disable focusing source; r=pehrsons
Focusing a source during a test run can cause Firefox to lose focus and subsequent tests to timeout. This adds a preference which defaults to true that allows the source to be focused. It is then set to false for tests that involve screen sharing. MozReview-Commit-ID: CNq2c87y8Ho --HG-- extra : rebase_source : 805e2cbf9c09af419419a64d074e020784185b1d
This commit is contained in:
Родитель
50a3ab6cd4
Коммит
a20dc982b3
|
@ -5,6 +5,7 @@ const PREF_PERMISSION_FAKE = "media.navigator.permission.fake";
|
|||
const PREF_AUDIO_LOOPBACK = "media.audio_loopback_dev";
|
||||
const PREF_VIDEO_LOOPBACK = "media.video_loopback_dev";
|
||||
const PREF_FAKE_STREAMS = "media.navigator.streams.fake";
|
||||
const PREF_FOCUS_SOURCE = "media.getusermedia.window.focus_source.enabled";
|
||||
const CONTENT_SCRIPT_HELPER = getRootDirectory(gTestPath) + "get_user_media_content_script.js";
|
||||
|
||||
const STATE_CAPTURE_ENABLED = Ci.nsIMediaManagerService.STATE_CAPTURE_ENABLED;
|
||||
|
@ -574,7 +575,8 @@ async function runTests(tests, options = {}) {
|
|||
[PREF_PERMISSION_FAKE, true],
|
||||
[PREF_AUDIO_LOOPBACK, ""],
|
||||
[PREF_VIDEO_LOOPBACK, ""],
|
||||
[PREF_FAKE_STREAMS, true]
|
||||
[PREF_FAKE_STREAMS, true],
|
||||
[PREF_FOCUS_SOURCE, false]
|
||||
];
|
||||
await SpecialPowers.pushPrefEnv({"set": prefs});
|
||||
|
||||
|
|
|
@ -1636,7 +1636,8 @@ public:
|
|||
MediaEnginePrefs& aPrefs,
|
||||
const ipc::PrincipalInfo& aPrincipalInfo,
|
||||
bool aIsChrome,
|
||||
MediaManager::SourceSet* aSourceSet)
|
||||
MediaManager::SourceSet* aSourceSet,
|
||||
bool aShouldFocusSource)
|
||||
: Runnable("GetUserMediaTask")
|
||||
, mConstraints(aConstraints)
|
||||
, mOnSuccess(aOnSuccess)
|
||||
|
@ -1647,6 +1648,7 @@ public:
|
|||
, mPrefs(aPrefs)
|
||||
, mPrincipalInfo(aPrincipalInfo)
|
||||
, mIsChrome(aIsChrome)
|
||||
, mShouldFocusSource(aShouldFocusSource)
|
||||
, mDeviceChosen(false)
|
||||
, mSourceSet(aSourceSet)
|
||||
, mManager(MediaManager::GetInstance())
|
||||
|
@ -1719,9 +1721,12 @@ public:
|
|||
}
|
||||
} else {
|
||||
if (!mIsChrome) {
|
||||
rv = mVideoDevice->FocusOnSelectedSource();
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("FocusOnSelectedSource failed"));
|
||||
if (mShouldFocusSource) {
|
||||
rv = mVideoDevice->FocusOnSelectedSource();
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("FocusOnSelectedSource failed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1833,6 +1838,7 @@ private:
|
|||
MediaEnginePrefs mPrefs;
|
||||
ipc::PrincipalInfo mPrincipalInfo;
|
||||
bool mIsChrome;
|
||||
bool mShouldFocusSource;
|
||||
|
||||
bool mDeviceChosen;
|
||||
public:
|
||||
|
@ -2889,6 +2895,9 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
|
|||
}
|
||||
}
|
||||
|
||||
bool focusSource;
|
||||
focusSource = mozilla::Preferences::GetBool("media.getusermedia.window.focus_source.enabled", true);
|
||||
|
||||
// Pass callbacks and listeners along to GetUserMediaTask.
|
||||
RefPtr<GetUserMediaTask> task (new GetUserMediaTask(c,
|
||||
onSuccess,
|
||||
|
@ -2899,7 +2908,8 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
|
|||
prefs,
|
||||
principalInfo,
|
||||
isChrome,
|
||||
devices->release()));
|
||||
devices->release(),
|
||||
focusSource));
|
||||
// Store the task w/callbacks.
|
||||
self->mActiveCallbacks.Put(callID, task.forget());
|
||||
|
||||
|
|
|
@ -418,8 +418,9 @@ function setupEnvironment() {
|
|||
// If either fake audio or video is desired we enable fake streams.
|
||||
// If loopback devices are set they will be chosen instead of fakes in gecko.
|
||||
['media.navigator.streams.fake', WANT_FAKE_AUDIO || WANT_FAKE_VIDEO],
|
||||
['media.getusermedia.screensharing.enabled', true],
|
||||
['media.getusermedia.audiocapture.enabled', true],
|
||||
['media.getusermedia.screensharing.enabled', true],
|
||||
['media.getusermedia.window.focus_source.enabled', false],
|
||||
['media.recorder.audio_node.enabled', true],
|
||||
['media.webaudio.audiocontextoptions-samplerate.enabled', true]
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче