1717
1818package org .openqa .selenium .bidi ;
1919
20+ import java .io .StringReader ;
21+ import java .util .Collections ;
22+ import java .util .HashSet ;
23+ import java .util .Map ;
24+ import java .util .Set ;
25+ import java .util .function .Consumer ;
26+ import java .util .function .Function ;
2027import org .openqa .selenium .WebDriver ;
2128import org .openqa .selenium .bidi .browsingcontext .BrowsingContextInfo ;
2229import org .openqa .selenium .bidi .browsingcontext .NavigationInfo ;
2633import org .openqa .selenium .json .Json ;
2734import org .openqa .selenium .json .JsonInput ;
2835
29- import java .io .StringReader ;
30- import java .util .Collections ;
31- import java .util .HashSet ;
32- import java .util .Map ;
33- import java .util .Set ;
34- import java .util .function .Consumer ;
35- import java .util .function .Function ;
36-
3736public class BrowsingContextInspector implements AutoCloseable {
3837
3938 private static final Json JSON = new Json ();
@@ -43,48 +42,48 @@ public class BrowsingContextInspector implements AutoCloseable {
4342 private final BiDi bidi ;
4443
4544 private final Function <Map <String , Object >, BrowsingContextInfo > browsingContextInfoMapper =
46- params -> {
47- try (
48- StringReader reader = new StringReader (JSON .toJson (params ));
49- JsonInput input = JSON .newInput (reader )) {
50- return input .read (BrowsingContextInfo .class );
51- }
52- };
45+ params -> {
46+ try (StringReader reader = new StringReader (JSON .toJson (params ));
47+ JsonInput input = JSON .newInput (reader )) {
48+ return input .read (BrowsingContextInfo .class );
49+ }
50+ };
5351
5452 private final Function <Map <String , Object >, NavigationInfo > navigationInfoMapper =
55- params -> {
56- try (
57- StringReader reader = new StringReader (JSON .toJson (params ));
58- JsonInput input = JSON .newInput (reader )) {
59- return input .read (NavigationInfo .class );
60- }
61- };
53+ params -> {
54+ try (StringReader reader = new StringReader (JSON .toJson (params ));
55+ JsonInput input = JSON .newInput (reader )) {
56+ return input .read (NavigationInfo .class );
57+ }
58+ };
6259
6360 private final Event <BrowsingContextInfo > browsingContextCreated =
64- new Event <>("browsingContext.contextCreated" , browsingContextInfoMapper );
61+ new Event <>("browsingContext.contextCreated" , browsingContextInfoMapper );
6562
6663 private final Event <BrowsingContextInfo > browsingContextDestroyed =
67- new Event <>("browsingContext.contextDestroyed" , browsingContextInfoMapper );
64+ new Event <>("browsingContext.contextDestroyed" , browsingContextInfoMapper );
6865
6966 private final Event <UserPromptClosed > userPromptClosed =
70- new Event <>("browsingContext.userPromptClosed" , params -> {
71- try (
72- StringReader reader = new StringReader (JSON .toJson (params ));
73- JsonInput input = JSON .newInput (reader )) {
74- return input .read (UserPromptClosed .class );
75- }
76- });
67+ new Event <>(
68+ "browsingContext.userPromptClosed" ,
69+ params -> {
70+ try (StringReader reader = new StringReader (JSON .toJson (params ));
71+ JsonInput input = JSON .newInput (reader )) {
72+ return input .read (UserPromptClosed .class );
73+ }
74+ });
7775
7876 private final Set <Event <NavigationInfo >> navigationEventSet = new HashSet <>();
7977
8078 private final Event <UserPromptOpened > userPromptOpened =
81- new Event <>("browsingContext.userPromptOpened" , params -> {
82- try (
83- StringReader reader = new StringReader (JSON .toJson (params ));
84- JsonInput input = JSON .newInput (reader )) {
85- return input .read (UserPromptOpened .class );
86- }
87- });
79+ new Event <>(
80+ "browsingContext.userPromptOpened" ,
81+ params -> {
82+ try (StringReader reader = new StringReader (JSON .toJson (params ));
83+ JsonInput input = JSON .newInput (reader )) {
84+ return input .read (UserPromptOpened .class );
85+ }
86+ });
8887
8988 public BrowsingContextInspector (WebDriver driver ) {
9089 this (new HashSet <>(), driver );
0 commit comments