Skip to content

Commit

Permalink
fix: disable kWindowCaptureMacV2 for desktopCapturer
Browse files Browse the repository at this point in the history
  • Loading branch information
VerteDinde committed Aug 11, 2021
1 parent 81c1433 commit f517d38
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
6 changes: 6 additions & 0 deletions shell/browser/feature_list.cc
Expand Up @@ -48,6 +48,12 @@ void InitializeFeatureList() {
// an empty suggestions list to be returned
disable_features +=
std::string(",") + spellcheck::kWinRetrieveSuggestionsOnlyOnDemand.name;
#endif
#if defined(OS_MAC)
// Disable kWindowCaptureMacV2, which causes the wrong window id to
// be returned (this has been disabled in upstream Chromium here):
// https://chromium-review.googlesource.com/c/chromium/src/+/3069272
disable_features += std::string(",") + features::kWindowCaptureMacV2.name;
#endif
base::FeatureList::InitializeInstance(enable_features, disable_features);
}
Expand Down
31 changes: 29 additions & 2 deletions spec-main/api-desktop-capturer-spec.ts
Expand Up @@ -146,8 +146,35 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
expect(mediaSourceId).to.equal(foundSource!.id);
});

// TODO(deepak1556): currently fails on all ci, enable it after upgrade.
it.skip('moveAbove should move the window at the requested place', async () => {
it('sourceIds from getSources should not incorrectly duplicate window_id', async () => {
const w = new BrowserWindow({ show: false, width: 100, height: 100, webPreferences: { contextIsolation: false } });
const wShown = emittedOnce(w, 'show');
const wFocused = emittedOnce(w, 'focus');
w.show();
w.focus();
await wShown;
await wFocused;

// ensure window_id isn't duplicated in getMediaSourceId,
// which uses a different method than getSources
const mediaSourceId = w.getMediaSourceId();
const ids = mediaSourceId.split(':');
expect(ids[1]).to.not.equal(ids[2]);

const windowSources = await getSources({
types: ['window'],
thumbnailSize: { width: 0, height: 0 }
});
w.destroy();

expect(windowSources).to.be.an('array').that.is.not.empty();
for (const source of windowSources) {
const sourceIds = source.id.split(':');
expect(sourceIds[1]).to.not.equal(sourceIds[2]);
}
});

it('moveAbove should move the window at the requested place', async () => {
// DesktopCapturer.getSources() is guaranteed to return in the correct
// z-order from foreground to background.
const MAX_WIN = 4;
Expand Down

0 comments on commit f517d38

Please sign in to comment.