fix: pageVisibility
state when backgroundThrottling
disabled (#39223)
fix: pageVisibility state when backgroundThrottling disabled
This commit is contained in:
parent
c9bae5da8e
commit
6df392162f
5 changed files with 63 additions and 25 deletions
|
@ -4072,7 +4072,8 @@ describe('BrowserWindow module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('document.visibilityState/hidden', () => {
|
||||
// TODO(codebytere): figure out how to make these pass in CI on Windows.
|
||||
ifdescribe(process.platform !== 'win32')('document.visibilityState/hidden', () => {
|
||||
afterEach(closeAllWindows);
|
||||
|
||||
it('visibilityState is initially visible despite window being hidden', async () => {
|
||||
|
@ -4100,8 +4101,7 @@ describe('BrowserWindow module', () => {
|
|||
expect(hidden).to.be.false('hidden');
|
||||
});
|
||||
|
||||
// TODO(nornagon): figure out why this is failing on windows
|
||||
ifit(process.platform !== 'win32')('visibilityState changes when window is hidden', async () => {
|
||||
it('visibilityState changes when window is hidden', async () => {
|
||||
const w = new BrowserWindow({
|
||||
width: 100,
|
||||
height: 100,
|
||||
|
@ -4128,8 +4128,7 @@ describe('BrowserWindow module', () => {
|
|||
}
|
||||
});
|
||||
|
||||
// TODO(nornagon): figure out why this is failing on windows
|
||||
ifit(process.platform !== 'win32')('visibilityState changes when window is shown', async () => {
|
||||
it('visibilityState changes when window is shown', async () => {
|
||||
const w = new BrowserWindow({
|
||||
width: 100,
|
||||
height: 100,
|
||||
|
@ -4150,7 +4149,7 @@ describe('BrowserWindow module', () => {
|
|||
expect(visibilityState).to.equal('visible');
|
||||
});
|
||||
|
||||
ifit(process.platform !== 'win32')('visibilityState changes when window is shown inactive', async () => {
|
||||
it('visibilityState changes when window is shown inactive', async () => {
|
||||
const w = new BrowserWindow({
|
||||
width: 100,
|
||||
height: 100,
|
||||
|
@ -4170,7 +4169,6 @@ describe('BrowserWindow module', () => {
|
|||
expect(visibilityState).to.equal('visible');
|
||||
});
|
||||
|
||||
// TODO(nornagon): figure out why this is failing on windows
|
||||
ifit(process.platform === 'darwin')('visibilityState changes when window is minimized', async () => {
|
||||
const w = new BrowserWindow({
|
||||
width: 100,
|
||||
|
@ -4197,8 +4195,6 @@ describe('BrowserWindow module', () => {
|
|||
}
|
||||
});
|
||||
|
||||
// DISABLED-FIXME(MarshallOfSound): This test fails locally 100% of the time, on CI it started failing
|
||||
// when we introduced the compositor recycling patch. Should figure out how to fix this
|
||||
it('visibilityState remains visible if backgroundThrottling is disabled', async () => {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
|
@ -4206,10 +4202,13 @@ describe('BrowserWindow module', () => {
|
|||
height: 100,
|
||||
webPreferences: {
|
||||
backgroundThrottling: false,
|
||||
nodeIntegration: true
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false
|
||||
}
|
||||
});
|
||||
|
||||
w.loadFile(path.join(fixtures, 'pages', 'visibilitychange.html'));
|
||||
|
||||
{
|
||||
const [, visibilityState, hidden] = await once(ipcMain, 'pong');
|
||||
expect(visibilityState).to.equal('visible');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue