refactor: create request context from network context (#14656)

* [ci skip] refactor: create request context from network context

* [ci skip] refactor: subscribe to mojo cookiemanager for cookie changes

* [ci skip] refactor: manage the lifetime of custom URLRequestJobFactory

* refactor: use OOP mojo proxy resolver

* revert: add support for kIgnoreCertificateErrorsSPKIList

* build: provide service manifest overlays for content services

* chore: gn format

* fix: log-net-log switch not working as expected

* spec: verify proxy settings are respected from pac script with session.setProxy

* chore: use chrome constants where possible

* fix: initialize request context for global cert fetcher

* refactor: fix destruction of request context getters

* spec: use custom session for proxy tests

* fix: queue up additional stop callbacks while net log is being stopped

* fix: Add CHECK for cookie manager retrieval

* chore: add helper to retrieve logging state for net log module

* fix: ui::ResourceBundle::GetRawDataResourceForScale => GetRawDataResource

* style: comment unused parameters

* build: move //components/certificate_transparency deps from //brightray

* chore: update gritsettings_resource_ids patch

* chore: update api for chromium 68

* fix: net log instance is now a property of session
This commit is contained in:
Robo 2018-10-04 23:38:56 +05:30 committed by Charles Kerr
parent 27bbf6a3c6
commit 434a6e3561
73 changed files with 2031 additions and 1844 deletions

View file

@ -6,7 +6,7 @@ const os = require('os')
const path = require('path')
const ChildProcess = require('child_process')
const { remote } = require('electron')
const { netLog } = remote
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')
@ -14,6 +14,7 @@ const dumpFileDynamic = path.join(os.tmpdir(), 'net_log_dynamic.json')
const { expect } = chai
chai.use(dirtyChai)
const isCI = remote.getGlobal('isCi')
const netLog = session.fromPartition('net-log').netLog
describe('netLog module', () => {
let server
@ -48,8 +49,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
}
@ -89,8 +94,6 @@ 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 => {
if (isCI && process.platform === 'linux') {
done()
@ -98,13 +101,14 @@ describe('netLog module', () => {
}
const appProcess = ChildProcess.spawn(remote.process.execPath,
[appPath, `--log-net-log=${dumpFile}`], {
[appPath], {
env: {
TEST_REQUEST_URL: server.url
TEST_REQUEST_URL: server.url,
TEST_DUMP_FILE: dumpFile
}
})
appProcess.once('exit', () => {
appProcess.once('close', () => {
expect(fs.existsSync(dumpFile)).to.be.true()
done()
})
@ -117,19 +121,16 @@ describe('netLog module', () => {
}
const appProcess = ChildProcess.spawn(remote.process.execPath,
[appPath, `--log-net-log=${dumpFile}`], {
[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', () => {
expect(fs.existsSync(dumpFile)).to.be.true()
expect(fs.existsSync(dumpFileDynamic)).to.be.true()
done()
@ -146,11 +147,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', () => {
expect(fs.existsSync(dumpFileDynamic)).to.be.true()
done()
})