OLD | NEW |
1 Index: java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriv
erSupplier.java | 1 Index: java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriv
erSupplier.java |
2 =================================================================== | 2 =================================================================== |
3 --- java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverS
upplier.java» (revision 17049) | 3 --- java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverS
upplier.java» (revision 18370) |
4 +++ java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverS
upplier.java (working copy) | 4 +++ java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverS
upplier.java (working copy) |
5 @@ -87,7 +87,7 @@ | 5 @@ -87,7 +87,7 @@ |
6 if (DesiredCapabilities.android().getBrowserName().equals(name)) { | 6 if (DesiredCapabilities.android().getBrowserName().equals(name)) { |
7 className = "org.openqa.selenium.android.AndroidDriver"; | 7 className = "org.openqa.selenium.android.AndroidDriver"; |
8 } else if (DesiredCapabilities.chrome().getBrowserName().equals(name)) { | 8 } else if (DesiredCapabilities.chrome().getBrowserName().equals(name)) { |
9 - className = "org.openqa.selenium.testing.drivers.TestChromeDriver"; | 9 - className = "org.openqa.selenium.testing.drivers.TestChromeDriver"; |
10 + className = "org.openqa.selenium.testing.drivers.TestNewChromeDriver"; | 10 + className = "org.openqa.selenium.testing.drivers.TestNewChromeDriver"; |
11 } else if (DesiredCapabilities.firefox().getBrowserName().equals(name)) { | 11 } else if (DesiredCapabilities.firefox().getBrowserName().equals(name)) { |
12 className = getFirefoxClassName(); | 12 className = getFirefoxClassName(); |
13 } else if (DesiredCapabilities.htmlUnit().getBrowserName().equals(name)) { | 13 } else if (DesiredCapabilities.htmlUnit().getBrowserName().equals(name)) { |
14 Index: java/client/test/org/openqa/selenium/testing/drivers/build.desc | 14 Index: java/client/test/org/openqa/selenium/testing/drivers/build.desc |
15 =================================================================== | 15 =================================================================== |
16 --- java/client/test/org/openqa/selenium/testing/drivers/build.desc» (revisio
n 17049) | 16 --- java/client/test/org/openqa/selenium/testing/drivers/build.desc» (revisio
n 18370) |
17 +++ java/client/test/org/openqa/selenium/testing/drivers/build.desc (working
copy) | 17 +++ java/client/test/org/openqa/selenium/testing/drivers/build.desc (working
copy) |
18 @@ -9,6 +9,7 @@ | 18 @@ -9,6 +9,7 @@ |
19 "SauceDriver.java", | 19 "SauceDriver.java", |
20 "SynthesizedFirefoxDriver.java", | 20 "SynthesizedFirefoxDriver.java", |
21 "TestChromeDriver.java", | 21 "TestChromeDriver.java", |
22 + "TestNewChromeDriver.java", | 22 + "TestNewChromeDriver.java", |
23 "TestIgnorance.java", | 23 "TestIgnorance.java", |
24 "TestInternetExplorerDriver.java", | 24 "TestInternetExplorerDriver.java", |
25 "WebDriverBuilder.java", | 25 "WebDriverBuilder.java", |
26 Index: java/client/test/org/openqa/selenium/testing/drivers/TestNewChromeDriver.
java | 26 Index: java/client/test/org/openqa/selenium/testing/drivers/TestNewChromeDriver.
java |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 + DesiredCapabilities capabilities = DesiredCapabilities.chrome(); | 77 + DesiredCapabilities capabilities = DesiredCapabilities.chrome(); |
78 + capabilities.setCapability(ChromeOptions.CAPABILITY, options); | 78 + capabilities.setCapability(ChromeOptions.CAPABILITY, options); |
79 + | 79 + |
80 + if (originalCapabilities != null) { | 80 + if (originalCapabilities != null) { |
81 + capabilities.merge(originalCapabilities); | 81 + capabilities.merge(originalCapabilities); |
82 + } | 82 + } |
83 + | 83 + |
84 + return capabilities; | 84 + return capabilities; |
85 + } | 85 + } |
86 +} | 86 +} |
87 \ No newline at end of file | |
88 Index: java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java | 87 Index: java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java |
89 =================================================================== | 88 =================================================================== |
90 --- java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java (revisio
n 0) | 89 --- java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java (revisio
n 0) |
91 +++ java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java (revisio
n 0) | 90 +++ java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java (revisio
n 0) |
92 @@ -0,0 +1,54 @@ | 91 @@ -0,0 +1,53 @@ |
93 +/* | 92 +/* |
94 +Copyright 2012 Selenium committers | 93 +Copyright 2012 Selenium committers |
95 +Copyright 2012 Software Freedom Conservancy | 94 +Copyright 2012 Software Freedom Conservancy |
96 + | 95 + |
97 +Licensed under the Apache License, Version 2.0 (the "License"); | 96 +Licensed under the Apache License, Version 2.0 (the "License"); |
98 +you may not use this file except in compliance with the License. | 97 +you may not use this file except in compliance with the License. |
99 +You may obtain a copy of the License at | 98 +You may obtain a copy of the License at |
100 + | 99 + |
101 + http://www.apache.org/licenses/LICENSE-2.0 | 100 + http://www.apache.org/licenses/LICENSE-2.0 |
102 + | 101 + |
103 +Unless required by applicable law or agreed to in writing, software | 102 +Unless required by applicable law or agreed to in writing, software |
104 +distributed under the License is distributed on an "AS IS" BASIS, | 103 +distributed under the License is distributed on an "AS IS" BASIS, |
105 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 104 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
106 +See the License for the specific language governing permissions and | 105 +See the License for the specific language governing permissions and |
107 +limitations under the License. | 106 +limitations under the License. |
108 +*/ | 107 +*/ |
109 + | 108 + |
110 +package org.openqa.selenium.chrome; | 109 +package org.openqa.selenium.chrome; |
111 + | 110 + |
112 +import org.json.JSONException; | |
113 +import org.json.JSONObject; | |
114 +import org.openqa.selenium.remote.BeanToJsonConverter; | 111 +import org.openqa.selenium.remote.BeanToJsonConverter; |
115 +import org.openqa.selenium.remote.Command; | 112 +import org.openqa.selenium.remote.Command; |
116 +import org.openqa.selenium.remote.CommandExecutor; | 113 +import org.openqa.selenium.remote.CommandExecutor; |
117 +import org.openqa.selenium.remote.JsonToBeanConverter; | 114 +import org.openqa.selenium.remote.JsonToBeanConverter; |
118 +import org.openqa.selenium.remote.Response; | 115 +import org.openqa.selenium.remote.Response; |
119 + | 116 + |
120 +import java.io.IOException; | 117 +import java.io.IOException; |
| 118 +import java.util.HashMap; |
| 119 +import java.util.Map; |
121 + | 120 + |
122 +/** | 121 +/** |
123 + * Executes a ChromeDriver command using the new ChromeDriver. | 122 + * Executes a ChromeDriver command using the new ChromeDriver. |
124 + */ | 123 + */ |
125 +public class NewCommandExecutor implements CommandExecutor { | 124 +public class NewCommandExecutor implements CommandExecutor { |
126 + | 125 + |
| 126 + static { |
| 127 + System.loadLibrary("chromedriver"); |
| 128 + } |
| 129 + |
127 + @Override | 130 + @Override |
128 + public Response execute(Command command) throws IOException { | 131 + public Response execute(Command command) throws IOException { |
129 + System.loadLibrary("chromedriver"); | 132 + Map<String, Object> jsonCommand = new HashMap<String, Object>(); |
130 + JSONObject jsonCommand = new JSONObject(); | 133 + jsonCommand.put("name", command.getName()); |
131 + try { | 134 + jsonCommand.put("parameters", command.getParameters()); |
132 + jsonCommand.put("name", command.getName()); | 135 + String id = ""; |
133 + jsonCommand.put("parameters", command.getParameters()); | 136 + if (command.getSessionId() != null) |
134 + String id = ""; | 137 + id = command.getSessionId().toString(); |
135 + if (command.getSessionId() != null) | 138 + jsonCommand.put("sessionId", id); |
136 + id = command.getSessionId().toString(); | 139 + String responseText = execute(new BeanToJsonConverter().convert(jsonCommand
)); |
137 + jsonCommand.put("sessionId", id); | 140 + return new JsonToBeanConverter().convert(Response.class, responseText); |
138 + String responseText = execute(new BeanToJsonConverter().convert(jsonComma
nd)); | |
139 + return new JsonToBeanConverter().convert(Response.class, responseText); | |
140 + } catch (JSONException e) { | |
141 + throw new IOException(e); | |
142 + } | |
143 + } | 141 + } |
144 + | 142 + |
145 + private static native String execute(String command); | 143 + private static native String execute(String command); |
146 +} | 144 +} |
OLD | NEW |