Skip to content

Commit

Permalink
browsingContext.navigate -> PROTO.browsingContext.navigate
Browse files Browse the repository at this point in the history
  • Loading branch information
sadym-chromium committed Oct 11, 2021
1 parent 3c4986a commit 1be66dd
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 28 deletions.
32 changes: 17 additions & 15 deletions src/bidiMapper/bidiProtocolTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,25 @@ export namespace BrowsingContext {
context: BrowsingContext;
};

export type BrowsingContextNavigateCommand = {
method: 'browsingContext.navigate';
params: BrowsingContextNavigateParameters;
};
export namespace PROTO {
export type BrowsingContextNavigateCommand = {
method: 'PROTO.browsingContext.navigate';
params: BrowsingContextNavigateParameters;
};

export type BrowsingContextNavigateParameters = {
context: BrowsingContext;
url: string;
wait?: ReadinessState;
};
export type BrowsingContextNavigateParameters = {
context: BrowsingContext;
url: string;
wait?: ReadinessState;
};

export type ReadinessState = 'none';
// TODO sadym: implement 'interactive' and 'complete' states.
export type BrowsingContextNavigateResult = {
navigation?: Navigation;
url: string;
};
export type ReadinessState = 'none';
// TODO sadym: implement 'interactive' and 'complete' states.
export type BrowsingContextNavigateResult = {
navigation?: Navigation;
url: string;
};
}
}

export namespace Session {
Expand Down
6 changes: 3 additions & 3 deletions src/bidiMapper/commandProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ export class CommandProcessor {
return await this._contextProcessor.process_browsingContext_create(
commandData as BrowsingContext.BrowsingContextCreateCommand
);
case 'browsingContext.navigate':
return await this._contextProcessor.process_browsingContext_navigate(
commandData as BrowsingContext.BrowsingContextNavigateCommand
case 'PROTO.browsingContext.navigate':
return await this._contextProcessor.process_PROTO_browsingContext_navigate(
commandData as BrowsingContext.PROTO.BrowsingContextNavigateCommand
);

case 'PROTO.script.invoke':
Expand Down
6 changes: 3 additions & 3 deletions src/bidiMapper/domains/context/browsingContextProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ export class BrowsingContextProcessor {
});
}

async process_browsingContext_navigate(
commandData: BrowsingContext.BrowsingContextNavigateCommand
): Promise<BrowsingContext.BrowsingContextNavigateResult> {
async process_PROTO_browsingContext_navigate(
commandData: BrowsingContext.PROTO.BrowsingContextNavigateCommand
): Promise<BrowsingContext.PROTO.BrowsingContextNavigateResult> {
const params = commandData.params;
const context = await this._getKnownContext(params.context);

Expand Down
4 changes: 2 additions & 2 deletions src/bidiMapper/domains/context/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export class Context {

public async navigate(
url: string,
wait: BrowsingContext.ReadinessState = 'none'
): Promise<BrowsingContext.BrowsingContextNavigateResult> {
wait: BrowsingContext.PROTO.ReadinessState = 'none'
): Promise<BrowsingContext.PROTO.BrowsingContextNavigateResult> {
// TODO sadym: implement.
if (wait !== 'none') {
throw new Error(`Not implenented wait '${wait}'`);
Expand Down
10 changes: 5 additions & 5 deletions tests/test_bidi.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ async def _ignore_test_PageClose_browsingContextContextDestroyedEmitted(websocke
"url": "about:blank"}}

@pytest.mark.asyncio
async def test_navigateWaitNone_navigated(websocket):
async def test_PROTO_navigateWaitNone_navigated(websocket):
contextID = await get_open_context_id(websocket)

# Send command.
command = {
"id": 15,
"method": "browsingContext.navigate",
"method": "PROTO.browsingContext.navigate",
"params": {
"url": "data:text/html,<h2>test</h2>",
"wait": "none",
Expand All @@ -265,17 +265,17 @@ async def test_navigateWaitNone_navigated(websocket):

@pytest.mark.asyncio
# Not implemented yet.
async def _ignore_test_navigateWaitInteractive_navigated(websocket):
async def _ignore_test_PROTO_navigateWaitInteractive_navigated(websocket):
ignore = True

@pytest.mark.asyncio
# Not implemented yet.
async def _ignore_test_navigateWaitComplete_navigated(websocket):
async def _ignore_test_PROTO_navigateWaitComplete_navigated(websocket):
ignore = True

@pytest.mark.asyncio
# Not implemented yet.
async def _ignore_test_navigateWithShortTimeout_timeoutOccuredAndEventPageLoadEmitted(websocket):
async def _ignore_test_PROTO_navigateWithShortTimeout_timeoutOccuredAndEventPageLoadEmitted(websocket):
contextID = await get_open_context_id(websocket)

# Send command.
Expand Down

0 comments on commit 1be66dd

Please sign in to comment.