Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make most tests pass again

  • Loading branch information...
commit dfac491f46423a6b4d18f103463555875459c886 1 parent a6161d1
@jscheid authored
View
7 kite-console-tests.el
@@ -54,8 +54,11 @@
(defmacro with--kite-console-test-buffer (&rest body)
`(with-temp-buffer
(let (kite-session (inhibit-read-only t))
- (kite-console-mode)
- (flet ((kite--find-buffer (websocket-url type) (current-buffer)))
+ (flet ((kite--find-buffer (websocket-url type) (current-buffer))
+ (kite--console-update-mode-line ())
+ (kite--mode-line-update ())
+ (kite-send (&rest ignore)))
+ (kite-console-mode)
,@body))))
(ert-deftest kite-console-insert-message ()
View
39 kite-dom-tests.el
@@ -84,7 +84,8 @@
"A very simple HTML document is rendered correctly"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(kite--dom-insert-element simple-element 0 nil)
@@ -102,7 +103,8 @@
"A node ID is associated with each character in the buffer"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(kite--dom-insert-element simple-element 0 nil)
@@ -120,7 +122,8 @@
"A simple document with text nodes is rendered correctly"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(let ((inhibit-read-only t))
(kite--dom-insert-element
@@ -174,7 +177,8 @@
"A node whose children aren't loaded is rendered correctly"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(flet ((kite-send (command params callback)
(should (string= command "DOM.requestChildNodes"))
@@ -219,7 +223,8 @@
"Setting child nodes of a node that already has children works"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(flet ((kite-send (command params callback)
(should (string= command "DOM.requestChildNodes"))
@@ -285,7 +290,8 @@
"DOM is mutated correctly when node is inserted in front"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(let ((inhibit-read-only t))
(kite--dom-insert-element simple-element 0 nil)
@@ -321,7 +327,8 @@
"DOM is mutated correctly when node is inserted before another node"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(let ((inhibit-read-only t))
(kite--dom-insert-element simple-element 0 nil)
@@ -359,7 +366,8 @@
"DOM is mutated correctly when node is inserted after another node"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(let ((inhibit-read-only t))
(kite--dom-insert-element simple-element 0 nil)
@@ -394,7 +402,8 @@
"DOM is mutated correctly when node is removed"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(let ((inhibit-read-only t))
(kite--dom-insert-element simple-element 0 nil)
@@ -415,7 +424,8 @@
"DOM is mutated correctly when attribute is modified"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(let ((inhibit-read-only t))
(kite--dom-insert-element simple-element 0 nil)
@@ -445,7 +455,8 @@
"DOM is mutated correctly when attribute is modified"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(let ((inhibit-read-only t))
(kite--dom-insert-element simple-element 0 nil)
@@ -473,7 +484,8 @@
"DOM is mutated correctly when attribute is removed"
(with-temp-buffer
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(let ((inhibit-read-only t))
(kite--dom-insert-element simple-element 0 nil)
@@ -545,7 +557,8 @@
(with-temp-buffer
(let (kite-session)
- (kite-dom-mode)
+ (flet ((kite-send (&rest ignore)))
+ (kite-dom-mode))
(let ((inhibit-read-only t))
(kite--dom-insert-element simple-element 0 nil))
(flet ((kite-send (command params callback)
View
8 kite-tests.el
@@ -38,14 +38,16 @@
(ert-deftest kite-test-find-frame-by-id ()
"kite--frame-by-id works"
- (flet ((websocket-open (&rest ignore)
- nil)
+ (flet ((websocket-open (&rest ignore))
+ (kite--console-update-mode-line ())
+ (websocket-url (&rest ignore))
(kite-send (method params callback)
(when (string= method "Page.getResourceTree")
(funcall callback
'(:id 7 :result (:frameTree (:childFrames [(:resources [] :frame (:securityOrigin null :name "" :parentId "12583.1" :mimeType "text/html" :url "file:///Users/julians/src/kite/misc/page1.html" :loaderId "12583.4" :id "12583.2"))] :resources [] :frame (:securityOrigin null :mimeType "text/html" :url "file:///Users/julians/src/kite/misc/twoframes.html" :loaderId "12583.3" :id "12583.1"))))))))
- (kite--connect-webservice nil))
+ (kite--connect-webservice (list :webSocketDebuggerUrl "dummy"))
+ )
(should (kite--equal-wildcard
(kite--frame-by-id "12583.1")
View
6 kite.el
@@ -249,6 +249,9 @@ HTTP: :webSocketDebuggerUrl, :faviconUrl, :thumbnailUrl, :url,
and :title."
(let ((websocket-url (plist-get tab-alist :webSocketDebuggerUrl)))
+ (when (null websocket-url)
+ (error "Internal error, null websocket-url"))
+
(kite--log "Connecting to %s" websocket-url)
(set (make-local-variable 'kite-session)
@@ -541,7 +544,8 @@ Otherwise, create a new session using default host and port."
(websocket-url
(kite-session-websocket
(nth (- prefix 1) kite-active-session-list))))
- ((gethash kite-most-recent-session kite-active-sessions)
+ ((and (not (null kite-most-recent-session))
+ (gethash kite-most-recent-session kite-active-sessions))
kite-most-recent-session)
((> 0 (hash-table-count kite-active-sessions))
(let (random-session)
Please sign in to comment.
Something went wrong with that request. Please try again.