예제 #1
0
  /** Gets information on available services and their versions from Opera. */
  private HostInfo getHostInfo() {
    Response response = executeCommand(ScopeCommand.HOST_INFO, null);

    try {
      return HostInfo.parseFrom(response.getPayload());
    } catch (InvalidProtocolBufferException ex) {
      throw new WebDriverException("Error while parsing host info");
    }
  }
예제 #2
0
  /** Gets the supported services from Opera and calls methods to enable the ones we requested. */
  public void init() {
    waitState.setProfile(product);
    waitForHandshake();

    hostInfo = getHostInfo();
    createUmsServices(OperaFlags.ENABLE_DEBUGGER, hostInfo);

    connect();

    List<String> wantedServices = new ArrayList<String>();

    boolean ecmascriptService = false;
    for (Service service : hostInfo.getServiceListList()) {
      if (service.getName().equals("ecmascript")) {
        ecmascriptService = true;
        break;
      }
    }
    if (ecmascriptService) {
      wantedServices.add("ecmascript");
    } else {
      wantedServices.add("ecmascript-debugger");
    }

    wantedServices.add("exec");
    wantedServices.add("window-manager");
    wantedServices.add("core");

    if (versions.containsKey("prefs")) {
      wantedServices.add("prefs");
    }

    if (versions.containsKey("desktop-window-manager")) {
      wantedServices.add("desktop-window-manager");
    }

    if (versions.containsKey("system-input")) {
      wantedServices.add("system-input");
    }

    if (versions.containsKey("desktop-utils")) {
      wantedServices.add("desktop-utils");
    }

    if (versions.containsKey("selftest")) {
      wantedServices.add("selftest");
    }

    // wantedServices.add("console-logger");
    // wantedServices.add("http-logger");
    wantedServices.add("cookie-manager");

    enableServices(wantedServices);

    initializeServices(OperaFlags.ENABLE_DEBUGGER);
  }
예제 #3
0
  public boolean isOperaIdleAvailable() {
    for (ScopeProtos.Service service : hostInfo.getServiceListList()) {
      if (service.getName().equals("core")) {
        String version = service.getVersion();

        // Version 1.1 introduced some important fixes, and we don't want to use idle detection
        // without this.
        boolean ok = VersionUtil.compare(version, "1.1") >= 0;
        logger.finer("core service version check: " + ok + " (" + version + ")");
        return ok;
      }
    }

    logger.severe("core service not found");
    return false;
  }