Example usage for org.openqa.selenium.remote.session W3CPlatformNameNormaliser W3CPlatformNameNormaliser

List of usage examples for org.openqa.selenium.remote.session W3CPlatformNameNormaliser W3CPlatformNameNormaliser

Introduction

In this page you can find the example usage for org.openqa.selenium.remote.session W3CPlatformNameNormaliser W3CPlatformNameNormaliser.

Prototype

W3CPlatformNameNormaliser

Source Link

Usage

From source file:io.appium.java_client.remote.NewAppiumSessionPayload.java

License:Apache License

private NewAppiumSessionPayload(Reader source, boolean forceMobileJSONWP) throws IOException {
    this.forceMobileJSONWP = forceMobileJSONWP;
    // Dedicate up to 10% of all RAM or 20% of available RAM (whichever is smaller) to storing this
    // payload.//from w  ww  .ja v a2  s . co m
    int threshold = (int) Math.min(Integer.MAX_VALUE,
            Math.min(Runtime.getRuntime().freeMemory() / 5, Runtime.getRuntime().maxMemory() / 10));

    backingStore = new FileBackedOutputStream(threshold);
    try (Writer writer = new OutputStreamWriter(backingStore, UTF_8)) {
        CharStreams.copy(source, writer);
    }

    ImmutableSet.Builder<CapabilitiesFilter> adapters = ImmutableSet.builder();
    ServiceLoader.load(CapabilitiesFilter.class).forEach(adapters::add);
    adapters.add(new ChromeFilter()).add(new EdgeFilter()).add(new FirefoxFilter())
            .add(new InternetExplorerFilter()).add(new OperaFilter()).add(new SafariFilter());
    this.adapters = adapters.build();

    ImmutableSet.Builder<CapabilityTransform> transforms = ImmutableSet.builder();
    ServiceLoader.load(CapabilityTransform.class).forEach(transforms::add);
    transforms.add(new ProxyTransform()).add(new StripAnyPlatform()).add(new W3CPlatformNameNormaliser());
    this.transforms = transforms.build();

    ImmutableSet.Builder<Dialect> dialects = ImmutableSet.builder();
    if (getOss() != null) {
        dialects.add(Dialect.OSS);
    }
    if (getAlwaysMatch() != null || getFirstMatch() != null) {
        dialects.add(Dialect.W3C);
    }

    validate();
}