|
@@ -945,6 +945,7 @@ describe('chromium features', () => {
|
|
|
afterEach(closeAllWindows);
|
|
|
afterEach(() => {
|
|
|
session.defaultSession.setPermissionCheckHandler(null);
|
|
|
+ session.defaultSession.setPermissionRequestHandler(null);
|
|
|
});
|
|
|
|
|
|
it('can return labels of enumerated devices', async () => {
|
|
@@ -994,6 +995,32 @@ describe('chromium features', () => {
|
|
|
const [, secondDeviceIds] = await emittedOnce(ipcMain, 'deviceIds', () => w.webContents.reload());
|
|
|
expect(firstDeviceIds).to.not.deep.equal(secondDeviceIds);
|
|
|
});
|
|
|
+
|
|
|
+ it('provides a securityOrigin to the request handler', async () => {
|
|
|
+ session.defaultSession.setPermissionRequestHandler(
|
|
|
+ (wc, permission, callback, details) => {
|
|
|
+ if (details.securityOrigin !== undefined) {
|
|
|
+ callback(true);
|
|
|
+ } else {
|
|
|
+ callback(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ const w = new BrowserWindow({ show: false });
|
|
|
+ w.loadFile(path.join(fixturesPath, 'pages', 'blank.html'));
|
|
|
+ const labels = await w.webContents.executeJavaScript(`navigator.mediaDevices.getUserMedia({
|
|
|
+ video: {
|
|
|
+ mandatory: {
|
|
|
+ chromeMediaSource: "desktop",
|
|
|
+ minWidth: 1280,
|
|
|
+ maxWidth: 1280,
|
|
|
+ minHeight: 720,
|
|
|
+ maxHeight: 720
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).then((stream) => stream.getVideoTracks())`);
|
|
|
+ expect(labels.some((l: any) => l)).to.be.true();
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
describe('window.opener access', () => {
|