         exitSpy = sinon.spy()
 
       it 'should kill all running processe', ->
-        l.launch ['Chrome', 'ChromeCanary'], 'localhost', 1234
+        l.launch ['Fake', 'Fake'], 'localhost', 1234
         l.kill()
 
-        expect(mockSpawn._processes.length).to.equal 2
-        expect(mockSpawn._processes[0].kill).to.have.been.called
-        expect(mockSpawn._processes[1].kill).to.have.been.called
+        browser = FakeBrowser._instances.pop()
+        expect(browser.kill).to.have.been.called
+
+        browser = FakeBrowser._instances.pop()
+        expect(browser.kill).to.have.been.called
 
 
       it 'should call callback when all processes killed', ->
-        l.launch ['Chrome', 'ChromeCanary'], 'localhost', 1234
+        l.launch ['Fake', 'Fake'], 'localhost', 1234
         l.kill exitSpy
 
         expect(exitSpy).not.to.have.been.called
-        mockSpawn._processes[0].emit 'close'
-        expect(exitSpy).not.to.have.been.called
-        mockSpawn._processes[1].emit 'close'
+
+        # finish the first browser
+        browser = FakeBrowser._instances.pop()
+        browser.kill.invokeCallback()
         expect(exitSpy).not.to.have.been.called
 
-        # rm temp dirs
-        expect(mockRimraf).to.have.been.calledTwice
-        mockRimraf._callbacks[0]()
-        mockRimraf._callbacks[1]()
+        # finish the second browser
+        browser = FakeBrowser._instances.pop()
+        browser.kill.invokeCallback()
         expect(exitSpy).to.have.been.called
-
-
-      it 'should call callback even if a process had already been killed', (done) ->
-        l.launch ['Chrome', 'ChromeCanary'], 'localhost', 1234, '/', 0, 1 # disable retry
-        mockSpawn._processes[0].emit 'close', 1
-        mockSpawn._processes[1].emit 'close', 1
-
-        l.kill done
+        # expect(browser.lastCall)
 
 
       it 'should call callback even if no browsers lanunched', (done) ->

    describe 'areAllCaptured', ->

      it 'should return true if only if all browsers captured', ->
        l.launch ['Chrome', 'ChromeCanary'], 'localhost', 1234

        expect(l.areAllCaptured()).to.equal  false



    beforeEach ->
      emitter = new events.EventEmitter()
      injector = new di.Injector [{
        'launcher:Fake': ['type', FakeBrowser]
        'launcher:Script': ['type', ScriptBrowser]
        'emitter': ['value', emitter]
        'config': ['value', {captureTimeout: 0}]
      }]
      l = new launcher.Launcher emitter, injector

    describe 'launch', ->

      it 'should inject and start all browsers', ->
        l.launch ['Fake'], 'localhost', 1234, '/root/'

        browser = FakeBrowser._instances.pop()
        expect(browser.start).to.have.been.calledWith 'http://localhost:1234/root/'
        expect(browser.id).to.equal lastGeneratedId
        expect(browser.name).to.equal 'Fake'


      it 'should allow launching a script', ->
        l.launch ['/usr/local/bin/special-browser'], 'localhost', 1234, '/'

        script = ScriptBrowser._instances.pop()
        expect(script.start).to.have.been.calledWith 'http://localhost:1234/'
        expect(script.name).to.equal '/usr/local/bin/special-browser'


      it 'should use the non default host', ->
        l.launch ['Fake'], 'whatever', 1234, '/root/'

        browser = FakeBrowser._instances.pop()
        expect(browser.start).to.have.been.calledWith 'http://whatever:1234/root/'


    describe 'kill', ->
