forked from thoughtbot/capybara-webkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gabe Berke-Williams
committed
Jul 22, 2011
1 parent
ebd3d81
commit 01665e6
Showing
4 changed files
with
81 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Wraps the TCP socket and prints data sent and received. Used for debugging | ||
# the wire protocol. You can use this by passing a :socket_class to Browser. | ||
class Capybara::Driver::Webkit | ||
class SocketDebugger | ||
def self.open(host, port) | ||
real_socket = TCPSocket.open(host, port) | ||
new(real_socket) | ||
end | ||
|
||
def initialize(socket) | ||
@socket = socket | ||
end | ||
|
||
def read(length) | ||
received @socket.read(length) | ||
end | ||
|
||
def puts(line) | ||
sent line | ||
@socket.puts(line) | ||
end | ||
|
||
def print(content) | ||
sent content | ||
@socket.print(content) | ||
end | ||
|
||
def gets | ||
received @socket.gets | ||
end | ||
|
||
private | ||
|
||
def sent(content) | ||
Kernel.puts " >> " + content.to_s | ||
end | ||
|
||
def received(content) | ||
Kernel.puts " << " + content.to_s | ||
content | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.