mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Extract timeoutPromise into async-spec-helpers
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
committed by
Nathan Sobo
parent
82f0003302
commit
87d684132c
@@ -48,6 +48,12 @@ export function conditionPromise (condition) {
|
||||
})
|
||||
}
|
||||
|
||||
export function timeoutPromise (timeout) {
|
||||
return new Promise(function (resolve) {
|
||||
global.setTimeout(resolve, timeout)
|
||||
})
|
||||
}
|
||||
|
||||
function waitsForPromise (fn) {
|
||||
const promise = fn()
|
||||
// This timeout is 3 minutes. We need to bump it back down once we fix
|
||||
|
||||
@@ -7,6 +7,7 @@ import fs from 'fs-plus'
|
||||
import path from 'path'
|
||||
import AtomApplication from '../../src/main-process/atom-application'
|
||||
import parseCommandLine from '../../src/main-process/parse-command-line'
|
||||
import {timeoutPromise} from '../async-spec-helpers'
|
||||
|
||||
const ATOM_RESOURCE_PATH = path.resolve(__dirname, '..', '..')
|
||||
|
||||
@@ -271,7 +272,7 @@ describe('AtomApplication', function () {
|
||||
await window1.loadedPromise
|
||||
|
||||
// wait a bit just to make sure we don't pass due to querying the render process before it loads
|
||||
await getTimeoutPromise(1000)
|
||||
await timeoutPromise(1000)
|
||||
|
||||
const itemCount = await evalInWebContents(window1.browserWindow.webContents, function (sendBackToMainProcess) {
|
||||
sendBackToMainProcess(atom.workspace.getActivePane().getItems().length)
|
||||
@@ -399,12 +400,6 @@ describe('AtomApplication', function () {
|
||||
})
|
||||
}
|
||||
|
||||
function getTimeoutPromise (timeout) {
|
||||
return new Promise(function (resolve) {
|
||||
global.setTimeout(resolve, timeout)
|
||||
})
|
||||
}
|
||||
|
||||
function clearElectronSession () {
|
||||
return new Promise(function (resolve) {
|
||||
electron.session.defaultSession.clearStorageData(function () {
|
||||
|
||||
@@ -5085,12 +5085,6 @@ describe('TextEditorComponent', function () {
|
||||
}
|
||||
}
|
||||
|
||||
function timeoutPromise (timeout) {
|
||||
return new Promise(function (resolve) {
|
||||
window.setTimeout(resolve, timeout)
|
||||
})
|
||||
}
|
||||
|
||||
function nextAnimationFramePromise () {
|
||||
return new Promise(function (resolve) {
|
||||
window.requestAnimationFrame(resolve)
|
||||
|
||||
Reference in New Issue
Block a user