Exemplo n.º 1
0
 public SimulatorSession(ResponseFinder... finders) {
   connectionKey = UUID.randomUUID().toString();
   simulatorProtocol = new SimulatorProtocolImpl(new DefaultMessageListener(this), finders);
   simulatorProtocol.sendSetConnectionKey(connectionKey);
   waitForSimToRegister();
   waitForSimToSendApps();
 }
Exemplo n.º 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.");
  }
Exemplo n.º 3
0
 public void connect(String bundleId) {
   List<WebkitApplication> knownApps = getApplications();
   for (WebkitApplication app : knownApps) {
     if (bundleId.equals(app.getBundleId())) {
       this.bundleId = bundleId;
       simulatorProtocol.sendConnectToApplication(connectionKey, bundleId);
       waitForSimToSendPages();
       return;
     }
   }
   throw new WebDriverException(
       bundleId
           + " not in the list "
           + knownApps
           + ".Either it's not started, or it has no webview to connect to.");
 }
Exemplo n.º 4
0
 public void stop() {
   simulatorProtocol.stop();
 }