fix: switch to mojo proxy resolver (3-1-x) (#15813)
This commit is contained in:
parent
d5a6bb665b
commit
4abf55801f
65 changed files with 1838 additions and 1797 deletions
|
@ -4,13 +4,14 @@ const fs = require('fs')
|
|||
const os = require('os')
|
||||
const path = require('path')
|
||||
const ChildProcess = require('child_process')
|
||||
const {remote} = require('electron')
|
||||
const {netLog} = remote
|
||||
const { remote } = require('electron')
|
||||
const { session } = remote
|
||||
const appPath = path.join(__dirname, 'fixtures', 'api', 'net-log')
|
||||
const dumpFile = path.join(os.tmpdir(), 'net_log.json')
|
||||
const dumpFileDynamic = path.join(os.tmpdir(), 'net_log_dynamic.json')
|
||||
|
||||
const isCI = remote.getGlobal('isCi')
|
||||
const netLog = session.fromPartition('net-log').netLog
|
||||
|
||||
describe('netLog module', () => {
|
||||
let server
|
||||
|
@ -45,8 +46,12 @@ describe('netLog module', () => {
|
|||
|
||||
afterEach(() => {
|
||||
try {
|
||||
fs.unlinkSync(dumpFile)
|
||||
fs.unlinkSync(dumpFileDynamic)
|
||||
if (fs.existsSync(dumpFile)) {
|
||||
fs.unlinkSync(dumpFile)
|
||||
}
|
||||
if (fs.existsSync(dumpFileDynamic)) {
|
||||
fs.unlinkSync(dumpFileDynamic)
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore error
|
||||
}
|
||||
|
@ -87,22 +92,21 @@ describe('netLog module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
// The following tests are skipped on Linux CI
|
||||
|
||||
it('should begin and end logging automatically when --log-net-log is passed', (done) => {
|
||||
it('should begin and end logging automatically when --log-net-log is passed', done => {
|
||||
if (isCI && process.platform === 'linux') {
|
||||
done()
|
||||
return
|
||||
}
|
||||
|
||||
let appProcess = ChildProcess.spawn(remote.process.execPath,
|
||||
[appPath, `--log-net-log=${dumpFile}`], {
|
||||
const appProcess = ChildProcess.spawn(remote.process.execPath,
|
||||
[appPath], {
|
||||
env: {
|
||||
TEST_REQUEST_URL: server.url
|
||||
TEST_REQUEST_URL: server.url,
|
||||
TEST_DUMP_FILE: dumpFile
|
||||
}
|
||||
})
|
||||
|
||||
appProcess.once('exit', () => {
|
||||
appProcess.once('close', () => {
|
||||
assert(fs.existsSync(dumpFile))
|
||||
done()
|
||||
})
|
||||
|
@ -114,20 +118,17 @@ describe('netLog module', () => {
|
|||
return
|
||||
}
|
||||
|
||||
let appProcess = ChildProcess.spawn(remote.process.execPath,
|
||||
[appPath, `--log-net-log=${dumpFile}`], {
|
||||
const appProcess = ChildProcess.spawn(remote.process.execPath,
|
||||
[appPath], {
|
||||
env: {
|
||||
TEST_REQUEST_URL: server.url,
|
||||
TEST_DUMP_FILE: dumpFileDynamic,
|
||||
TEST_DUMP_FILE: dumpFile,
|
||||
TEST_DUMP_FILE_DYNAMIC: dumpFileDynamic,
|
||||
TEST_MANUAL_STOP: true
|
||||
}
|
||||
})
|
||||
|
||||
appProcess.stdout.on('data', (data) => {
|
||||
console.log(data.toString())
|
||||
})
|
||||
|
||||
appProcess.once('exit', () => {
|
||||
appProcess.once('close', () => {
|
||||
assert(fs.existsSync(dumpFile))
|
||||
assert(fs.existsSync(dumpFileDynamic))
|
||||
done()
|
||||
|
@ -144,11 +145,11 @@ describe('netLog module', () => {
|
|||
[appPath], {
|
||||
env: {
|
||||
TEST_REQUEST_URL: server.url,
|
||||
TEST_DUMP_FILE: dumpFileDynamic
|
||||
TEST_DUMP_FILE_DYNAMIC: dumpFileDynamic
|
||||
}
|
||||
})
|
||||
|
||||
appProcess.once('exit', () => {
|
||||
appProcess.once('close', () => {
|
||||
assert(fs.existsSync(dumpFileDynamic))
|
||||
done()
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue