                 change.initEvent('change', false, true)
                 textarea.dispatchEvent(change)
 
-        client.on 'addEventListener', (params) ->
-            eventFirers[params.type]()
+        client.on 'AddEventListener', (args) ->
+            [targetID, type] = args
+            eventFirers[type]()
 
 # This test is similar to the one above, except that we make sure the
 # listeners are registered before the client is sent its snapshot. We do
 # this by putting the script inline at the bottom of the body.  When the
 # client fires 'loadFromSnapshot', the listeners should be installed.
-'event inference via snapshot' : (test) ->
-    browser = browsers.create
-        id : 'browser5'
-        url : 'http://localhost:3001/event_inference_snapshot.html'
-    client = browser.createTestClient()
-    browser.window.testClient = client
-    test.notEqual(browser, null)
-    test.notEqual(client, null)
-    client.once 'loadFromSnapshot', () ->
+exports['event inference via snapshot'] = (test) ->
+    b = browsers.create({
+            entryPoint : 'http://localhost:3001/test/files/event_inference_snapshot.html'
+            remoteBrowsing : true
+        }, 'browser5')
+    client = b.createTestClient()
+    browser = b.browser
+    client.once 'PageLoaded', () ->
+        browser.window.testClient = client
         # NOTE: The code in the script running on the server DOM will end
         # the test once all 3 events have been received.
         browser.window.test = test

            test.equal(iframeDiv.innerHTML, 'Set from outside')
            client.disconnect()
            test.done()
###
'event inference via advice' : (test) ->
    browser = browsers.create
        id : 'browser4'
        url : 'http://localhost:3001/event_inference_advice.html'
    client = browser.createTestClient()
    browser.window.testClient = client
    test.notEqual(browser, null)
    test.notEqual(client, null)
    client.once 'loadFromSnapshot', () ->
        browser.window.test = test
        # Register 3 event listeners in the server's DOM. After the client
        # receives the signal from the server an registers on an event, we

        change = doc.createEvent('HTMLEvents')
        change.initEvent('change', false, true)
        textarea.dispatchEvent(change)
