Remove _behaviors abstraction in Chromium reporting (#20106)

* remove over abstraction.

* delete unused file
This commit is contained in:
Stacey Gammon 2018-06-28 14:03:19 -04:00 committed by GitHub
parent 575bc35f36
commit db1aad03bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 32 deletions

View file

@ -1,20 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export class IgnoreSSLErrorsBehavior {
constructor(client) {
this._client = client;
}
async initialize() {
const { Security } = this._client;
await Security.enable();
await Security.setOverrideCertificateErrors({ override: true });
Security.certificateError(({ eventId }) => {
Security.handleCertificateError({ eventId, action: 'continue' });
});
}
}

View file

@ -1,7 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export { IgnoreSSLErrorsBehavior } from './ignore_ssl_errors';

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export async function ignoreSSLErrorsBehavior(Security) {
await Security.enable();
await Security.setOverrideCertificateErrors({ override: true });
Security.certificateError(({ eventId }) => {
Security.handleCertificateError({ eventId, action: 'continue' });
});
}

View file

@ -9,7 +9,7 @@ import path from 'path';
import moment from 'moment';
import { promisify, delay } from 'bluebird';
import { transformFn } from './transform_fn';
import { IgnoreSSLErrorsBehavior } from './behaviors';
import { ignoreSSLErrorsBehavior } from './ignore_ssl_errors';
import { screenshotStitcher } from './screenshot_stitcher';
export class HeadlessChromiumDriver {
@ -19,9 +19,6 @@ export class HeadlessChromiumDriver {
this._waitForDelayMs = 100;
this._zoom = 1;
this._logger = logger;
this._behaviors = [
new IgnoreSSLErrorsBehavior(client),
];
}
async destroy() {
@ -46,7 +43,7 @@ export class HeadlessChromiumDriver {
Page.enable(),
]);
await Promise.all(this._behaviors.map(behavior => behavior.initialize()));
await ignoreSSLErrorsBehavior(this._client.Security);
await Network.setExtraHTTPHeaders({ headers });
await Page.navigate({ url });
await Page.loadEventFired();