Improved browser tests.

This commit is contained in:
Martin Edenhofer 2013-06-10 22:19:11 +02:00
parent 8f668db965
commit 34681a15d7
4 changed files with 11 additions and 11 deletions

View file

@ -252,10 +252,6 @@ class _Singleton extends App.Controller
# reopen tasks # reopen tasks
App.Event.trigger 'taskbar:init' App.Event.trigger 'taskbar:init'
# App.Taskbar.fetch()
tasks = @all()
return if !tasks
# check if we have different # check if we have different
# broadcast to other browser instance # broadcast to other browser instance
@ -269,6 +265,10 @@ class _Singleton extends App.Controller
client_id: @clientId() client_id: @clientId()
) )
# App.Taskbar.fetch()
tasks = @all()
return if !tasks
task_count = 0 task_count = 0
for task in tasks for task in tasks
task_count += 1 task_count += 1

View file

@ -77,7 +77,7 @@ class _Singleton extends App.Controller
# A value of 1 indicates that the connection is established and communication is possible. # A value of 1 indicates that the connection is established and communication is possible.
# A value of 2 indicates that the connection is going through the closing handshake. # A value of 2 indicates that the connection is going through the closing handshake.
# A value of 3 indicates that the connection has been closed or could not be opened. # A value of 3 indicates that the connection has been closed or could not be opened.
if @ws.readyState is 0 if @ws.readyState isnt 1
@queue.push data @queue.push data
else else
string = JSON.stringify( data ) string = JSON.stringify( data )

View file

@ -67,8 +67,8 @@ class LongPollingController < ApplicationController
if local_client_id.to_s != client_id.to_s if local_client_id.to_s != client_id.to_s
# broadcast to recipient list # broadcast to recipient list
if params['data']['recipient'] && params['data']['recipient']['user_id'] if params['data']['data']['recipient'] && params['data']['data']['recipient']['user_id']
params['data']['recipient']['user_id'].each { |user_id| params['data']['data']['recipient']['user_id'].each { |user_id|
if local_client[:user][:id] == user_id if local_client[:user][:id] == user_id
log 'notice', "send broadcast (user_id #{user_id})", local_client_id log 'notice', "send broadcast (user_id #{user_id})", local_client_id
Session.send( local_client_id, params['data'] ) Session.send( local_client_id, params['data'] )

View file

@ -8,9 +8,9 @@ class TaskbarSessionTest < TestCase
:name => 'start', :name => 'start',
:instance1 => browser_instance, :instance1 => browser_instance,
:instance2 => browser_instance, :instance2 => browser_instance,
:instance1_username => 'master@example.com', :instance1_username => 'agent1@example.com',
:instance1_password => 'test', :instance1_password => 'test',
:instance2_username => 'master@example.com', :instance2_username => 'agent1@example.com',
:instance2_password => 'test', :instance2_password => 'test',
:url => browser_url, :url => browser_url,
:action => [ :action => [
@ -28,7 +28,7 @@ class TaskbarSessionTest < TestCase
}, },
{ {
:execute => 'wait', :execute => 'wait',
:value => 5, :value => 10,
}, },
{ {
:where => :instance1, :where => :instance1,
@ -80,7 +80,7 @@ class TaskbarSessionTest < TestCase
}, },
{ {
:execute => 'wait', :execute => 'wait',
:value => 5, :value => 10,
}, },
{ {
:where => :instance1, :where => :instance1,