feat(rpc): align class names with api docs (#3164)

This commit is contained in:
Dmitry Gozman 2020-07-26 21:27:09 -07:00 committed by GitHub
parent d0b758a8d2
commit f4e584ea08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 4 deletions

View file

@ -17,7 +17,7 @@
import * as types from '../../types';
import { PageChannel } from '../channels';
export class Coverage {
export class ChromiumCoverage {
private _channel: PageChannel;
constructor(channel: PageChannel) {

View file

@ -39,6 +39,8 @@ import { ChromiumBrowserContext } from './chromiumBrowserContext';
import { Selectors } from './selectors';
import { Stream } from './stream';
import { createScheme, Validator, ValidationError } from '../validator';
import { WebKitBrowser } from './webkitBrowser';
import { FirefoxBrowser } from './firefoxBrowser';
class Root extends ChannelOwner<Channel, {}> {
constructor(connection: Connection) {
@ -126,6 +128,10 @@ export class Connection {
case 'Browser':
if ((parent as BrowserType).name() === 'chromium')
result = new ChromiumBrowser(parent, type, guid, initializer);
else if ((parent as BrowserType).name() === 'webkit')
result = new WebKitBrowser(parent, type, guid, initializer);
else if ((parent as BrowserType).name() === 'firefox')
result = new FirefoxBrowser(parent, type, guid, initializer);
else
result = new Browser(parent, type, guid, initializer);
break;

View file

@ -0,0 +1,20 @@
/**
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Browser } from './browser';
export class FirefoxBrowser extends Browser {
}

View file

@ -35,7 +35,7 @@ import { Func1, FuncOn, SmartHandle, serializeArgument, parseResult } from './js
import { Request, Response, Route, RouteHandler } from './network';
import { FileChooser } from './fileChooser';
import { Buffer } from 'buffer';
import { Coverage } from './coverage';
import { ChromiumCoverage } from './chromiumCoverage';
import { Waiter } from './waiter';
import * as fs from 'fs';
@ -57,7 +57,7 @@ export class Page extends ChannelOwner<PageChannel, PageInitializer> {
readonly accessibility: Accessibility;
readonly keyboard: Keyboard;
readonly mouse: Mouse;
coverage: Coverage | null = null;
coverage: ChromiumCoverage | null = null;
pdf?: (options?: types.PDFOptions) => Promise<Buffer>;
readonly _bindings = new Map<string, FunctionWithSource>();
@ -109,7 +109,7 @@ export class Page extends ChannelOwner<PageChannel, PageInitializer> {
this._channel.on('worker', ({ worker }) => this._onWorker(Worker.from(worker)));
if (this._browserContext._browserName === 'chromium') {
this.coverage = new Coverage(this._channel);
this.coverage = new ChromiumCoverage(this._channel);
this.pdf = options => this._pdf(options);
}
}

View file

@ -0,0 +1,20 @@
/**
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Browser } from './browser';
export class WebKitBrowser extends Browser {
}