|
15 | 15 | // specific language governing permissions and limitations
|
16 | 16 | // under the License.
|
17 | 17 |
|
18 |
| -package org.openqa.selenium.chromium; |
| 18 | +package org.openqa.selenium.devtools; |
19 | 19 |
|
20 | 20 | import org.junit.Test;
|
21 | 21 | import org.junit.experimental.categories.Category;
|
|
30 | 30 | import static org.assertj.core.api.Assertions.assertThat;
|
31 | 31 |
|
32 | 32 | @Category(UnitTests.class)
|
33 |
| -public class ChromiumDevToolsLocatorTest { |
| 33 | +public class CdpEndpointFinderTest { |
34 | 34 |
|
35 | 35 | @Test
|
36 | 36 | public void shouldReturnEmptyIfNoDebuggerAddressIsGiven() {
|
37 |
| - Optional<URI> uri = ChromiumDevToolsLocator.getReportedUri("foo:options", new ImmutableCapabilities()); |
| 37 | + Optional<URI> uri = CdpEndpointFinder |
| 38 | + .getReportedUri("foo:options", new ImmutableCapabilities()); |
38 | 39 |
|
39 | 40 | assertThat(uri).isEmpty();
|
40 | 41 | }
|
41 | 42 |
|
42 | 43 | @Test
|
43 | 44 | public void shouldReturnUriIfPresent() {
|
44 |
| - Capabilities caps = new Json().toType("{\"ms:edgeOptions\": { \"debuggerAddress\": \"localhost:55498\" }}", |
45 |
| - Capabilities.class); |
| 45 | + Capabilities caps = new Json() |
| 46 | + .toType( |
| 47 | + "{\"ms:edgeOptions\": { \"debuggerAddress\": \"localhost:55498\" }}", |
| 48 | + Capabilities.class); |
46 | 49 |
|
47 |
| - Optional<URI> uri = ChromiumDevToolsLocator.getReportedUri("ms:edgeOptions", caps); |
| 50 | + Optional<URI> uri = CdpEndpointFinder.getReportedUri("ms:edgeOptions", caps); |
48 | 51 |
|
49 | 52 | assertThat(uri.get()).isEqualTo(URI.create("http://localhost:55498"));
|
50 | 53 | }
|
51 | 54 |
|
| 55 | + @Test |
| 56 | + public void shouldReturnUriIfPresentAndIsAtTopLevel() { |
| 57 | + Capabilities caps = new Json().toType( |
| 58 | + "{\"moz:debuggerAddress\": \"localhost:93487\" }", |
| 59 | + Capabilities.class); |
| 60 | + |
| 61 | + Optional<URI> uri = CdpEndpointFinder.getReportedUri("moz:debuggerAddress", caps); |
| 62 | + |
| 63 | + assertThat(uri.get()).isEqualTo(URI.create("http://localhost:93487")); |
| 64 | + } |
52 | 65 | }
|
0 commit comments