org.openqa.selenium.server
Class FrameGroupCommandQueueSet

java.lang.Object
  extended by org.openqa.selenium.server.FrameGroupCommandQueueSet

public class FrameGroupCommandQueueSet
extends java.lang.Object

Manages sets of CommandQueues corresponding to windows and frames in a single browser session.

Author:
nelsons

Field Summary
static java.lang.String DEFAULT_LOCAL_FRAME_ADDRESS
           
static java.lang.String DEFAULT_SELENIUM_WINDOW_NAME
          Each user-visible window group has a selenium window name.
 
Constructor Summary
FrameGroupCommandQueueSet(java.lang.String sessionId, int portDriversShouldContact, RemoteControlConfiguration configuration)
           
 
Method Summary
protected  void addTemporaryFile(java.io.File tf)
           
static void clearQueueSet(java.lang.String sessionId)
          Deletes the specified FrameGroupCommandQueueSet
 java.lang.String doCommand(java.lang.String command, java.lang.String arg, java.lang.String value)
          Schedules the specified command to be retrieved by the next call to handle command result, and returns the result of that command.
 void endOfLife()
           Empty queues, and thereby wake up any threads that are hanging around.
 CommandQueue getCommandQueue()
           
 CommandQueue getCommandQueue(java.lang.String uniqueId)
           
 java.lang.String getExtensionJs()
           
static FrameGroupCommandQueueSet getQueueSet(java.lang.String sessionId)
          Retrieves a FrameGroupCommandQueueSet for the specified sessionId
protected  int getSpeed()
          Returns the delay for this frame group's command queues
 java.lang.String getStringArrayAccessorCSV(java.lang.String[] stringArray)
          Generates a CSV string from the given string array.
 RemoteCommand handleCommandResult(java.lang.String commandResult, FrameAddress incomingFrameAddress, java.lang.String uniqueId, boolean justLoaded, java.util.List<?> jsWindowNameVars)
           Accepts a command reply, and retrieves the next command to run.
static FrameAddress makeFrameAddress(java.lang.String seleniumWindowName, java.lang.String localFrameAddress)
           
static FrameGroupCommandQueueSet makeQueueSet(java.lang.String sessionId, int portDriversShouldContact, RemoteControlConfiguration configuration)
          Creates a FrameGroupCommandQueueSet for the specifed sessionId
protected  void removeTemporaryFiles()
           
 void reset(java.lang.String baseUrl)
           
 void setExtensionJs(java.lang.String extensionJs)
           
protected  void setSpeed(int i)
          Sets this frame group's speed, and updates all command queues to use this speed.
protected static void sleepForAtLeast(long ms)
           
 java.lang.String waitForLoad(long timeoutInMilliseconds)
           
protected static boolean waitUntilSignalOrNumSecondsPassed(java.util.concurrent.locks.Condition condition, int numSeconds)
          Waits on the condition, making sure to wait at least as many seconds as specified, unless the condition is signaled first.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LOCAL_FRAME_ADDRESS

public static final java.lang.String DEFAULT_LOCAL_FRAME_ADDRESS
See Also:
Constant Field Values

DEFAULT_SELENIUM_WINDOW_NAME

public static final java.lang.String DEFAULT_SELENIUM_WINDOW_NAME
Each user-visible window group has a selenium window name. The name of the initial browser window is "". Even if the page reloads, the JavaScript is able to determine that it is this initial window because window.opener==null. Any window for whom window.opener!=null is a "pop-up".

See Also:
Constant Field Values
Constructor Detail

FrameGroupCommandQueueSet

public FrameGroupCommandQueueSet(java.lang.String sessionId,
                                 int portDriversShouldContact,
                                 RemoteControlConfiguration configuration)
Method Detail

getCommandQueue

public CommandQueue getCommandQueue()

getQueueSet

public static FrameGroupCommandQueueSet getQueueSet(java.lang.String sessionId)
Retrieves a FrameGroupCommandQueueSet for the specified sessionId


makeQueueSet

public static FrameGroupCommandQueueSet makeQueueSet(java.lang.String sessionId,
                                                     int portDriversShouldContact,
                                                     RemoteControlConfiguration configuration)
Creates a FrameGroupCommandQueueSet for the specifed sessionId


clearQueueSet

public static void clearQueueSet(java.lang.String sessionId)
Deletes the specified FrameGroupCommandQueueSet


getCommandQueue

public CommandQueue getCommandQueue(java.lang.String uniqueId)

setSpeed

protected void setSpeed(int i)
Sets this frame group's speed, and updates all command queues to use this speed.

Parameters:
i - millisecond delay between queue operations

getSpeed

protected int getSpeed()
Returns the delay for this frame group's command queues

Returns:
millisecond delay between queue operations

doCommand

public java.lang.String doCommand(java.lang.String command,
                                  java.lang.String arg,
                                  java.lang.String value)
                           throws RemoteCommandException
Schedules the specified command to be retrieved by the next call to handle command result, and returns the result of that command.

Parameters:
command - - the remote command verb
arg - - the first remote argument (meaning depends on the verb)
value - - the second remote argument
Returns:
- the command result, defined by the remote JavaScript. "getX" style commands may return data from the browser; other "doX" style commands may just return "OK" or an error message.
Throws:
RemoteCommandException - if a waitForLoad failed.

getStringArrayAccessorCSV

public java.lang.String getStringArrayAccessorCSV(java.lang.String[] stringArray)
Generates a CSV string from the given string array.

Parameters:
stringArray - Array of strings to generate a CSV.

waitForLoad

public java.lang.String waitForLoad(long timeoutInMilliseconds)
                             throws RemoteCommandException
Throws:
RemoteCommandException

waitUntilSignalOrNumSecondsPassed

protected static boolean waitUntilSignalOrNumSecondsPassed(java.util.concurrent.locks.Condition condition,
                                                           int numSeconds)
Waits on the condition, making sure to wait at least as many seconds as specified, unless the condition is signaled first.

Parameters:
condition -
numSeconds -

sleepForAtLeast

protected static void sleepForAtLeast(long ms)

handleCommandResult

public RemoteCommand handleCommandResult(java.lang.String commandResult,
                                         FrameAddress incomingFrameAddress,
                                         java.lang.String uniqueId,
                                         boolean justLoaded,
                                         java.util.List<?> jsWindowNameVars)

Accepts a command reply, and retrieves the next command to run.

Parameters:
commandResult - - the reply from the previous command, or null
incomingFrameAddress - - frame from which the reply came
uniqueId -
justLoaded -
jsWindowNameVars -
Returns:
- the next command to run

endOfLife

public void endOfLife()

Empty queues, and thereby wake up any threads that are hanging around.


makeFrameAddress

public static FrameAddress makeFrameAddress(java.lang.String seleniumWindowName,
                                            java.lang.String localFrameAddress)

reset

public void reset(java.lang.String baseUrl)

removeTemporaryFiles

protected void removeTemporaryFiles()

addTemporaryFile

protected void addTemporaryFile(java.io.File tf)

setExtensionJs

public void setExtensionJs(java.lang.String extensionJs)

getExtensionJs

public java.lang.String getExtensionJs()


Copyright © 2011. All Rights Reserved.