예제 #1
0
 public SimulatorSession(ResponseFinder... finders) {
   connectionKey = UUID.randomUUID().toString();
   simulatorProtocol = new SimulatorProtocolImpl(new DefaultMessageListener(this), finders);
   simulatorProtocol.sendSetConnectionKey(connectionKey);
   waitForSimToRegister();
   waitForSimToSendApps();
 }
예제 #2
0
  public BaseWebInspector connect(WebkitPage webkitPage, ServerSideSession session) {
    for (WebkitPage page : getPages()) {
      if (page.equals(webkitPage)) {
        WebInspector inspector =
            new WebInspector(
                null, webkitPage.getPageId(), simulatorProtocol, bundleId, connectionKey, session);
        // TODO move to webinspector
        simulatorProtocol.sendSetConnectionKey(connectionKey);
        simulatorProtocol.sendConnectToApplication(connectionKey, bundleId);
        simulatorProtocol.sendSenderKey(
            connectionKey, bundleId, inspector.getSenderKey(), "" + page.getPageId());
        inspector.sendCommand(Page.enablePageEvent());

        boolean ok = created.add(inspector);
        if (ok) {
          simulatorProtocol.addListener(inspector);
        }
        return inspector;
      }
    }
    throw new WebDriverException("Cannot connect to page " + webkitPage + ".Cannot find it.");
  }