001package Torello.Browser.BrowserAPI; 002 003// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 004// Java-HTML Imports 005// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 006 007import Torello.Browser.*; 008import Torello.Browser.helper.*; 009import Torello.Browser.JavaScriptAPI.*; 010import Torello.JSON.*; 011 012import Torello.Java.ReadOnly.ReadOnlyList; 013import Torello.Java.ReadOnly.ReadOnlyArrayList; 014 015import Torello.JavaDoc.Annotations.StaticFunctional; 016import Torello.JavaDoc.Annotations.JDHeaderBackgroundImg; 017 018import Torello.Browser.BrowserAPI.NestedHelpers.Commands.Emulation$$Commands; 019 020 021// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 022// JDK Imports 023// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 024 025import javax.json.JsonObject; 026import javax.json.JsonValue; 027 028/** 029 * <SPAN CLASS=COPIEDJDK><B>This domain emulates different environments for the page.</B></SPAN> 030 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.CODE_GEN_NOTE> 031 */ 032@StaticFunctional@JDHeaderBackgroundImg(EmbedTagFileID="CDP.WOOD_PLANK_NOTE") 033public class Emulation 034{ 035 // No Pubic Constructors 036 private Emulation() { } 037 038 039 // ******************************************************************************************** 040 // ******************************************************************************************** 041 // Marker Events 042 // ******************************************************************************************** 043 // ******************************************************************************************** 044 045 046 /** 047 * Notification sent after the virtual time budget for the current VirtualTimePolicy has run out. 048 * 049 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 050 051 * 052 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.MarkerEvent 053 * DATA-NAME=virtualTimeBudgetExpired> 054 */ 055 public static final String virtualTimeBudgetExpired = "Emulation.virtualTimeBudgetExpired Marker Event"; 056 057 058 // ******************************************************************************************** 059 // ******************************************************************************************** 060 // Enumerated String Constants Lists 061 // ******************************************************************************************** 062 // ******************************************************************************************** 063 064 065 /** 066 * Enum of image types that can be disabled. 067 * 068 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 069 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 070 */ 071 public static final ReadOnlyList<String> DisabledImageType = new ReadOnlyArrayList<> 072 (String.class, "avif", "webp"); 073 074 /** 075 * <CODE>[No Description Provided by Google]</CODE> 076 * 077 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 078 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 079 */ 080 public static final ReadOnlyList<String> PressureSource = new ReadOnlyArrayList<> 081 (String.class, "cpu"); 082 083 /** 084 * <CODE>[No Description Provided by Google]</CODE> 085 * 086 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 087 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 088 */ 089 public static final ReadOnlyList<String> PressureState = new ReadOnlyArrayList<> 090 (String.class, "critical", "fair", "nominal", "serious"); 091 092 /** 093 * Used to specify sensor types to emulate. 094 * See https://w3c.github.io/sensors/#automation for more information. 095 * 096 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 097 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 098 */ 099 public static final ReadOnlyList<String> SensorType = new ReadOnlyArrayList<>( 100 String.class, 101 "absolute-orientation", "accelerometer", "ambient-light", "gravity", "gyroscope", 102 "linear-acceleration", "magnetometer", "relative-orientation" 103 ); 104 105 /** 106 * advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to 107 * allow the next delayed task (if any) to run; pause: The virtual time base may not advance; 108 * pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending 109 * resource fetches. 110 * 111 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 112 * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B> 113 */ 114 public static final ReadOnlyList<String> VirtualTimePolicy = new ReadOnlyArrayList<> 115 (String.class, "advance", "pause", "pauseIfNetworkFetchesPending"); 116 117 118 119 // ******************************************************************************************** 120 // ******************************************************************************************** 121 // Basic Types 122 // ******************************************************************************************** 123 // ******************************************************************************************** 124 125 126 /** 127 * <CODE>[No Description Provided by Google]</CODE> 128 * 129 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 130 */ 131 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 132 public static class DevicePosture 133 extends BaseType<DevicePosture> 134 implements java.io.Serializable 135 { 136 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 137 protected static final long serialVersionUID = 1; 138 139 private static final NestedHelper<Emulation.DevicePosture> singleton = 140 Torello.Browser.BrowserAPI.NestedHelpers.Types. 141 Emulation$$DevicePosture$$.singleton; 142 143 /** 144 * Current posture of the device 145 * <EMBED CLASS='external-html' DATA-D=Emulation DATA-C=DevicePosture DATA-F=type DATA-FILE-ID=CDP.EL1> 146 * @see BaseType#enumStrList(String) 147 */ 148 public final String type; 149 150 /** Constructor. Please review this class' fields for documentation. */ 151 public DevicePosture(ReadOnlyList<Boolean> isPresent, String type) 152 { 153 super(singleton, Domains.Emulation, "DevicePosture", 1); 154 155 this.type = type; 156 157 this.isPresent = (isPresent == null) 158 ? singleton.generateIsPresentList(this) 159 : THROWS.check(isPresent, 1, "Emulation.DevicePosture"); 160 } 161 162 /** Creates an instance of this class from a {@link JsonObject}.*/ 163 public static DevicePosture fromJSON(JsonObject jo) 164 { return singleton.fromJSON(jo); } 165 166 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 167 public static NestedDescriptor<DevicePosture> descriptor() 168 { return singleton.descriptor(); } 169 } 170 171 /** 172 * <CODE>[No Description Provided by Google]</CODE> 173 * 174 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 175 */ 176 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 177 public static class DisplayFeature 178 extends BaseType<DisplayFeature> 179 implements java.io.Serializable 180 { 181 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 182 protected static final long serialVersionUID = 1; 183 184 private static final NestedHelper<Emulation.DisplayFeature> singleton = 185 Torello.Browser.BrowserAPI.NestedHelpers.Types. 186 Emulation$$DisplayFeature$$.singleton; 187 188 /** 189 * Orientation of a display feature in relation to screen 190 * <EMBED CLASS='external-html' DATA-D=Emulation DATA-C=DisplayFeature DATA-F=orientation DATA-FILE-ID=CDP.EL1> 191 * @see BaseType#enumStrList(String) 192 */ 193 public final String orientation; 194 195 /** 196 * The offset from the screen origin in either the x (for vertical 197 * orientation) or y (for horizontal orientation) direction. 198 */ 199 public final int offset; 200 201 /** 202 * A display feature may mask content such that it is not physically 203 * displayed - this length along with the offset describes this area. 204 * A display feature that only splits content will have a 0 mask_length. 205 */ 206 public final int maskLength; 207 208 /** Constructor. Please review this class' fields for documentation. */ 209 public DisplayFeature 210 (ReadOnlyList<Boolean> isPresent, String orientation, int offset, int maskLength) 211 { 212 super(singleton, Domains.Emulation, "DisplayFeature", 3); 213 214 this.orientation = orientation; 215 this.offset = offset; 216 this.maskLength = maskLength; 217 218 this.isPresent = (isPresent == null) 219 ? singleton.generateIsPresentList(this) 220 : THROWS.check(isPresent, 3, "Emulation.DisplayFeature"); 221 } 222 223 /** Creates an instance of this class from a {@link JsonObject}.*/ 224 public static DisplayFeature fromJSON(JsonObject jo) 225 { return singleton.fromJSON(jo); } 226 227 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 228 public static NestedDescriptor<DisplayFeature> descriptor() 229 { return singleton.descriptor(); } 230 } 231 232 /** 233 * <CODE>[No Description Provided by Google]</CODE> 234 * 235 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 236 */ 237 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 238 public static class MediaFeature 239 extends BaseType<MediaFeature> 240 implements java.io.Serializable 241 { 242 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 243 protected static final long serialVersionUID = 1; 244 245 private static final NestedHelper<Emulation.MediaFeature> singleton = 246 Torello.Browser.BrowserAPI.NestedHelpers.Types. 247 Emulation$$MediaFeature$$.singleton; 248 249 /** <CODE>[No Description Provided by Google]</CODE> */ 250 public final String name; 251 252 /** <CODE>[No Description Provided by Google]</CODE> */ 253 public final String value; 254 255 /** Constructor. Please review this class' fields for documentation. */ 256 public MediaFeature(ReadOnlyList<Boolean> isPresent, String name, String value) 257 { 258 super(singleton, Domains.Emulation, "MediaFeature", 2); 259 260 this.name = name; 261 this.value = value; 262 263 this.isPresent = (isPresent == null) 264 ? singleton.generateIsPresentList(this) 265 : THROWS.check(isPresent, 2, "Emulation.MediaFeature"); 266 } 267 268 /** Creates an instance of this class from a {@link JsonObject}.*/ 269 public static MediaFeature fromJSON(JsonObject jo) 270 { return singleton.fromJSON(jo); } 271 272 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 273 public static NestedDescriptor<MediaFeature> descriptor() 274 { return singleton.descriptor(); } 275 } 276 277 /** 278 * <CODE>[No Description Provided by Google]</CODE> 279 * 280 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 281 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 282 */ 283 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 284 public static class PressureMetadata 285 extends BaseType<PressureMetadata> 286 implements java.io.Serializable 287 { 288 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 289 protected static final long serialVersionUID = 1; 290 291 private static final NestedHelper<Emulation.PressureMetadata> singleton = 292 Torello.Browser.BrowserAPI.NestedHelpers.Types. 293 Emulation$$PressureMetadata$$.singleton; 294 295 /** 296 * <CODE>[No Description Provided by Google]</CODE> 297 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 298 */ 299 public final Boolean available; 300 301 /** Constructor. Please review this class' fields for documentation. */ 302 public PressureMetadata(ReadOnlyList<Boolean> isPresent, Boolean available) 303 { 304 super(singleton, Domains.Emulation, "PressureMetadata", 1); 305 306 this.available = available; 307 308 this.isPresent = (isPresent == null) 309 ? singleton.generateIsPresentList(this) 310 : THROWS.check(isPresent, 1, "Emulation.PressureMetadata"); 311 } 312 313 /** Creates an instance of this class from a {@link JsonObject}.*/ 314 public static PressureMetadata fromJSON(JsonObject jo) 315 { return singleton.fromJSON(jo); } 316 317 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 318 public static NestedDescriptor<PressureMetadata> descriptor() 319 { return singleton.descriptor(); } 320 } 321 322 /** 323 * <CODE>[No Description Provided by Google]</CODE> 324 * 325 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 326 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 327 */ 328 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 329 public static class SafeAreaInsets 330 extends BaseType<SafeAreaInsets> 331 implements java.io.Serializable 332 { 333 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 334 protected static final long serialVersionUID = 1; 335 336 private static final NestedHelper<Emulation.SafeAreaInsets> singleton = 337 Torello.Browser.BrowserAPI.NestedHelpers.Types. 338 Emulation$$SafeAreaInsets$$.singleton; 339 340 /** 341 * Overrides safe-area-inset-top. 342 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 343 */ 344 public final Integer top; 345 346 /** 347 * Overrides safe-area-max-inset-top. 348 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 349 */ 350 public final Integer topMax; 351 352 /** 353 * Overrides safe-area-inset-left. 354 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 355 */ 356 public final Integer left; 357 358 /** 359 * Overrides safe-area-max-inset-left. 360 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 361 */ 362 public final Integer leftMax; 363 364 /** 365 * Overrides safe-area-inset-bottom. 366 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 367 */ 368 public final Integer bottom; 369 370 /** 371 * Overrides safe-area-max-inset-bottom. 372 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 373 */ 374 public final Integer bottomMax; 375 376 /** 377 * Overrides safe-area-inset-right. 378 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 379 */ 380 public final Integer right; 381 382 /** 383 * Overrides safe-area-max-inset-right. 384 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 385 */ 386 public final Integer rightMax; 387 388 /** Constructor. Please review this class' fields for documentation. */ 389 public SafeAreaInsets( 390 ReadOnlyList<Boolean> isPresent, Integer top, Integer topMax, Integer left, 391 Integer leftMax, Integer bottom, Integer bottomMax, Integer right, Integer rightMax 392 ) 393 { 394 super(singleton, Domains.Emulation, "SafeAreaInsets", 8); 395 396 this.top = top; 397 this.topMax = topMax; 398 this.left = left; 399 this.leftMax = leftMax; 400 this.bottom = bottom; 401 this.bottomMax = bottomMax; 402 this.right = right; 403 this.rightMax = rightMax; 404 405 this.isPresent = (isPresent == null) 406 ? singleton.generateIsPresentList(this) 407 : THROWS.check(isPresent, 8, "Emulation.SafeAreaInsets"); 408 } 409 410 /** Creates an instance of this class from a {@link JsonObject}.*/ 411 public static SafeAreaInsets fromJSON(JsonObject jo) 412 { return singleton.fromJSON(jo); } 413 414 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 415 public static NestedDescriptor<SafeAreaInsets> descriptor() 416 { return singleton.descriptor(); } 417 } 418 419 /** 420 * Screen orientation. 421 * 422 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 423 */ 424 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 425 public static class ScreenOrientation 426 extends BaseType<ScreenOrientation> 427 implements java.io.Serializable 428 { 429 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 430 protected static final long serialVersionUID = 1; 431 432 private static final NestedHelper<Emulation.ScreenOrientation> singleton = 433 Torello.Browser.BrowserAPI.NestedHelpers.Types. 434 Emulation$$ScreenOrientation$$.singleton; 435 436 /** 437 * Orientation type. 438 * <EMBED CLASS='external-html' DATA-D=Emulation DATA-C=ScreenOrientation DATA-F=type DATA-FILE-ID=CDP.EL1> 439 * @see BaseType#enumStrList(String) 440 */ 441 public final String type; 442 443 /** Orientation angle. */ 444 public final int angle; 445 446 /** Constructor. Please review this class' fields for documentation. */ 447 public ScreenOrientation(ReadOnlyList<Boolean> isPresent, String type, int angle) 448 { 449 super(singleton, Domains.Emulation, "ScreenOrientation", 2); 450 451 this.type = type; 452 this.angle = angle; 453 454 this.isPresent = (isPresent == null) 455 ? singleton.generateIsPresentList(this) 456 : THROWS.check(isPresent, 2, "Emulation.ScreenOrientation"); 457 } 458 459 /** Creates an instance of this class from a {@link JsonObject}.*/ 460 public static ScreenOrientation fromJSON(JsonObject jo) 461 { return singleton.fromJSON(jo); } 462 463 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 464 public static NestedDescriptor<ScreenOrientation> descriptor() 465 { return singleton.descriptor(); } 466 } 467 468 /** 469 * <CODE>[No Description Provided by Google]</CODE> 470 * 471 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 472 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 473 */ 474 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 475 public static class SensorMetadata 476 extends BaseType<SensorMetadata> 477 implements java.io.Serializable 478 { 479 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 480 protected static final long serialVersionUID = 1; 481 482 private static final NestedHelper<Emulation.SensorMetadata> singleton = 483 Torello.Browser.BrowserAPI.NestedHelpers.Types. 484 Emulation$$SensorMetadata$$.singleton; 485 486 /** 487 * <CODE>[No Description Provided by Google]</CODE> 488 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 489 */ 490 public final Boolean available; 491 492 /** 493 * <CODE>[No Description Provided by Google]</CODE> 494 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 495 */ 496 public final Number minimumFrequency; 497 498 /** 499 * <CODE>[No Description Provided by Google]</CODE> 500 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 501 */ 502 public final Number maximumFrequency; 503 504 /** Constructor. Please review this class' fields for documentation. */ 505 public SensorMetadata( 506 ReadOnlyList<Boolean> isPresent, Boolean available, Number minimumFrequency, 507 Number maximumFrequency 508 ) 509 { 510 super(singleton, Domains.Emulation, "SensorMetadata", 3); 511 512 this.available = available; 513 this.minimumFrequency = minimumFrequency; 514 this.maximumFrequency = maximumFrequency; 515 516 this.isPresent = (isPresent == null) 517 ? singleton.generateIsPresentList(this) 518 : THROWS.check(isPresent, 3, "Emulation.SensorMetadata"); 519 } 520 521 /** Creates an instance of this class from a {@link JsonObject}.*/ 522 public static SensorMetadata fromJSON(JsonObject jo) 523 { return singleton.fromJSON(jo); } 524 525 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 526 public static NestedDescriptor<SensorMetadata> descriptor() 527 { return singleton.descriptor(); } 528 } 529 530 /** 531 * <CODE>[No Description Provided by Google]</CODE> 532 * 533 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 534 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 535 */ 536 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 537 public static class SensorReading 538 extends BaseType<SensorReading> 539 implements java.io.Serializable 540 { 541 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 542 protected static final long serialVersionUID = 1; 543 544 private static final NestedHelper<Emulation.SensorReading> singleton = 545 Torello.Browser.BrowserAPI.NestedHelpers.Types. 546 Emulation$$SensorReading$$.singleton; 547 548 /** 549 * <CODE>[No Description Provided by Google]</CODE> 550 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 551 */ 552 public final Emulation.SensorReadingSingle single; 553 554 /** 555 * <CODE>[No Description Provided by Google]</CODE> 556 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 557 */ 558 public final Emulation.SensorReadingXYZ xyz; 559 560 /** 561 * <CODE>[No Description Provided by Google]</CODE> 562 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 563 */ 564 public final Emulation.SensorReadingQuaternion quaternion; 565 566 /** Constructor. Please review this class' fields for documentation. */ 567 public SensorReading( 568 ReadOnlyList<Boolean> isPresent, SensorReadingSingle single, SensorReadingXYZ xyz, 569 SensorReadingQuaternion quaternion 570 ) 571 { 572 super(singleton, Domains.Emulation, "SensorReading", 3); 573 574 this.single = single; 575 this.xyz = xyz; 576 this.quaternion = quaternion; 577 578 this.isPresent = (isPresent == null) 579 ? singleton.generateIsPresentList(this) 580 : THROWS.check(isPresent, 3, "Emulation.SensorReading"); 581 } 582 583 /** Creates an instance of this class from a {@link JsonObject}.*/ 584 public static SensorReading fromJSON(JsonObject jo) 585 { return singleton.fromJSON(jo); } 586 587 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 588 public static NestedDescriptor<SensorReading> descriptor() 589 { return singleton.descriptor(); } 590 } 591 592 /** 593 * <CODE>[No Description Provided by Google]</CODE> 594 * 595 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 596 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 597 */ 598 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 599 public static class SensorReadingQuaternion 600 extends BaseType<SensorReadingQuaternion> 601 implements java.io.Serializable 602 { 603 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 604 protected static final long serialVersionUID = 1; 605 606 private static final NestedHelper<Emulation.SensorReadingQuaternion> singleton = 607 Torello.Browser.BrowserAPI.NestedHelpers.Types. 608 Emulation$$SensorReadingQuaternion$$.singleton; 609 610 /** <CODE>[No Description Provided by Google]</CODE> */ 611 public final Number x; 612 613 /** <CODE>[No Description Provided by Google]</CODE> */ 614 public final Number y; 615 616 /** <CODE>[No Description Provided by Google]</CODE> */ 617 public final Number z; 618 619 /** <CODE>[No Description Provided by Google]</CODE> */ 620 public final Number w; 621 622 /** Constructor. Please review this class' fields for documentation. */ 623 public SensorReadingQuaternion 624 (ReadOnlyList<Boolean> isPresent, Number x, Number y, Number z, Number w) 625 { 626 super(singleton, Domains.Emulation, "SensorReadingQuaternion", 4); 627 628 this.x = x; 629 this.y = y; 630 this.z = z; 631 this.w = w; 632 633 this.isPresent = (isPresent == null) 634 ? singleton.generateIsPresentList(this) 635 : THROWS.check(isPresent, 4, "Emulation.SensorReadingQuaternion"); 636 } 637 638 /** Creates an instance of this class from a {@link JsonObject}.*/ 639 public static SensorReadingQuaternion fromJSON(JsonObject jo) 640 { return singleton.fromJSON(jo); } 641 642 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 643 public static NestedDescriptor<SensorReadingQuaternion> descriptor() 644 { return singleton.descriptor(); } 645 } 646 647 /** 648 * <CODE>[No Description Provided by Google]</CODE> 649 * 650 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 651 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 652 */ 653 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 654 public static class SensorReadingSingle 655 extends BaseType<SensorReadingSingle> 656 implements java.io.Serializable 657 { 658 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 659 protected static final long serialVersionUID = 1; 660 661 private static final NestedHelper<Emulation.SensorReadingSingle> singleton = 662 Torello.Browser.BrowserAPI.NestedHelpers.Types. 663 Emulation$$SensorReadingSingle$$.singleton; 664 665 /** <CODE>[No Description Provided by Google]</CODE> */ 666 public final Number value; 667 668 /** Constructor. Please review this class' fields for documentation. */ 669 public SensorReadingSingle(ReadOnlyList<Boolean> isPresent, Number value) 670 { 671 super(singleton, Domains.Emulation, "SensorReadingSingle", 1); 672 673 this.value = value; 674 675 this.isPresent = (isPresent == null) 676 ? singleton.generateIsPresentList(this) 677 : THROWS.check(isPresent, 1, "Emulation.SensorReadingSingle"); 678 } 679 680 /** Creates an instance of this class from a {@link JsonObject}.*/ 681 public static SensorReadingSingle fromJSON(JsonObject jo) 682 { return singleton.fromJSON(jo); } 683 684 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 685 public static NestedDescriptor<SensorReadingSingle> descriptor() 686 { return singleton.descriptor(); } 687 } 688 689 /** 690 * <CODE>[No Description Provided by Google]</CODE> 691 * 692 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 693 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 694 */ 695 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 696 public static class SensorReadingXYZ 697 extends BaseType<SensorReadingXYZ> 698 implements java.io.Serializable 699 { 700 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 701 protected static final long serialVersionUID = 1; 702 703 private static final NestedHelper<Emulation.SensorReadingXYZ> singleton = 704 Torello.Browser.BrowserAPI.NestedHelpers.Types. 705 Emulation$$SensorReadingXYZ$$.singleton; 706 707 /** <CODE>[No Description Provided by Google]</CODE> */ 708 public final Number x; 709 710 /** <CODE>[No Description Provided by Google]</CODE> */ 711 public final Number y; 712 713 /** <CODE>[No Description Provided by Google]</CODE> */ 714 public final Number z; 715 716 /** Constructor. Please review this class' fields for documentation. */ 717 public SensorReadingXYZ(ReadOnlyList<Boolean> isPresent, Number x, Number y, Number z) 718 { 719 super(singleton, Domains.Emulation, "SensorReadingXYZ", 3); 720 721 this.x = x; 722 this.y = y; 723 this.z = z; 724 725 this.isPresent = (isPresent == null) 726 ? singleton.generateIsPresentList(this) 727 : THROWS.check(isPresent, 3, "Emulation.SensorReadingXYZ"); 728 } 729 730 /** Creates an instance of this class from a {@link JsonObject}.*/ 731 public static SensorReadingXYZ fromJSON(JsonObject jo) 732 { return singleton.fromJSON(jo); } 733 734 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 735 public static NestedDescriptor<SensorReadingXYZ> descriptor() 736 { return singleton.descriptor(); } 737 } 738 739 /** 740 * Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints 741 * 742 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 743 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 744 */ 745 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 746 public static class UserAgentBrandVersion 747 extends BaseType<UserAgentBrandVersion> 748 implements java.io.Serializable 749 { 750 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 751 protected static final long serialVersionUID = 1; 752 753 private static final NestedHelper<Emulation.UserAgentBrandVersion> singleton = 754 Torello.Browser.BrowserAPI.NestedHelpers.Types. 755 Emulation$$UserAgentBrandVersion$$.singleton; 756 757 /** <CODE>[No Description Provided by Google]</CODE> */ 758 public final String brand; 759 760 /** <CODE>[No Description Provided by Google]</CODE> */ 761 public final String version; 762 763 /** Constructor. Please review this class' fields for documentation. */ 764 public UserAgentBrandVersion(ReadOnlyList<Boolean> isPresent, String brand, String version) 765 { 766 super(singleton, Domains.Emulation, "UserAgentBrandVersion", 2); 767 768 this.brand = brand; 769 this.version = version; 770 771 this.isPresent = (isPresent == null) 772 ? singleton.generateIsPresentList(this) 773 : THROWS.check(isPresent, 2, "Emulation.UserAgentBrandVersion"); 774 } 775 776 /** Creates an instance of this class from a {@link JsonObject}.*/ 777 public static UserAgentBrandVersion fromJSON(JsonObject jo) 778 { return singleton.fromJSON(jo); } 779 780 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 781 public static NestedDescriptor<UserAgentBrandVersion> descriptor() 782 { return singleton.descriptor(); } 783 } 784 785 /** 786 * Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints 787 * Missing optional values will be filled in by the target with what it would normally use. 788 * 789 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 790 * <EMBED CLASS=globalDefs DATA-DOMAIN=Emulation DATA-API=BrowserAPI> 791 */ 792 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 793 public static class UserAgentMetadata 794 extends BaseType<UserAgentMetadata> 795 implements java.io.Serializable 796 { 797 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 798 protected static final long serialVersionUID = 1; 799 800 private static final NestedHelper<Emulation.UserAgentMetadata> singleton = 801 Torello.Browser.BrowserAPI.NestedHelpers.Types. 802 Emulation$$UserAgentMetadata$$.singleton; 803 804 /** 805 * Brands appearing in Sec-CH-UA. 806 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 807 */ 808 public final Emulation.UserAgentBrandVersion[] brands; 809 810 /** 811 * Brands appearing in Sec-CH-UA-Full-Version-List. 812 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 813 */ 814 public final Emulation.UserAgentBrandVersion[] fullVersionList; 815 816 /** 817 * <CODE>[No Description Provided by Google]</CODE> 818 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Dep-Top>DEPRECATED</B> 819 */ 820 public final String fullVersion; 821 822 /** <CODE>[No Description Provided by Google]</CODE> */ 823 public final String platform; 824 825 /** <CODE>[No Description Provided by Google]</CODE> */ 826 public final String platformVersion; 827 828 /** <CODE>[No Description Provided by Google]</CODE> */ 829 public final String architecture; 830 831 /** <CODE>[No Description Provided by Google]</CODE> */ 832 public final String model; 833 834 /** <CODE>[No Description Provided by Google]</CODE> */ 835 public final boolean mobile; 836 837 /** 838 * <CODE>[No Description Provided by Google]</CODE> 839 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 840 */ 841 public final String bitness; 842 843 /** 844 * <CODE>[No Description Provided by Google]</CODE> 845 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 846 */ 847 public final Boolean wow64; 848 849 /** 850 * Used to specify User Agent form-factor values. 851 * See https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors 852 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 853 */ 854 public final String[] formFactors; 855 856 /** Constructor. Please review this class' fields for documentation. */ 857 public UserAgentMetadata( 858 ReadOnlyList<Boolean> isPresent, UserAgentBrandVersion[] brands, 859 UserAgentBrandVersion[] fullVersionList, String fullVersion, String platform, 860 String platformVersion, String architecture, String model, boolean mobile, 861 String bitness, Boolean wow64, String[] formFactors 862 ) 863 { 864 super(singleton, Domains.Emulation, "UserAgentMetadata", 11); 865 866 this.brands = brands; 867 this.fullVersionList = fullVersionList; 868 this.fullVersion = fullVersion; 869 this.platform = platform; 870 this.platformVersion = platformVersion; 871 this.architecture = architecture; 872 this.model = model; 873 this.mobile = mobile; 874 this.bitness = bitness; 875 this.wow64 = wow64; 876 this.formFactors = formFactors; 877 878 this.isPresent = (isPresent == null) 879 ? singleton.generateIsPresentList(this) 880 : THROWS.check(isPresent, 11, "Emulation.UserAgentMetadata"); 881 } 882 883 /** Creates an instance of this class from a {@link JsonObject}.*/ 884 public static UserAgentMetadata fromJSON(JsonObject jo) 885 { return singleton.fromJSON(jo); } 886 887 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 888 public static NestedDescriptor<UserAgentMetadata> descriptor() 889 { return singleton.descriptor(); } 890 } 891 892 893 894 895 // ******************************************************************************************** 896 // ******************************************************************************************** 897 // Commands 898 // ******************************************************************************************** 899 // ******************************************************************************************** 900 901 902 /** 903 * Tells whether emulation is supported. 904 * 905 * <BR /><B CLASS=Dep-Top>DEPRECATED</B> 906 * 907 * @return An instance of <CODE>{@link Script}<Boolean></CODE> 908 * 909 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 910 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 911 * <CODE><Boolean></CODE> will be returned 912 * 913 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 914 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 915 * be retrieved.</I> 916 * 917 * <BR /><BR /><DIV CLASS=JDHint> 918 * This Browser Function's {@code Promise} returns: 919 * <CODE>Boolean (<B>result</B>)</CODE> 920 * <BR /> 921 * True if emulation is supported. 922 * </DIV> 923 */ 924 public static Script<Boolean> canEmulate() 925 { 926 // Ultra-Simple Request JSON - Because this method has no parameters 927 final String requestJSON = "{\"method\":\"Emulation.canEmulate\"}"; 928 929 return new Script<>( 930 Domains.Emulation, "canEmulate", requestJSON, 931 jo -> ReadBoxedJSON.getBoolean(jo, "result", JFlag.RD_N | JFlag.RD_M, DV.NULL_BOOL), 932 Boolean.class 933 ); 934 } 935 936 /** 937 * Clears the overridden device metrics. 938 * 939 * @return An instance of <CODE>{@link Script}<Void></CODE> 940 * 941 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 942 * browser receives the invocation-request. 943 * 944 * <BR /><BR /><DIV CLASS=JDHint> 945 * This Browser-Function <I>does not have</I> a return-value. You may choose to 946 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 947 * the Browser Function has run to completion. 948 * </DIV> 949 */ 950 public static Script<Void> clearDeviceMetricsOverride() 951 { 952 // Ultra-Simple Request JSON - Because this method has no parameters 953 final String requestJSON = "{\"method\":\"Emulation.clearDeviceMetricsOverride\"}"; 954 955 return Script.NO_RET(Domains.Emulation, "clearDeviceMetricsOverride", requestJSON); 956 } 957 958 /** 959 * Clears a device posture override set with either setDeviceMetricsOverride() 960 * or setDevicePostureOverride() and starts using posture information from the 961 * platform again. 962 * Does nothing if no override is set. 963 * 964 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 965 * 966 * @return An instance of <CODE>{@link Script}<Void></CODE> 967 * 968 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 969 * browser receives the invocation-request. 970 * 971 * <BR /><BR /><DIV CLASS=JDHint> 972 * This Browser-Function <I>does not have</I> a return-value. You may choose to 973 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 974 * the Browser Function has run to completion. 975 * </DIV> 976 */ 977 public static Script<Void> clearDevicePostureOverride() 978 { 979 // Ultra-Simple Request JSON - Because this method has no parameters 980 final String requestJSON = "{\"method\":\"Emulation.clearDevicePostureOverride\"}"; 981 982 return Script.NO_RET(Domains.Emulation, "clearDevicePostureOverride", requestJSON); 983 } 984 985 /** 986 * Clears the display features override set with either setDeviceMetricsOverride() 987 * or setDisplayFeaturesOverride() and starts using display features from the 988 * platform again. 989 * Does nothing if no override is set. 990 * 991 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 992 * 993 * @return An instance of <CODE>{@link Script}<Void></CODE> 994 * 995 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 996 * browser receives the invocation-request. 997 * 998 * <BR /><BR /><DIV CLASS=JDHint> 999 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1000 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1001 * the Browser Function has run to completion. 1002 * </DIV> 1003 */ 1004 public static Script<Void> clearDisplayFeaturesOverride() 1005 { 1006 // Ultra-Simple Request JSON - Because this method has no parameters 1007 final String requestJSON = "{\"method\":\"Emulation.clearDisplayFeaturesOverride\"}"; 1008 1009 return Script.NO_RET(Domains.Emulation, "clearDisplayFeaturesOverride", requestJSON); 1010 } 1011 1012 /** 1013 * Clears the overridden Geolocation Position and Error. 1014 * 1015 * @return An instance of <CODE>{@link Script}<Void></CODE> 1016 * 1017 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1018 * browser receives the invocation-request. 1019 * 1020 * <BR /><BR /><DIV CLASS=JDHint> 1021 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1022 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1023 * the Browser Function has run to completion. 1024 * </DIV> 1025 */ 1026 public static Script<Void> clearGeolocationOverride() 1027 { 1028 // Ultra-Simple Request JSON - Because this method has no parameters 1029 final String requestJSON = "{\"method\":\"Emulation.clearGeolocationOverride\"}"; 1030 1031 return Script.NO_RET(Domains.Emulation, "clearGeolocationOverride", requestJSON); 1032 } 1033 1034 /** 1035 * Clears Idle state overrides. 1036 * 1037 * @return An instance of <CODE>{@link Script}<Void></CODE> 1038 * 1039 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1040 * browser receives the invocation-request. 1041 * 1042 * <BR /><BR /><DIV CLASS=JDHint> 1043 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1044 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1045 * the Browser Function has run to completion. 1046 * </DIV> 1047 */ 1048 public static Script<Void> clearIdleOverride() 1049 { 1050 // Ultra-Simple Request JSON - Because this method has no parameters 1051 final String requestJSON = "{\"method\":\"Emulation.clearIdleOverride\"}"; 1052 1053 return Script.NO_RET(Domains.Emulation, "clearIdleOverride", requestJSON); 1054 } 1055 1056 /** 1057 * <CODE>[No Description Provided by Google]</CODE> 1058 * 1059 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1060 * 1061 * @param type - 1062 * 1063 * @return An instance of <CODE>{@link Script}<Number></CODE> 1064 * 1065 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 1066 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 1067 * <CODE><Number></CODE> will be returned 1068 * 1069 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 1070 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 1071 * be retrieved.</I> 1072 * 1073 * <BR /><BR /><DIV CLASS=JDHint> 1074 * This Browser Function's {@code Promise} returns: 1075 * <CODE>Number (<B>requestedSamplingFrequency</B>)</CODE> 1076 * </DIV> 1077 */ 1078 public static Script<Number> getOverriddenSensorInformation(String type) 1079 { 1080 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1081 final String requestJSON = WriteJSON.get 1082 (CDPTypes.STRING, "type", false, "Emulation.getOverriddenSensorInformation", type); 1083 1084 return new Script<>( 1085 Domains.Emulation, "getOverriddenSensorInformation", requestJSON, 1086 jo -> ReadNumberJSON.get(jo, "requestedSamplingFrequency", true, false), 1087 Number.class 1088 ); 1089 } 1090 1091 /** 1092 * Requests that page scale factor is reset to initial values. 1093 * 1094 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1095 * 1096 * @return An instance of <CODE>{@link Script}<Void></CODE> 1097 * 1098 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1099 * browser receives the invocation-request. 1100 * 1101 * <BR /><BR /><DIV CLASS=JDHint> 1102 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1103 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1104 * the Browser Function has run to completion. 1105 * </DIV> 1106 */ 1107 public static Script<Void> resetPageScaleFactor() 1108 { 1109 // Ultra-Simple Request JSON - Because this method has no parameters 1110 final String requestJSON = "{\"method\":\"Emulation.resetPageScaleFactor\"}"; 1111 1112 return Script.NO_RET(Domains.Emulation, "resetPageScaleFactor", requestJSON); 1113 } 1114 1115 /** 1116 * Automatically render all web contents using a dark theme. 1117 * 1118 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1119 * 1120 * @param enabled 1121 * Whether to enable or disable automatic dark mode. 1122 * If not specified, any existing override will be cleared. 1123 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1124 * 1125 * @return An instance of <CODE>{@link Script}<Void></CODE> 1126 * 1127 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1128 * browser receives the invocation-request. 1129 * 1130 * <BR /><BR /><DIV CLASS=JDHint> 1131 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1132 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1133 * the Browser Function has run to completion. 1134 * </DIV> 1135 */ 1136 public static Script<Void> setAutoDarkModeOverride(Boolean enabled) 1137 { 1138 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1139 final String requestJSON = WriteJSON.get( 1140 CDPTypes.BOXED_BOOLEAN, "enabled", true, "Emulation.setAutoDarkModeOverride", 1141 enabled 1142 ); 1143 1144 return Script.NO_RET(Domains.Emulation, "setAutoDarkModeOverride", requestJSON); 1145 } 1146 1147 /** 1148 * Allows overriding the automation flag. 1149 * 1150 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1151 * 1152 * @param enabled Whether the override should be enabled. 1153 * 1154 * @return An instance of <CODE>{@link Script}<Void></CODE> 1155 * 1156 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1157 * browser receives the invocation-request. 1158 * 1159 * <BR /><BR /><DIV CLASS=JDHint> 1160 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1161 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1162 * the Browser Function has run to completion. 1163 * </DIV> 1164 */ 1165 public static Script<Void> setAutomationOverride(boolean enabled) 1166 { 1167 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1168 final String requestJSON = WriteJSON.get( 1169 CDPTypes.PRIMITIVE_BOOLEAN, "enabled", false, "Emulation.setAutomationOverride", 1170 enabled 1171 ); 1172 1173 return Script.NO_RET(Domains.Emulation, "setAutomationOverride", requestJSON); 1174 } 1175 1176 /** 1177 * Enables CPU throttling to emulate slow CPUs. 1178 * 1179 * @param rate Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc). 1180 * 1181 * @return An instance of <CODE>{@link Script}<Void></CODE> 1182 * 1183 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1184 * browser receives the invocation-request. 1185 * 1186 * <BR /><BR /><DIV CLASS=JDHint> 1187 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1188 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1189 * the Browser Function has run to completion. 1190 * </DIV> 1191 */ 1192 public static Script<Void> setCPUThrottlingRate(Number rate) 1193 { 1194 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1195 final String requestJSON = WriteJSON.get 1196 (CDPTypes.NUMBER, "rate", false, "Emulation.setCPUThrottlingRate", rate); 1197 1198 return Script.NO_RET(Domains.Emulation, "setCPUThrottlingRate", requestJSON); 1199 } 1200 1201 /** 1202 * Override the value of navigator.connection.saveData 1203 * 1204 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1205 * 1206 * @param dataSaverEnabled Override value. Omitting the parameter disables the override. 1207 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1208 * 1209 * @return An instance of <CODE>{@link Script}<Void></CODE> 1210 * 1211 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1212 * browser receives the invocation-request. 1213 * 1214 * <BR /><BR /><DIV CLASS=JDHint> 1215 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1216 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1217 * the Browser Function has run to completion. 1218 * </DIV> 1219 */ 1220 public static Script<Void> setDataSaverOverride(Boolean dataSaverEnabled) 1221 { 1222 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1223 final String requestJSON = WriteJSON.get( 1224 CDPTypes.BOXED_BOOLEAN, "dataSaverEnabled", true, "Emulation.setDataSaverOverride", 1225 dataSaverEnabled 1226 ); 1227 1228 return Script.NO_RET(Domains.Emulation, "setDataSaverOverride", requestJSON); 1229 } 1230 1231 /** 1232 * Sets or clears an override of the default background color of the frame. This override is used 1233 * if the content does not specify one. 1234 * 1235 * @param color 1236 * RGBA of the default background color. If not specified, any existing override will be 1237 * cleared. 1238 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1239 * 1240 * @return An instance of <CODE>{@link Script}<Void></CODE> 1241 * 1242 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1243 * browser receives the invocation-request. 1244 * 1245 * <BR /><BR /><DIV CLASS=JDHint> 1246 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1247 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1248 * the Browser Function has run to completion. 1249 * </DIV> 1250 */ 1251 public static Script<Void> setDefaultBackgroundColorOverride(DOM.RGBA color) 1252 { 1253 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1254 final String requestJSON = WriteJSON.get( 1255 CDPTypes.CDP_TYPE, "color", true, "Emulation.setDefaultBackgroundColorOverride", 1256 color 1257 ); 1258 1259 return Script.NO_RET(Domains.Emulation, "setDefaultBackgroundColorOverride", requestJSON); 1260 } 1261 1262 /** 1263 * Overrides the values of device screen dimensions (window.screen.width, window.screen.height, 1264 * window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media 1265 * query results). 1266 * 1267 * <BR /><BR /><DIV CLASS=JDHint> 1268 * 👍 Because of the sheer number of input parameters to this method, there is a 1269 * a {@link CommandBuilder} variant to this method which may be invoked instead. 1270 * 1271 * <BR /><BR /> 1272 * Please View: {@link #setDeviceMetricsOverride()} 1273 * </DIV> 1274 * 1275 * @param width Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override. 1276 * 1277 * @param height Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. 1278 * 1279 * @param deviceScaleFactor Overriding device scale factor value. 0 disables the override. 1280 * 1281 * @param mobile 1282 * Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text 1283 * autosizing and more. 1284 * 1285 * @param scale Scale to apply to resulting view image. 1286 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 1287 * 1288 * @param screenWidth Overriding screen width value in pixels (minimum 0, maximum 10000000). 1289 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 1290 * 1291 * @param screenHeight Overriding screen height value in pixels (minimum 0, maximum 10000000). 1292 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 1293 * 1294 * @param positionX Overriding view X position on screen in pixels (minimum 0, maximum 10000000). 1295 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 1296 * 1297 * @param positionY Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). 1298 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 1299 * 1300 * @param dontSetVisibleSize Do not set visible view size, rely upon explicit setVisibleSize call. 1301 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 1302 * 1303 * @param screenOrientation Screen orientation override. 1304 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1305 * 1306 * @param viewport 1307 * If set, the visible area of the page will be overridden to this viewport. This viewport 1308 * change is not observed by the page, e.g. viewport-relative elements do not change positions. 1309 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 1310 * 1311 * @param displayFeature 1312 * If set, the display feature of a multi-segment screen. If not set, multi-segment support 1313 * is turned-off. 1314 * Deprecated, use Emulation.setDisplayFeaturesOverride. 1315 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B><B CLASS=Dep-Top>DEPRECATED</B> 1316 * 1317 * @param devicePosture 1318 * If set, the posture of a foldable device. If not set the posture is set 1319 * to continuous. 1320 * Deprecated, use Emulation.setDevicePostureOverride. 1321 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B><B CLASS=Dep-Top>DEPRECATED</B> 1322 * 1323 * @return An instance of <CODE>{@link Script}<Void></CODE> 1324 * 1325 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1326 * browser receives the invocation-request. 1327 * 1328 * <BR /><BR /><DIV CLASS=JDHint> 1329 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1330 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1331 * the Browser Function has run to completion. 1332 * </DIV> 1333 */ 1334 public static Script<Void> setDeviceMetricsOverride( 1335 int width, int height, Number deviceScaleFactor, boolean mobile, Number scale, 1336 Integer screenWidth, Integer screenHeight, Integer positionX, Integer positionY, 1337 Boolean dontSetVisibleSize, ScreenOrientation screenOrientation, 1338 Page.Viewport viewport, DisplayFeature displayFeature, DevicePosture devicePosture 1339 ) 1340 { 1341 // Convert all Method Parameters into a JSON Request-Object (as a String) 1342 final String requestJSON = WriteJSON.get( 1343 Emulation$$Commands.setDeviceMetricsOverride$$, "Emulation.setDeviceMetricsOverride", 1344 width, height, deviceScaleFactor, mobile, scale, screenWidth, screenHeight, positionX, 1345 positionY, dontSetVisibleSize, screenOrientation, viewport, displayFeature, 1346 devicePosture 1347 ); 1348 1349 return Script.NO_RET(Domains.Emulation, "setDeviceMetricsOverride", requestJSON); 1350 } 1351 1352 /** 1353 * Start reporting the given posture value to the Device Posture API. 1354 * This override can also be set in setDeviceMetricsOverride(). 1355 * 1356 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1357 * 1358 * @param posture - 1359 * 1360 * @return An instance of <CODE>{@link Script}<Void></CODE> 1361 * 1362 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1363 * browser receives the invocation-request. 1364 * 1365 * <BR /><BR /><DIV CLASS=JDHint> 1366 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1367 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1368 * the Browser Function has run to completion. 1369 * </DIV> 1370 */ 1371 public static Script<Void> setDevicePostureOverride(DevicePosture posture) 1372 { 1373 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1374 final String requestJSON = WriteJSON.get 1375 (CDPTypes.CDP_TYPE, "posture", false, "Emulation.setDevicePostureOverride", posture); 1376 1377 return Script.NO_RET(Domains.Emulation, "setDevicePostureOverride", requestJSON); 1378 } 1379 1380 /** 1381 * <CODE>[No Description Provided by Google]</CODE> 1382 * 1383 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1384 * 1385 * @param imageTypes Image types to disable. 1386 * 1387 * @return An instance of <CODE>{@link Script}<Void></CODE> 1388 * 1389 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1390 * browser receives the invocation-request. 1391 * 1392 * <BR /><BR /><DIV CLASS=JDHint> 1393 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1394 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1395 * the Browser Function has run to completion. 1396 * </DIV> 1397 */ 1398 public static Script<Void> setDisabledImageTypes(String[] imageTypes) 1399 { 1400 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1401 final String requestJSON = WriteJSON.get( 1402 CDPTypes.STRING_ARRAY_1D, "imageTypes", false, "Emulation.setDisabledImageTypes", 1403 (Object) imageTypes 1404 ); 1405 1406 return Script.NO_RET(Domains.Emulation, "setDisabledImageTypes", requestJSON); 1407 } 1408 1409 /** 1410 * Start using the given display features to pupulate the Viewport Segments API. 1411 * This override can also be set in setDeviceMetricsOverride(). 1412 * 1413 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1414 * 1415 * @param features - 1416 * 1417 * @return An instance of <CODE>{@link Script}<Void></CODE> 1418 * 1419 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1420 * browser receives the invocation-request. 1421 * 1422 * <BR /><BR /><DIV CLASS=JDHint> 1423 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1424 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1425 * the Browser Function has run to completion. 1426 * </DIV> 1427 */ 1428 public static Script<Void> setDisplayFeaturesOverride(DisplayFeature[] features) 1429 { 1430 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1431 final String requestJSON = WriteJSON.get( 1432 CDPTypes.CDP_TYPE_ARRAY_1D, "features", false, 1433 "Emulation.setDisplayFeaturesOverride", (Object) features 1434 ); 1435 1436 return Script.NO_RET(Domains.Emulation, "setDisplayFeaturesOverride", requestJSON); 1437 } 1438 1439 /** 1440 * <CODE>[No Description Provided by Google]</CODE> 1441 * 1442 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1443 * 1444 * @param disabled Whether document.coookie API should be disabled. 1445 * 1446 * @return An instance of <CODE>{@link Script}<Void></CODE> 1447 * 1448 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1449 * browser receives the invocation-request. 1450 * 1451 * <BR /><BR /><DIV CLASS=JDHint> 1452 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1453 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1454 * the Browser Function has run to completion. 1455 * </DIV> 1456 */ 1457 public static Script<Void> setDocumentCookieDisabled(boolean disabled) 1458 { 1459 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1460 final String requestJSON = WriteJSON.get( 1461 CDPTypes.PRIMITIVE_BOOLEAN, "disabled", false, 1462 "Emulation.setDocumentCookieDisabled", disabled 1463 ); 1464 1465 return Script.NO_RET(Domains.Emulation, "setDocumentCookieDisabled", requestJSON); 1466 } 1467 1468 /** 1469 * <CODE>[No Description Provided by Google]</CODE> 1470 * 1471 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1472 * 1473 * @param enabled Whether touch emulation based on mouse input should be enabled. 1474 * 1475 * @param configuration Touch/gesture events configuration. Default: current platform. 1476 * <BR />Acceptable Values: ["desktop", "mobile"] 1477 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1478 * 1479 * @return An instance of <CODE>{@link Script}<Void></CODE> 1480 * 1481 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1482 * browser receives the invocation-request. 1483 * 1484 * <BR /><BR /><DIV CLASS=JDHint> 1485 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1486 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1487 * the Browser Function has run to completion. 1488 * </DIV> 1489 */ 1490 public static Script<Void> setEmitTouchEventsForMouse(boolean enabled, String configuration) 1491 { 1492 // Convert all Method Parameters into a JSON Request-Object (as a String) 1493 final String requestJSON = WriteJSON.get( 1494 Emulation$$Commands.setEmitTouchEventsForMouse$$, 1495 "Emulation.setEmitTouchEventsForMouse", 1496 enabled, configuration 1497 ); 1498 1499 return Script.NO_RET(Domains.Emulation, "setEmitTouchEventsForMouse", requestJSON); 1500 } 1501 1502 /** 1503 * Emulates the given media type or media feature for CSS media queries. 1504 * 1505 * @param media Media type to emulate. Empty string disables the override. 1506 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1507 * 1508 * @param features Media features to emulate. 1509 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1510 * 1511 * @return An instance of <CODE>{@link Script}<Void></CODE> 1512 * 1513 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1514 * browser receives the invocation-request. 1515 * 1516 * <BR /><BR /><DIV CLASS=JDHint> 1517 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1518 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1519 * the Browser Function has run to completion. 1520 * </DIV> 1521 */ 1522 public static Script<Void> setEmulatedMedia(String media, MediaFeature[] features) 1523 { 1524 // Convert all Method Parameters into a JSON Request-Object (as a String) 1525 final String requestJSON = WriteJSON.get( 1526 Emulation$$Commands.setEmulatedMedia$$, "Emulation.setEmulatedMedia", 1527 media, features 1528 ); 1529 1530 return Script.NO_RET(Domains.Emulation, "setEmulatedMedia", requestJSON); 1531 } 1532 1533 /** 1534 * Emulates the given OS text scale. 1535 * 1536 * @param scale - 1537 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1538 * 1539 * @return An instance of <CODE>{@link Script}<Void></CODE> 1540 * 1541 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1542 * browser receives the invocation-request. 1543 * 1544 * <BR /><BR /><DIV CLASS=JDHint> 1545 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1546 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1547 * the Browser Function has run to completion. 1548 * </DIV> 1549 */ 1550 public static Script<Void> setEmulatedOSTextScale(Number scale) 1551 { 1552 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1553 final String requestJSON = WriteJSON.get 1554 (CDPTypes.NUMBER, "scale", true, "Emulation.setEmulatedOSTextScale", scale); 1555 1556 return Script.NO_RET(Domains.Emulation, "setEmulatedOSTextScale", requestJSON); 1557 } 1558 1559 /** 1560 * Emulates the given vision deficiency. 1561 * 1562 * @param type 1563 * Vision deficiency to emulate. Order: best-effort emulations come first, followed by any 1564 * physiologically accurate emulations for medically recognized color vision deficiencies. 1565 * <BR />Acceptable Values: ["achromatopsia", "blurredVision", "deuteranopia", "none", "protanopia", "reducedContrast", "tritanopia"] 1566 * 1567 * @return An instance of <CODE>{@link Script}<Void></CODE> 1568 * 1569 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1570 * browser receives the invocation-request. 1571 * 1572 * <BR /><BR /><DIV CLASS=JDHint> 1573 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1574 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1575 * the Browser Function has run to completion. 1576 * </DIV> 1577 */ 1578 public static Script<Void> setEmulatedVisionDeficiency(String type) 1579 { 1580 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1581 final String requestJSON = WriteJSON.get 1582 (CDPTypes.STRING, "type", false, "Emulation.setEmulatedVisionDeficiency", type); 1583 1584 return Script.NO_RET(Domains.Emulation, "setEmulatedVisionDeficiency", requestJSON); 1585 } 1586 1587 /** 1588 * Enables or disables simulating a focused and active page. 1589 * 1590 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1591 * 1592 * @param enabled Whether to enable to disable focus emulation. 1593 * 1594 * @return An instance of <CODE>{@link Script}<Void></CODE> 1595 * 1596 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1597 * browser receives the invocation-request. 1598 * 1599 * <BR /><BR /><DIV CLASS=JDHint> 1600 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1601 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1602 * the Browser Function has run to completion. 1603 * </DIV> 1604 */ 1605 public static Script<Void> setFocusEmulationEnabled(boolean enabled) 1606 { 1607 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1608 final String requestJSON = WriteJSON.get( 1609 CDPTypes.PRIMITIVE_BOOLEAN, "enabled", false, "Emulation.setFocusEmulationEnabled", 1610 enabled 1611 ); 1612 1613 return Script.NO_RET(Domains.Emulation, "setFocusEmulationEnabled", requestJSON); 1614 } 1615 1616 /** 1617 * Overrides the Geolocation Position or Error. Omitting latitude, longitude or 1618 * accuracy emulates position unavailable. 1619 * 1620 * <BR /><BR /><DIV CLASS=JDHint> 1621 * 👍 Because of the sheer number of input parameters to this method, there is a 1622 * a {@link CommandBuilder} variant to this method which may be invoked instead. 1623 * 1624 * <BR /><BR /> 1625 * Please View: {@link #setGeolocationOverride()} 1626 * </DIV> 1627 * 1628 * @param latitude Mock latitude 1629 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1630 * 1631 * @param longitude Mock longitude 1632 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1633 * 1634 * @param accuracy Mock accuracy 1635 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1636 * 1637 * @param altitude Mock altitude 1638 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1639 * 1640 * @param altitudeAccuracy Mock altitudeAccuracy 1641 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1642 * 1643 * @param heading Mock heading 1644 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1645 * 1646 * @param speed Mock speed 1647 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1648 * 1649 * @return An instance of <CODE>{@link Script}<Void></CODE> 1650 * 1651 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1652 * browser receives the invocation-request. 1653 * 1654 * <BR /><BR /><DIV CLASS=JDHint> 1655 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1656 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1657 * the Browser Function has run to completion. 1658 * </DIV> 1659 */ 1660 public static Script<Void> setGeolocationOverride( 1661 Number latitude, Number longitude, Number accuracy, Number altitude, 1662 Number altitudeAccuracy, Number heading, Number speed 1663 ) 1664 { 1665 // Convert all Method Parameters into a JSON Request-Object (as a String) 1666 final String requestJSON = WriteJSON.get( 1667 Emulation$$Commands.setGeolocationOverride$$, "Emulation.setGeolocationOverride", 1668 latitude, longitude, accuracy, altitude, altitudeAccuracy, heading, speed 1669 ); 1670 1671 return Script.NO_RET(Domains.Emulation, "setGeolocationOverride", requestJSON); 1672 } 1673 1674 /** 1675 * <CODE>[No Description Provided by Google]</CODE> 1676 * 1677 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1678 * 1679 * @param hardwareConcurrency Hardware concurrency to report 1680 * 1681 * @return An instance of <CODE>{@link Script}<Void></CODE> 1682 * 1683 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1684 * browser receives the invocation-request. 1685 * 1686 * <BR /><BR /><DIV CLASS=JDHint> 1687 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1688 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1689 * the Browser Function has run to completion. 1690 * </DIV> 1691 */ 1692 public static Script<Void> setHardwareConcurrencyOverride(int hardwareConcurrency) 1693 { 1694 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1695 final String requestJSON = WriteJSON.get( 1696 CDPTypes.PRIMITIVE_INT, "hardwareConcurrency", false, 1697 "Emulation.setHardwareConcurrencyOverride", hardwareConcurrency 1698 ); 1699 1700 return Script.NO_RET(Domains.Emulation, "setHardwareConcurrencyOverride", requestJSON); 1701 } 1702 1703 /** 1704 * Overrides the Idle state. 1705 * 1706 * @param isUserActive Mock isUserActive 1707 * 1708 * @param isScreenUnlocked Mock isScreenUnlocked 1709 * 1710 * @return An instance of <CODE>{@link Script}<Void></CODE> 1711 * 1712 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1713 * browser receives the invocation-request. 1714 * 1715 * <BR /><BR /><DIV CLASS=JDHint> 1716 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1717 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1718 * the Browser Function has run to completion. 1719 * </DIV> 1720 */ 1721 public static Script<Void> setIdleOverride(boolean isUserActive, boolean isScreenUnlocked) 1722 { 1723 // Convert all Method Parameters into a JSON Request-Object (as a String) 1724 final String requestJSON = WriteJSON.get( 1725 Emulation$$Commands.setIdleOverride$$, "Emulation.setIdleOverride", 1726 isUserActive, isScreenUnlocked 1727 ); 1728 1729 return Script.NO_RET(Domains.Emulation, "setIdleOverride", requestJSON); 1730 } 1731 1732 /** 1733 * Overrides default host system locale with the specified one. 1734 * 1735 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1736 * 1737 * @param locale 1738 * ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and 1739 * restores default host system locale. 1740 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1741 * 1742 * @return An instance of <CODE>{@link Script}<Void></CODE> 1743 * 1744 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1745 * browser receives the invocation-request. 1746 * 1747 * <BR /><BR /><DIV CLASS=JDHint> 1748 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1749 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1750 * the Browser Function has run to completion. 1751 * </DIV> 1752 */ 1753 public static Script<Void> setLocaleOverride(String locale) 1754 { 1755 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1756 final String requestJSON = WriteJSON.get 1757 (CDPTypes.STRING, "locale", true, "Emulation.setLocaleOverride", locale); 1758 1759 return Script.NO_RET(Domains.Emulation, "setLocaleOverride", requestJSON); 1760 } 1761 1762 /** 1763 * Overrides value returned by the javascript navigator object. 1764 * 1765 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B><B CLASS=Dep-Top>DEPRECATED</B> 1766 * 1767 * @param platform The platform navigator.platform should return. 1768 * 1769 * @return An instance of <CODE>{@link Script}<Void></CODE> 1770 * 1771 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1772 * browser receives the invocation-request. 1773 * 1774 * <BR /><BR /><DIV CLASS=JDHint> 1775 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1776 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1777 * the Browser Function has run to completion. 1778 * </DIV> 1779 */ 1780 public static Script<Void> setNavigatorOverrides(String platform) 1781 { 1782 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1783 final String requestJSON = WriteJSON.get 1784 (CDPTypes.STRING, "platform", false, "Emulation.setNavigatorOverrides", platform); 1785 1786 return Script.NO_RET(Domains.Emulation, "setNavigatorOverrides", requestJSON); 1787 } 1788 1789 /** 1790 * Sets a specified page scale factor. 1791 * 1792 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1793 * 1794 * @param pageScaleFactor Page scale factor. 1795 * 1796 * @return An instance of <CODE>{@link Script}<Void></CODE> 1797 * 1798 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1799 * browser receives the invocation-request. 1800 * 1801 * <BR /><BR /><DIV CLASS=JDHint> 1802 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1803 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1804 * the Browser Function has run to completion. 1805 * </DIV> 1806 */ 1807 public static Script<Void> setPageScaleFactor(Number pageScaleFactor) 1808 { 1809 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1810 final String requestJSON = WriteJSON.get( 1811 CDPTypes.NUMBER, "pageScaleFactor", false, "Emulation.setPageScaleFactor", 1812 pageScaleFactor 1813 ); 1814 1815 return Script.NO_RET(Domains.Emulation, "setPageScaleFactor", requestJSON); 1816 } 1817 1818 /** 1819 * Provides a given pressure data set that will be processed and eventually be 1820 * delivered to PressureObserver users. |source| must have been previously 1821 * overridden by setPressureSourceOverrideEnabled. 1822 * 1823 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1824 * 1825 * @param source - 1826 * 1827 * @param state - 1828 * 1829 * @param ownContributionEstimate - 1830 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1831 * 1832 * @return An instance of <CODE>{@link Script}<Void></CODE> 1833 * 1834 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1835 * browser receives the invocation-request. 1836 * 1837 * <BR /><BR /><DIV CLASS=JDHint> 1838 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1839 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1840 * the Browser Function has run to completion. 1841 * </DIV> 1842 */ 1843 public static Script<Void> setPressureDataOverride 1844 (String source, String state, Number ownContributionEstimate) 1845 { 1846 // Convert all Method Parameters into a JSON Request-Object (as a String) 1847 final String requestJSON = WriteJSON.get( 1848 Emulation$$Commands.setPressureDataOverride$$, "Emulation.setPressureDataOverride", 1849 source, state, ownContributionEstimate 1850 ); 1851 1852 return Script.NO_RET(Domains.Emulation, "setPressureDataOverride", requestJSON); 1853 } 1854 1855 /** 1856 * Overrides a pressure source of a given type, as used by the Compute 1857 * Pressure API, so that updates to PressureObserver.observe() are provided 1858 * via setPressureStateOverride instead of being retrieved from 1859 * platform-provided telemetry data. 1860 * 1861 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1862 * 1863 * @param enabled - 1864 * 1865 * @param source - 1866 * 1867 * @param metadata - 1868 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 1869 * 1870 * @return An instance of <CODE>{@link Script}<Void></CODE> 1871 * 1872 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1873 * browser receives the invocation-request. 1874 * 1875 * <BR /><BR /><DIV CLASS=JDHint> 1876 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1877 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1878 * the Browser Function has run to completion. 1879 * </DIV> 1880 */ 1881 public static Script<Void> setPressureSourceOverrideEnabled 1882 (boolean enabled, String source, PressureMetadata metadata) 1883 { 1884 // Convert all Method Parameters into a JSON Request-Object (as a String) 1885 final String requestJSON = WriteJSON.get( 1886 Emulation$$Commands.setPressureSourceOverrideEnabled$$, 1887 "Emulation.setPressureSourceOverrideEnabled", 1888 enabled, source, metadata 1889 ); 1890 1891 return Script.NO_RET(Domains.Emulation, "setPressureSourceOverrideEnabled", requestJSON); 1892 } 1893 1894 /** 1895 * TODO: OBSOLETE: To remove when setPressureDataOverride is merged. 1896 * Provides a given pressure state that will be processed and eventually be 1897 * delivered to PressureObserver users. |source| must have been previously 1898 * overridden by setPressureSourceOverrideEnabled. 1899 * 1900 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1901 * 1902 * @param source - 1903 * 1904 * @param state - 1905 * 1906 * @return An instance of <CODE>{@link Script}<Void></CODE> 1907 * 1908 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1909 * browser receives the invocation-request. 1910 * 1911 * <BR /><BR /><DIV CLASS=JDHint> 1912 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1913 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1914 * the Browser Function has run to completion. 1915 * </DIV> 1916 */ 1917 public static Script<Void> setPressureStateOverride(String source, String state) 1918 { 1919 // Convert all Method Parameters into a JSON Request-Object (as a String) 1920 final String requestJSON = WriteJSON.get( 1921 Emulation$$Commands.setPressureStateOverride$$, "Emulation.setPressureStateOverride", 1922 source, state 1923 ); 1924 1925 return Script.NO_RET(Domains.Emulation, "setPressureStateOverride", requestJSON); 1926 } 1927 1928 /** 1929 * Overrides the values for env(safe-area-inset-*) and env(safe-area-max-inset-*). Unset values will cause the 1930 * respective variables to be undefined, even if previously overridden. 1931 * 1932 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1933 * 1934 * @param insets - 1935 * 1936 * @return An instance of <CODE>{@link Script}<Void></CODE> 1937 * 1938 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1939 * browser receives the invocation-request. 1940 * 1941 * <BR /><BR /><DIV CLASS=JDHint> 1942 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1943 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1944 * the Browser Function has run to completion. 1945 * </DIV> 1946 */ 1947 public static Script<Void> setSafeAreaInsetsOverride(SafeAreaInsets insets) 1948 { 1949 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1950 final String requestJSON = WriteJSON.get 1951 (CDPTypes.CDP_TYPE, "insets", false, "Emulation.setSafeAreaInsetsOverride", insets); 1952 1953 return Script.NO_RET(Domains.Emulation, "setSafeAreaInsetsOverride", requestJSON); 1954 } 1955 1956 /** 1957 * Switches script execution in the page. 1958 * 1959 * @param value Whether script execution should be disabled in the page. 1960 * 1961 * @return An instance of <CODE>{@link Script}<Void></CODE> 1962 * 1963 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1964 * browser receives the invocation-request. 1965 * 1966 * <BR /><BR /><DIV CLASS=JDHint> 1967 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1968 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1969 * the Browser Function has run to completion. 1970 * </DIV> 1971 */ 1972 public static Script<Void> setScriptExecutionDisabled(boolean value) 1973 { 1974 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 1975 final String requestJSON = WriteJSON.get( 1976 CDPTypes.PRIMITIVE_BOOLEAN, "value", false, "Emulation.setScriptExecutionDisabled", 1977 value 1978 ); 1979 1980 return Script.NO_RET(Domains.Emulation, "setScriptExecutionDisabled", requestJSON); 1981 } 1982 1983 /** 1984 * <CODE>[No Description Provided by Google]</CODE> 1985 * 1986 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 1987 * 1988 * @param hidden Whether scrollbars should be always hidden. 1989 * 1990 * @return An instance of <CODE>{@link Script}<Void></CODE> 1991 * 1992 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1993 * browser receives the invocation-request. 1994 * 1995 * <BR /><BR /><DIV CLASS=JDHint> 1996 * This Browser-Function <I>does not have</I> a return-value. You may choose to 1997 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 1998 * the Browser Function has run to completion. 1999 * </DIV> 2000 */ 2001 public static Script<Void> setScrollbarsHidden(boolean hidden) 2002 { 2003 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 2004 final String requestJSON = WriteJSON.get( 2005 CDPTypes.PRIMITIVE_BOOLEAN, "hidden", false, "Emulation.setScrollbarsHidden", hidden 2006 ); 2007 2008 return Script.NO_RET(Domains.Emulation, "setScrollbarsHidden", requestJSON); 2009 } 2010 2011 /** 2012 * Overrides a platform sensor of a given type. If |enabled| is true, calls to 2013 * Sensor.start() will use a virtual sensor as backend rather than fetching 2014 * data from a real hardware sensor. Otherwise, existing virtual 2015 * sensor-backend Sensor objects will fire an error event and new calls to 2016 * Sensor.start() will attempt to use a real sensor instead. 2017 * 2018 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2019 * 2020 * @param enabled - 2021 * 2022 * @param type - 2023 * 2024 * @param metadata - 2025 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2026 * 2027 * @return An instance of <CODE>{@link Script}<Void></CODE> 2028 * 2029 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2030 * browser receives the invocation-request. 2031 * 2032 * <BR /><BR /><DIV CLASS=JDHint> 2033 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2034 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2035 * the Browser Function has run to completion. 2036 * </DIV> 2037 */ 2038 public static Script<Void> setSensorOverrideEnabled 2039 (boolean enabled, String type, SensorMetadata metadata) 2040 { 2041 // Convert all Method Parameters into a JSON Request-Object (as a String) 2042 final String requestJSON = WriteJSON.get( 2043 Emulation$$Commands.setSensorOverrideEnabled$$, "Emulation.setSensorOverrideEnabled", 2044 enabled, type, metadata 2045 ); 2046 2047 return Script.NO_RET(Domains.Emulation, "setSensorOverrideEnabled", requestJSON); 2048 } 2049 2050 /** 2051 * Updates the sensor readings reported by a sensor type previously overridden 2052 * by setSensorOverrideEnabled. 2053 * 2054 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2055 * 2056 * @param type - 2057 * 2058 * @param reading - 2059 * 2060 * @return An instance of <CODE>{@link Script}<Void></CODE> 2061 * 2062 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2063 * browser receives the invocation-request. 2064 * 2065 * <BR /><BR /><DIV CLASS=JDHint> 2066 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2067 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2068 * the Browser Function has run to completion. 2069 * </DIV> 2070 */ 2071 public static Script<Void> setSensorOverrideReadings(String type, SensorReading reading) 2072 { 2073 // Convert all Method Parameters into a JSON Request-Object (as a String) 2074 final String requestJSON = WriteJSON.get( 2075 Emulation$$Commands.setSensorOverrideReadings$$, "Emulation.setSensorOverrideReadings", 2076 type, reading 2077 ); 2078 2079 return Script.NO_RET(Domains.Emulation, "setSensorOverrideReadings", requestJSON); 2080 } 2081 2082 /** 2083 * Allows overriding the difference between the small and large viewport sizes, which determine the 2084 * value of the <CODE>svh</CODE> and <CODE>lvh</CODE> unit, respectively. Only supported for top-level frames. 2085 * 2086 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2087 * 2088 * @param difference 2089 * This will cause an element of size 100svh to be <CODE>difference</CODE> pixels smaller than an element 2090 * of size 100lvh. 2091 * 2092 * @return An instance of <CODE>{@link Script}<Void></CODE> 2093 * 2094 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2095 * browser receives the invocation-request. 2096 * 2097 * <BR /><BR /><DIV CLASS=JDHint> 2098 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2099 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2100 * the Browser Function has run to completion. 2101 * </DIV> 2102 */ 2103 public static Script<Void> setSmallViewportHeightDifferenceOverride(int difference) 2104 { 2105 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 2106 final String requestJSON = WriteJSON.get( 2107 CDPTypes.PRIMITIVE_INT, "difference", false, 2108 "Emulation.setSmallViewportHeightDifferenceOverride", difference 2109 ); 2110 2111 return Script.NO_RET(Domains.Emulation, "setSmallViewportHeightDifferenceOverride", requestJSON); 2112 } 2113 2114 /** 2115 * Overrides default host system timezone with the specified one. 2116 * 2117 * @param timezoneId 2118 * The timezone identifier. List of supported timezones: 2119 * https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt 2120 * If empty, disables the override and restores default host system timezone. 2121 * 2122 * @return An instance of <CODE>{@link Script}<Void></CODE> 2123 * 2124 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2125 * browser receives the invocation-request. 2126 * 2127 * <BR /><BR /><DIV CLASS=JDHint> 2128 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2129 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2130 * the Browser Function has run to completion. 2131 * </DIV> 2132 */ 2133 public static Script<Void> setTimezoneOverride(String timezoneId) 2134 { 2135 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 2136 final String requestJSON = WriteJSON.get 2137 (CDPTypes.STRING, "timezoneId", false, "Emulation.setTimezoneOverride", timezoneId); 2138 2139 return Script.NO_RET(Domains.Emulation, "setTimezoneOverride", requestJSON); 2140 } 2141 2142 /** 2143 * Enables touch on platforms which do not support them. 2144 * 2145 * @param enabled Whether the touch event emulation should be enabled. 2146 * 2147 * @param maxTouchPoints Maximum touch points supported. Defaults to one. 2148 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2149 * 2150 * @return An instance of <CODE>{@link Script}<Void></CODE> 2151 * 2152 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2153 * browser receives the invocation-request. 2154 * 2155 * <BR /><BR /><DIV CLASS=JDHint> 2156 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2157 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2158 * the Browser Function has run to completion. 2159 * </DIV> 2160 */ 2161 public static Script<Void> setTouchEmulationEnabled(boolean enabled, Integer maxTouchPoints) 2162 { 2163 // Convert all Method Parameters into a JSON Request-Object (as a String) 2164 final String requestJSON = WriteJSON.get( 2165 Emulation$$Commands.setTouchEmulationEnabled$$, "Emulation.setTouchEmulationEnabled", 2166 enabled, maxTouchPoints 2167 ); 2168 2169 return Script.NO_RET(Domains.Emulation, "setTouchEmulationEnabled", requestJSON); 2170 } 2171 2172 /** 2173 * Allows overriding user agent with the given string. 2174 * <CODE>userAgentMetadata</CODE> must be set for Client Hint headers to be sent. 2175 * 2176 * @param userAgent User agent to use. 2177 * 2178 * @param acceptLanguage Browser language to emulate. 2179 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2180 * 2181 * @param platform The platform navigator.platform should return. 2182 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2183 * 2184 * @param userAgentMetadata To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData 2185 * <BR /><B CLASS=Opt-Top>OPTIONAL</B><B CLASS=Exp-Top>EXPERIMENTAL</B> 2186 * 2187 * @return An instance of <CODE>{@link Script}<Void></CODE> 2188 * 2189 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2190 * browser receives the invocation-request. 2191 * 2192 * <BR /><BR /><DIV CLASS=JDHint> 2193 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2194 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2195 * the Browser Function has run to completion. 2196 * </DIV> 2197 */ 2198 public static Script<Void> setUserAgentOverride( 2199 String userAgent, String acceptLanguage, String platform, 2200 UserAgentMetadata userAgentMetadata 2201 ) 2202 { 2203 // Convert all Method Parameters into a JSON Request-Object (as a String) 2204 final String requestJSON = WriteJSON.get( 2205 Emulation$$Commands.setUserAgentOverride$$, "Emulation.setUserAgentOverride", 2206 userAgent, acceptLanguage, platform, userAgentMetadata 2207 ); 2208 2209 return Script.NO_RET(Domains.Emulation, "setUserAgentOverride", requestJSON); 2210 } 2211 2212 /** 2213 * Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets 2214 * the current virtual time policy. Note this supersedes any previous time budget. 2215 * 2216 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 2217 * 2218 * @param policy - 2219 * 2220 * @param budget 2221 * If set, after this many virtual milliseconds have elapsed virtual time will be paused and a 2222 * virtualTimeBudgetExpired event is sent. 2223 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2224 * 2225 * @param maxVirtualTimeTaskStarvationCount 2226 * If set this specifies the maximum number of tasks that can be run before virtual is forced 2227 * forwards to prevent deadlock. 2228 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2229 * 2230 * @param initialVirtualTime If set, base::Time::Now will be overridden to initially return this value. 2231 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 2232 * 2233 * @return An instance of <CODE>{@link Script}<Number></CODE> 2234 * 2235 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 2236 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 2237 * <CODE><Number></CODE> will be returned 2238 * 2239 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 2240 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 2241 * be retrieved.</I> 2242 * 2243 * <BR /><BR /><DIV CLASS=JDHint> 2244 * This Browser Function's {@code Promise} returns: 2245 * <CODE>Number (<B>virtualTimeTicksBase</B>)</CODE> 2246 * <BR /> 2247 * Absolute timestamp at which virtual time was first enabled (up time in milliseconds). 2248 * </DIV> 2249 */ 2250 public static Script<Number> setVirtualTimePolicy( 2251 String policy, Number budget, Integer maxVirtualTimeTaskStarvationCount, 2252 Number initialVirtualTime 2253 ) 2254 { 2255 // Convert all Method Parameters into a JSON Request-Object (as a String) 2256 final String requestJSON = WriteJSON.get( 2257 Emulation$$Commands.setVirtualTimePolicy$$, "Emulation.setVirtualTimePolicy", 2258 policy, budget, maxVirtualTimeTaskStarvationCount, initialVirtualTime 2259 ); 2260 2261 return new Script<>( 2262 Domains.Emulation, "setVirtualTimePolicy", requestJSON, 2263 jo -> ReadNumberJSON.get(jo, "virtualTimeTicksBase", true, false), 2264 Number.class 2265 ); 2266 } 2267 2268 /** 2269 * Resizes the frame/viewport of the page. Note that this does not affect the frame's container 2270 * (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported 2271 * on Android. 2272 * 2273 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B><B CLASS=Dep-Top>DEPRECATED</B> 2274 * 2275 * @param width Frame width (DIP). 2276 * 2277 * @param height Frame height (DIP). 2278 * 2279 * @return An instance of <CODE>{@link Script}<Void></CODE> 2280 * 2281 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2282 * browser receives the invocation-request. 2283 * 2284 * <BR /><BR /><DIV CLASS=JDHint> 2285 * This Browser-Function <I>does not have</I> a return-value. You may choose to 2286 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 2287 * the Browser Function has run to completion. 2288 * </DIV> 2289 */ 2290 public static Script<Void> setVisibleSize(int width, int height) 2291 { 2292 // Convert all Method Parameters into a JSON Request-Object (as a String) 2293 final String requestJSON = WriteJSON.get( 2294 Emulation$$Commands.setVisibleSize$$, "Emulation.setVisibleSize", 2295 width, height 2296 ); 2297 2298 return Script.NO_RET(Domains.Emulation, "setVisibleSize", requestJSON); 2299 } 2300 2301 2302 // ******************************************************************************************** 2303 // ******************************************************************************************** 2304 // CommandBuilder Getter-Methods 2305 // ******************************************************************************************** 2306 // ******************************************************************************************** 2307 2308 2309 /** 2310 * Creates a buider for conveniently assigning parameters to this method. 2311 * 2312 * <BR /><BR /><DIV CLASS=JDHint> 2313 * Note that the original method expects 14 parameters, and can be cumbersome. 2314 * </DIV> 2315 * 2316 * @return {@link CommandBuilder} instance, for assigning parameter values, one by one. 2317 * @see #setDeviceMetricsOverride 2318 */ 2319 public static CommandBuilder<Void> setDeviceMetricsOverride() 2320 { return CommandBuilder.builder(Emulation$$Commands.setDeviceMetricsOverride$$); } 2321 2322 /** 2323 * Creates a buider for conveniently assigning parameters to this method. 2324 * 2325 * <BR /><BR /><DIV CLASS=JDHint> 2326 * Note that the original method expects 7 parameters, and can be cumbersome. 2327 * </DIV> 2328 * 2329 * @return {@link CommandBuilder} instance, for assigning parameter values, one by one. 2330 * @see #setGeolocationOverride 2331 */ 2332 public static CommandBuilder<Void> setGeolocationOverride() 2333 { return CommandBuilder.builder(Emulation$$Commands.setGeolocationOverride$$); } 2334 2335 2336}