Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: patch.diff

Issue 11635019: [chromedriver] Fix issue of converting parameter to JSON. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webdriver/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test-standalone.jar » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: patch.diff
===================================================================
--- patch.diff (revision 173943)
+++ patch.diff (working copy)
@@ -1,6 +1,6 @@
Index: java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverSupplier.java
===================================================================
---- java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverSupplier.java (revision 17049)
+--- java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverSupplier.java (revision 18370)
+++ java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverSupplier.java (working copy)
@@ -87,7 +87,7 @@
if (DesiredCapabilities.android().getBrowserName().equals(name)) {
@@ -13,7 +13,7 @@
} else if (DesiredCapabilities.htmlUnit().getBrowserName().equals(name)) {
Index: java/client/test/org/openqa/selenium/testing/drivers/build.desc
===================================================================
---- java/client/test/org/openqa/selenium/testing/drivers/build.desc (revision 17049)
+--- java/client/test/org/openqa/selenium/testing/drivers/build.desc (revision 18370)
+++ java/client/test/org/openqa/selenium/testing/drivers/build.desc (working copy)
@@ -9,6 +9,7 @@
"SauceDriver.java",
@@ -84,12 +84,11 @@
+ return capabilities;
+ }
+}
-\ No newline at end of file
Index: java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java
===================================================================
--- java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java (revision 0)
+++ java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java (revision 0)
-@@ -0,0 +1,54 @@
+@@ -0,0 +1,53 @@
+/*
+Copyright 2012 Selenium committers
+Copyright 2012 Software Freedom Conservancy
@@ -109,8 +108,6 @@
+
+package org.openqa.selenium.chrome;
+
-+import org.json.JSONException;
-+import org.json.JSONObject;
+import org.openqa.selenium.remote.BeanToJsonConverter;
+import org.openqa.selenium.remote.Command;
+import org.openqa.selenium.remote.CommandExecutor;
@@ -118,28 +115,29 @@
+import org.openqa.selenium.remote.Response;
+
+import java.io.IOException;
++import java.util.HashMap;
++import java.util.Map;
+
+/**
+ * Executes a ChromeDriver command using the new ChromeDriver.
+ */
+public class NewCommandExecutor implements CommandExecutor {
+
++ static {
++ System.loadLibrary("chromedriver");
++ }
++
+ @Override
+ public Response execute(Command command) throws IOException {
-+ System.loadLibrary("chromedriver");
-+ JSONObject jsonCommand = new JSONObject();
-+ try {
-+ jsonCommand.put("name", command.getName());
-+ jsonCommand.put("parameters", command.getParameters());
-+ String id = "";
-+ if (command.getSessionId() != null)
-+ id = command.getSessionId().toString();
-+ jsonCommand.put("sessionId", id);
-+ String responseText = execute(new BeanToJsonConverter().convert(jsonCommand));
-+ return new JsonToBeanConverter().convert(Response.class, responseText);
-+ } catch (JSONException e) {
-+ throw new IOException(e);
-+ }
++ Map<String, Object> jsonCommand = new HashMap<String, Object>();
++ jsonCommand.put("name", command.getName());
++ jsonCommand.put("parameters", command.getParameters());
++ String id = "";
++ if (command.getSessionId() != null)
++ id = command.getSessionId().toString();
++ jsonCommand.put("sessionId", id);
++ String responseText = execute(new BeanToJsonConverter().convert(jsonCommand));
++ return new JsonToBeanConverter().convert(Response.class, responseText);
+ }
+
+ private static native String execute(String command);
« no previous file with comments | « no previous file | test-standalone.jar » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698