Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3b1b226

Browse files
authored
[dotnet] [bidi] Support SetScreenSettingsOverrideAsync method in Emulation module (#16704)
1 parente453a9f commit3b1b226

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

‎dotnet/src/webdriver/BiDi/Emulation/EmulationModule.cs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ public async Task<SetScreenOrientationOverrideResult> SetScreenOrientationOverri
7070
returnawaitBroker.ExecuteCommandAsync(newSetScreenOrientationOverrideCommand(@params),options,_jsonContext.SetScreenOrientationOverrideCommand,_jsonContext.SetScreenOrientationOverrideResult).ConfigureAwait(false);
7171
}
7272

73+
publicasyncTask<SetScreenSettingsOverrideResult>SetScreenSettingsOverrideAsync(ScreenArea?screenArea,SetScreenSettingsOverrideOptions?options=null)
74+
{
75+
var@params=newSetScreenSettingsOverrideParameters(screenArea,options?.Contexts,options?.UserContexts);
76+
77+
returnawaitBroker.ExecuteCommandAsync(newSetScreenSettingsOverrideCommand(@params),options,_jsonContext.SetScreenSettingsOverrideCommand,_jsonContext.SetScreenSettingsOverrideResult).ConfigureAwait(false);
78+
}
79+
7380
publicasyncTask<SetGeolocationOverrideResult>SetGeolocationCoordinatesOverrideAsync(doublelatitude,doublelongitude,SetGeolocationCoordinatesOverrideOptions?options=null)
7481
{
7582
varcoordinates=newGeolocationCoordinates(latitude,longitude,options?.Accuracy,options?.Altitude,options?.AltitudeAccuracy,options?.Heading,options?.Speed);
@@ -114,6 +121,8 @@ protected override void Initialize(JsonSerializerOptions jsonSerializerOptions)
114121
[JsonSerializable(typeof(SetScriptingEnabledResult))]
115122
[JsonSerializable(typeof(SetScreenOrientationOverrideCommand))]
116123
[JsonSerializable(typeof(SetScreenOrientationOverrideResult))]
124+
[JsonSerializable(typeof(SetScreenSettingsOverrideCommand))]
125+
[JsonSerializable(typeof(SetScreenSettingsOverrideResult))]
117126
[JsonSerializable(typeof(SetGeolocationOverrideCommand))]
118127
[JsonSerializable(typeof(SetGeolocationOverrideResult))]
119128

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// <copyright file="SetScreenSettingsOverrideCommand.cs" company="Selenium Committers">
2+
// Licensed to the Software Freedom Conservancy (SFC) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The SFC licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing,
13+
// software distributed under the License is distributed on an
14+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
// KIND, either express or implied. See the License for the
16+
// specific language governing permissions and limitations
17+
// under the License.
18+
// </copyright>
19+
20+
usingSystem.Collections.Generic;
21+
usingSystem.Text.Json.Serialization;
22+
23+
namespaceOpenQA.Selenium.BiDi.Emulation;
24+
25+
internalsealedclassSetScreenSettingsOverrideCommand(SetScreenSettingsOverrideParameters@params)
26+
:Command<SetScreenSettingsOverrideParameters,SetScreenSettingsOverrideResult>(@params,"emulation.setScreenSettingsOverride");
27+
28+
internal sealedrecord SetScreenSettingsOverrideParameters([property:JsonIgnore(Condition=JsonIgnoreCondition.Never)]ScreenArea?ScreenArea,IEnumerable<BrowsingContext.BrowsingContext>?Contexts,IEnumerable<Browser.UserContext>?UserContexts):Parameters;
29+
30+
public sealedclass SetScreenSettingsOverrideOptions:CommandOptions
31+
{
32+
publicIEnumerable<BrowsingContext.BrowsingContext>?Contexts{get;set;}
33+
34+
publicIEnumerable<Browser.UserContext>?UserContexts{get;set;}
35+
}
36+
37+
publicsealedrecordScreenArea(longWidth,longHeight);
38+
39+
publicsealedrecordSetScreenSettingsOverrideResult:EmptyResult;

‎dotnet/test/common/BiDi/Emulation/EmulationTest.cs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,21 @@ public void CanSetScreenOrientationOverrideToDefault()
167167
Throws.Nothing);
168168
}
169169

170+
[Test]
171+
[IgnoreBrowser(Selenium.Browser.Chrome,"Not supported yet?")]
172+
[IgnoreBrowser(Selenium.Browser.Edge,"Not supported yet?")]
173+
[IgnoreBrowser(Selenium.Browser.Firefox,"Not supported yet?")]
174+
publicvoidCanSetScreenSettingsOverride()
175+
{
176+
varscreenArea=newScreenArea(300,200);
177+
178+
Assert.That(async()=>
179+
{
180+
awaitbidi.Emulation.SetScreenSettingsOverrideAsync(screenArea,new(){Contexts=[context]});
181+
},
182+
Throws.Nothing);
183+
}
184+
170185
[Test]
171186
publicvoidCanSetGeolocationCoordinatesOverride()
172187
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp