Fix media permissions failure on Calls window (#2550)
This commit is contained in:
@@ -358,5 +358,26 @@ describe('main/windows/callsWidgetWindow', () => {
|
|||||||
expect(popOut.focus).toHaveBeenCalled();
|
expect(popOut.focus).toHaveBeenCalled();
|
||||||
expect(popOut.restore).toHaveBeenCalled();
|
expect(popOut.restore).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('getWebContentsId', () => {
|
||||||
|
baseWindow.webContents = {
|
||||||
|
...baseWindow.webContents,
|
||||||
|
id: 'testID',
|
||||||
|
};
|
||||||
|
|
||||||
|
const widgetWindow = new CallsWidgetWindow(mainWindow, mainView, widgetConfig);
|
||||||
|
expect(widgetWindow.getWebContentsId()).toBe('testID');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getURL', () => {
|
||||||
|
baseWindow.webContents = {
|
||||||
|
...baseWindow.webContents,
|
||||||
|
id: 'testID',
|
||||||
|
getURL: jest.fn(() => 'http://localhost:8065/'),
|
||||||
|
};
|
||||||
|
|
||||||
|
const widgetWindow = new CallsWidgetWindow(mainWindow, mainView, widgetConfig);
|
||||||
|
expect(widgetWindow.getURL().toString()).toBe('http://localhost:8065/');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -24,6 +24,7 @@ import {
|
|||||||
CALLS_PLUGIN_ID,
|
CALLS_PLUGIN_ID,
|
||||||
} from 'common/utils/constants';
|
} from 'common/utils/constants';
|
||||||
import Utils from 'common/utils/util';
|
import Utils from 'common/utils/util';
|
||||||
|
import urlUtils from 'common/utils/url';
|
||||||
import {
|
import {
|
||||||
CALLS_JOINED_CALL,
|
CALLS_JOINED_CALL,
|
||||||
CALLS_POPOUT_FOCUS,
|
CALLS_POPOUT_FOCUS,
|
||||||
@@ -210,5 +211,13 @@ export default class CallsWidgetWindow extends EventEmitter {
|
|||||||
}
|
}
|
||||||
this.popOut.focus();
|
this.popOut.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getWebContentsId() {
|
||||||
|
return this.win.webContents.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getURL() {
|
||||||
|
return urlUtils.parseURL(this.win.webContents.getURL());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1183,4 +1183,35 @@ describe('main/windows/windowManager', () => {
|
|||||||
expect(windowManager.switchServer).toHaveBeenCalledWith('server-2');
|
expect(windowManager.switchServer).toHaveBeenCalledWith('server-2');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('getServerURLFromWebContentsId', () => {
|
||||||
|
const view = {
|
||||||
|
name: 'server-1_tab-messaging',
|
||||||
|
serverInfo: {
|
||||||
|
remoteInfo: {
|
||||||
|
siteURL: 'http://server-1.com',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const windowManager = new WindowManager();
|
||||||
|
windowManager.viewManager = {
|
||||||
|
views: new Map([
|
||||||
|
['server-1_tab-messaging', view],
|
||||||
|
]),
|
||||||
|
findViewByWebContent: jest.fn(),
|
||||||
|
};
|
||||||
|
|
||||||
|
it('should return calls widget URL', () => {
|
||||||
|
CallsWidgetWindow.mockImplementation(() => {
|
||||||
|
return {
|
||||||
|
on: jest.fn(),
|
||||||
|
getURL: jest.fn(() => 'http://localhost:8065'),
|
||||||
|
getWebContentsId: jest.fn(() => 'callsID'),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
windowManager.createCallsWidgetWindow(null, 'server-1_tab-messaging', {callID: 'test'});
|
||||||
|
expect(windowManager.getServerURLFromWebContentsId('callsID')).toBe(windowManager.callsWidgetWindow.getURL());
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -862,6 +862,10 @@ export class WindowManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getServerURLFromWebContentsId = (id: number) => {
|
getServerURLFromWebContentsId = (id: number) => {
|
||||||
|
if (this.callsWidgetWindow && id === this.callsWidgetWindow.getWebContentsId()) {
|
||||||
|
return this.callsWidgetWindow.getURL();
|
||||||
|
}
|
||||||
|
|
||||||
const viewName = this.getViewNameByWebContentsId(id);
|
const viewName = this.getViewNameByWebContentsId(id);
|
||||||
if (!viewName) {
|
if (!viewName) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
Reference in New Issue
Block a user