File tree Expand file tree Collapse file tree 5 files changed +13
-24
lines changed
rb/lib/selenium/webdriver Expand file tree Collapse file tree 5 files changed +13
-24
lines changed Original file line number Diff line number Diff line change @@ -54,12 +54,7 @@ def start_process
54
54
end
55
55
56
56
def stop_server
57
- Net ::HTTP . start ( @host , @port ) do |http |
58
- http . open_timeout = STOP_TIMEOUT / 2
59
- http . read_timeout = STOP_TIMEOUT / 2
60
-
61
- http . get ( "/shutdown" )
62
- end
57
+ connect_to_server { |http | http . get ( "/shutdown" ) }
63
58
end
64
59
65
60
def connect_until_stable
Original file line number Diff line number Diff line change @@ -71,6 +71,15 @@ def uri
71
71
72
72
private
73
73
74
+ def connect_to_server
75
+ Net ::HTTP . start ( @host , @port ) do |http |
76
+ http . open_timeout = STOP_TIMEOUT / 2
77
+ http . read_timeout = STOP_TIMEOUT / 2
78
+
79
+ yield http
80
+ end
81
+ end
82
+
74
83
def find_free_port
75
84
@port = PortProber . above ( @port )
76
85
end
Original file line number Diff line number Diff line change @@ -46,12 +46,7 @@ def self.default_service(*extra_args)
46
46
private
47
47
48
48
def stop_server
49
- Net ::HTTP . start ( @host , @port ) do |http |
50
- http . open_timeout = STOP_TIMEOUT / 2
51
- http . read_timeout = STOP_TIMEOUT / 2
52
-
53
- http . head ( "/shutdown" )
54
- end
49
+ connect_to_server { |http | http . head ( "/shutdown" ) }
55
50
end
56
51
57
52
def start_process
Original file line number Diff line number Diff line change @@ -68,12 +68,7 @@ def stop_process
68
68
end
69
69
70
70
def stop_server
71
- Net ::HTTP . start ( @host , @port ) do |http |
72
- http . open_timeout = STOP_TIMEOUT / 2
73
- http . read_timeout = STOP_TIMEOUT / 2
74
-
75
- http . head ( "/shutdown" )
76
- end
71
+ connect_to_server { |http | http . head ( "/shutdown" ) }
77
72
end
78
73
79
74
def connect_until_stable
Original file line number Diff line number Diff line change @@ -67,12 +67,7 @@ def stop_process
67
67
end
68
68
69
69
def stop_server
70
- Net ::HTTP . start ( @host , @port ) do |http |
71
- http . open_timeout = STOP_TIMEOUT / 2
72
- http . read_timeout = STOP_TIMEOUT / 2
73
-
74
- http . get ( "/shutdown" )
75
- end
70
+ connect_to_server { |http | http . get ( "/shutdown" ) }
76
71
end
77
72
78
73
def connect_until_stable
You can’t perform that action at this time.
0 commit comments