/**
  * Shuts down this browser session's launcher and clears out its session data (if session is not
  * null).
  *
  * @param sessionInfo the browser session to end.
  */
 protected void shutdownBrowserAndClearSessionData(BrowserSessionInfo sessionInfo) {
   try {
     sessionInfo.launcher.close(); // can throw RuntimeException
   } finally {
     if (null != sessionInfo.session) {
       FrameGroupCommandQueueSet.clearQueueSet(sessionInfo.sessionId);
     }
   }
 }
 @Test
 public void testGetGlobalQueueSpeed() {
   assertEquals(defaultSpeed, CommandQueue.getSpeed());
   FrameGroupCommandQueueSet session1 =
       FrameGroupCommandQueueSet.makeQueueSet(
           firstSessionId,
           RemoteControlConfiguration.DEFAULT_PORT,
           new RemoteControlConfiguration());
   int sessionSpeedOnInit = session1.getSpeed();
   assertEquals(defaultSpeed, sessionSpeedOnInit);
   FrameGroupCommandQueueSet.clearQueueSet(firstSessionId);
 }
 public void testGetPresetSpeedValidSession() {
   assertEquals(defaultSpeed, CommandQueue.getSpeed());
   FrameGroupCommandQueueSet session1 =
       FrameGroupCommandQueueSet.makeQueueSet(
           firstSessionId,
           RemoteControlConfiguration.DEFAULT_PORT,
           new RemoteControlConfiguration());
   assertNotNull(session1);
   SeleniumDriverResourceHandler.setSpeedForSession(firstSessionId, newSpeed);
   String speed = SeleniumDriverResourceHandler.getSpeedForSession(firstSessionId);
   assertEquals(newSpeedString, speed);
   FrameGroupCommandQueueSet.clearQueueSet(firstSessionId);
 }
  @Test
  public void testCommandQueueInitSpeedMatchesSessionSpeed() {
    assertEquals(defaultSpeed, CommandQueue.getSpeed());
    FrameGroupCommandQueueSet session1 =
        FrameGroupCommandQueueSet.makeQueueSet(
            firstSessionId,
            RemoteControlConfiguration.DEFAULT_PORT,
            new RemoteControlConfiguration());
    session1.setSpeed(newSpeed);

    CommandQueue queue1 = session1.getCommandQueue(firstQueueId);
    assertEquals(newSpeed, queue1.getQueueDelay());
    assertEquals(defaultSpeed, CommandQueue.getSpeed());

    FrameGroupCommandQueueSet.clearQueueSet(firstSessionId);
  }