|
26 | 26 | import com.google.common.io.CharSource; |
27 | 27 | import com.google.common.io.CharStreams; |
28 | 28 | import com.google.common.io.FileBackedOutputStream; |
| 29 | + |
| 30 | +import org.openqa.selenium.AcceptedW3CCapabilityKeys; |
29 | 31 | import org.openqa.selenium.Capabilities; |
30 | 32 | import org.openqa.selenium.ImmutableCapabilities; |
31 | 33 | import org.openqa.selenium.internal.Require; |
@@ -61,21 +63,6 @@ public class NewSessionPayload implements Closeable { |
61 | 63 | private final FileBackedOutputStream backingStore; |
62 | 64 | private final ImmutableSet<Dialect> dialects; |
63 | 65 |
|
64 | | - public static NewSessionPayload create(Capabilities caps) { |
65 | | - // We need to convert the capabilities into a new session payload. At this point we're dealing |
66 | | - // with references, so I'm Just Sure This Will Be Fine. |
67 | | - return create(ImmutableMap.of("desiredCapabilities", caps.asMap())); |
68 | | - } |
69 | | - |
70 | | - public static NewSessionPayload create(Map<String, ?> source) { |
71 | | - String json = new Json().toJson(Require.nonNull("Payload", source)); |
72 | | - return new NewSessionPayload(new StringReader(json)); |
73 | | - } |
74 | | - |
75 | | - public static NewSessionPayload create(Reader source) { |
76 | | - return new NewSessionPayload(source); |
77 | | - } |
78 | | - |
79 | 66 | private NewSessionPayload(Reader source) { |
80 | 67 | // Dedicate up to 10% of all RAM or 20% of available RAM (whichever is smaller) to storing this |
81 | 68 | // payload. |
@@ -116,6 +103,21 @@ private NewSessionPayload(Reader source) { |
116 | 103 |
|
117 | 104 | } |
118 | 105 |
|
| 106 | + public static NewSessionPayload create(Capabilities caps) { |
| 107 | + // We need to convert the capabilities into a new session payload. At this point we're dealing |
| 108 | + // with references, so I'm Just Sure This Will Be Fine. |
| 109 | + return create(ImmutableMap.of("desiredCapabilities", caps.asMap())); |
| 110 | + } |
| 111 | + |
| 112 | + public static NewSessionPayload create(Map<String, ?> source) { |
| 113 | + String json = new Json().toJson(Require.nonNull("Payload", source)); |
| 114 | + return new NewSessionPayload(new StringReader(json)); |
| 115 | + } |
| 116 | + |
| 117 | + public static NewSessionPayload create(Reader source) { |
| 118 | + return new NewSessionPayload(source); |
| 119 | + } |
| 120 | + |
119 | 121 | private void validate() throws IOException { |
120 | 122 | Map<String, Object> alwaysMatch = getAlwaysMatch(); |
121 | 123 | if (alwaysMatch == null) { |
|
0 commit comments