feat(rpc): align class names with api docs (#3164)
This commit is contained in:
parent
d0b758a8d2
commit
f4e584ea08
|
|
@ -17,7 +17,7 @@
|
||||||
import * as types from '../../types';
|
import * as types from '../../types';
|
||||||
import { PageChannel } from '../channels';
|
import { PageChannel } from '../channels';
|
||||||
|
|
||||||
export class Coverage {
|
export class ChromiumCoverage {
|
||||||
private _channel: PageChannel;
|
private _channel: PageChannel;
|
||||||
|
|
||||||
constructor(channel: PageChannel) {
|
constructor(channel: PageChannel) {
|
||||||
|
|
@ -39,6 +39,8 @@ import { ChromiumBrowserContext } from './chromiumBrowserContext';
|
||||||
import { Selectors } from './selectors';
|
import { Selectors } from './selectors';
|
||||||
import { Stream } from './stream';
|
import { Stream } from './stream';
|
||||||
import { createScheme, Validator, ValidationError } from '../validator';
|
import { createScheme, Validator, ValidationError } from '../validator';
|
||||||
|
import { WebKitBrowser } from './webkitBrowser';
|
||||||
|
import { FirefoxBrowser } from './firefoxBrowser';
|
||||||
|
|
||||||
class Root extends ChannelOwner<Channel, {}> {
|
class Root extends ChannelOwner<Channel, {}> {
|
||||||
constructor(connection: Connection) {
|
constructor(connection: Connection) {
|
||||||
|
|
@ -126,6 +128,10 @@ export class Connection {
|
||||||
case 'Browser':
|
case 'Browser':
|
||||||
if ((parent as BrowserType).name() === 'chromium')
|
if ((parent as BrowserType).name() === 'chromium')
|
||||||
result = new ChromiumBrowser(parent, type, guid, initializer);
|
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
|
else
|
||||||
result = new Browser(parent, type, guid, initializer);
|
result = new Browser(parent, type, guid, initializer);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
20
src/rpc/client/firefoxBrowser.ts
Normal file
20
src/rpc/client/firefoxBrowser.ts
Normal 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 {
|
||||||
|
}
|
||||||
|
|
@ -35,7 +35,7 @@ import { Func1, FuncOn, SmartHandle, serializeArgument, parseResult } from './js
|
||||||
import { Request, Response, Route, RouteHandler } from './network';
|
import { Request, Response, Route, RouteHandler } from './network';
|
||||||
import { FileChooser } from './fileChooser';
|
import { FileChooser } from './fileChooser';
|
||||||
import { Buffer } from 'buffer';
|
import { Buffer } from 'buffer';
|
||||||
import { Coverage } from './coverage';
|
import { ChromiumCoverage } from './chromiumCoverage';
|
||||||
import { Waiter } from './waiter';
|
import { Waiter } from './waiter';
|
||||||
|
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
@ -57,7 +57,7 @@ export class Page extends ChannelOwner<PageChannel, PageInitializer> {
|
||||||
readonly accessibility: Accessibility;
|
readonly accessibility: Accessibility;
|
||||||
readonly keyboard: Keyboard;
|
readonly keyboard: Keyboard;
|
||||||
readonly mouse: Mouse;
|
readonly mouse: Mouse;
|
||||||
coverage: Coverage | null = null;
|
coverage: ChromiumCoverage | null = null;
|
||||||
pdf?: (options?: types.PDFOptions) => Promise<Buffer>;
|
pdf?: (options?: types.PDFOptions) => Promise<Buffer>;
|
||||||
|
|
||||||
readonly _bindings = new Map<string, FunctionWithSource>();
|
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)));
|
this._channel.on('worker', ({ worker }) => this._onWorker(Worker.from(worker)));
|
||||||
|
|
||||||
if (this._browserContext._browserName === 'chromium') {
|
if (this._browserContext._browserName === 'chromium') {
|
||||||
this.coverage = new Coverage(this._channel);
|
this.coverage = new ChromiumCoverage(this._channel);
|
||||||
this.pdf = options => this._pdf(options);
|
this.pdf = options => this._pdf(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
src/rpc/client/webkitBrowser.ts
Normal file
20
src/rpc/client/webkitBrowser.ts
Normal 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 {
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue