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

Side by Side Diff: patch.diff

Issue 13688002: [chromedriver] Update Java tests to latest selenium release, 2.31. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webdriver/
Patch Set: Created 7 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « common.zip ('k') | test-standalone.jar » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Index: java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.jav a 1 diff --git a/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java b/jav a/client/src/org/openqa/selenium/chrome/ChromeOptions.java
2 =================================================================== 2 index 322ca9f..bb3918b 100644
3 --- java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java» (revision 17049) 3 --- a/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java
4 +++ java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java» (working copy) 4 +++ b/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java
5 @@ -74,6 +74,10 @@ 5 @@ -71,6 +71,7 @@
6 if (chromePath != null) {
7 options.setBinary(new File(chromePath));
8 }
9 + String androidPackage = System.getProperty("webdriver.chrome.android_packag e");
10 + if (androidPackage != null) {
11 + options.setAndroidPackage(androidPackage);
12 + }
13
14 DesiredCapabilities capabilities = DesiredCapabilities.chrome();
15 capabilities.setCapability(ChromeOptions.CAPABILITY, options);
16 Index: java/client/src/org/openqa/selenium/chrome/ChromeOptions.java
17 ===================================================================
18 --- java/client/src/org/openqa/selenium/chrome/ChromeOptions.java» (revisio n 17049)
19 +++ java/client/src/org/openqa/selenium/chrome/ChromeOptions.java» (working copy)
20 @@ -65,6 +65,7 @@
21 public static final String CAPABILITY = "chromeOptions"; 6 public static final String CAPABILITY = "chromeOptions";
22 7
23 private File binary; 8 private File binary;
24 + private String androidPackage; 9 + private String androidPackage;
25 private List<String> args = Lists.newArrayList(); 10 private List<String> args = Lists.newArrayList();
26 private List<File> extensionFiles = Lists.newArrayList(); 11 private List<File> extensionFiles = Lists.newArrayList();
27 private Map<String, Object> experimentalOptions = Maps.newHashMap(); 12 private Map<String, Object> experimentalOptions = Maps.newHashMap();
28 @@ -81,6 +82,16 @@ 13 @@ -87,6 +88,16 @@ public void setBinary(File path) {
29 } 14 }
30 15
31 /** 16 /**
32 + * Sets the Android package name for Chrome. The package should already exist 17 + * Sets the Android package name for Chrome. The package should already exist
33 + * on the Android device. 18 + * on the Android device.
34 + * 19 + *
35 + * @param package_name Name of Chrome's Android package. 20 + * @param package_name Name of Chrome's Android package.
36 + */ 21 + */
37 + public void setAndroidPackage(String package_name) { 22 + public void setAndroidPackage(String package_name) {
38 + androidPackage = checkNotNull(package_name); 23 + androidPackage = checkNotNull(package_name);
39 + } 24 + }
40 + 25 +
41 + /** 26 + /**
42 * @param arguments The arguments to use when starting Chrome. 27 * @param arguments The arguments to use when starting Chrome.
43 * @see #addArguments(java.util.List) 28 * @see #addArguments(java.util.List)
44 */ 29 */
45 @@ -147,6 +158,10 @@ 30 @@ -165,6 +176,10 @@ public JSONObject toJson() throws IOException, JSONExceptio n {
46 options.put("binary", binary.getPath()); 31 options.put("binary", binary.getPath());
47 } 32 }
48 33
49 + if (androidPackage != null) { 34 + if (androidPackage != null) {
50 + options.put("android_package", androidPackage); 35 + options.put("android_package", androidPackage);
51 + } 36 + }
52 + 37 +
53 options.put("args", ImmutableList.copyOf(args)); 38 options.put("args", ImmutableList.copyOf(args));
54 39
55 List<String> extensions = Lists.newArrayListWithExpectedSize( 40 List<String> extensions = Lists.newArrayListWithExpectedSize(
41 diff --git a/java/client/test/org/openqa/selenium/testing/drivers/ReflectionBack edDriverSupplier.java b/java/client/test/org/openqa/selenium/testing/drivers/Ref lectionBackedDriverSupplier.java
42 index 3cc5799..7316a41 100644
43 --- a/java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDrive rSupplier.java
44 +++ b/java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDrive rSupplier.java
45 @@ -29,6 +29,7 @@
46 import org.openqa.selenium.WebDriver;
47 import org.openqa.selenium.firefox.FirefoxDriver;
48 import org.openqa.selenium.firefox.FirefoxProfile;
49 +import org.openqa.selenium.remote.Augmenter;
50 import org.openqa.selenium.remote.DesiredCapabilities;
51 import org.openqa.selenium.testing.InProject;
52
53 @@ -76,7 +77,8 @@ public WebDriver get() {
54 }
55
56 //TODO: Call constructor with two Capabilities arguments for all driver c lasses
57 - return driverClass.getConstructor(Capabilities.class).newInstance(desired CapsToUse);
58 + WebDriver d = driverClass.getConstructor(Capabilities.class).newInstance( desiredCapsToUse);
59 + return new Augmenter().augment(d);
60 } catch (InvocationTargetException e) {
61 throw Throwables.propagate(e.getTargetException());
62 } catch (Exception e) {
63 diff --git a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriv er.java b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver. java
64 index e8a1c22..1629284 100644
65 --- a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
66 +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
67 @@ -73,6 +73,10 @@ private static DesiredCapabilities chromeWithCustomCapabiliti es(
68 if (chromePath != null) {
69 options.setBinary(new File(chromePath));
70 }
71 + String androidPackage = System.getProperty("webdriver.chrome.android_packag e");
72 + if (androidPackage != null) {
73 + options.setAndroidPackage(androidPackage);
74 + }
75
76 DesiredCapabilities capabilities = DesiredCapabilities.chrome();
77 capabilities.setCapability(ChromeOptions.CAPABILITY, options);
78 diff --git a/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance. java b/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java
79 index 587cea0..c14b8fd 100644
80 --- a/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java
81 +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java
82 @@ -93,8 +93,28 @@ public boolean isIgnored(AnnotatedElement element) {
83 return ignored;
84 }
85
86 - // JUnit 4
87 public boolean isIgnored(FrameworkMethod method, Object test) {
88 + String name = test.getClass().getSimpleName() + "." + method.getName();
89 + String filter = System.getProperty("filter", ".*");
90 + String[] patternGroups = filter.split("-");
91 + String[] positivePatterns = patternGroups[0].split(":");
92 + String[] negativePatterns = new String[0];
93 + if (patternGroups.length > 1)
94 + negativePatterns = patternGroups[1].split(":");
95 +
96 + for (int i = 0; i < negativePatterns.length; i++) {
97 + if (name.matches(negativePatterns[i]))
98 + return true;
99 + }
100 + for (int i = 0; i < positivePatterns.length; i++) {
101 + if (name.matches(positivePatterns[i]))
102 + return false;
103 + }
104 + return true;
105 + }
106 +
107 + // JUnit 4
108 + public boolean isIgnoredOld(FrameworkMethod method, Object test) {
109 boolean ignored = ignoreComparator.shouldIgnore(test.getClass().getAnnotati on(Ignore.class)) ||
110 ignoreComparator.shouldIgnore(method.getMethod().getAnnot ation(Ignore.class));
111
112 @@ -224,4 +244,4 @@ private void addIgnoresForBrowser(Browser browser, IgnoreCom parator comparator)
113 }
114 }
115
116 -}
117 \ No newline at end of file
118 +}
OLDNEW
« no previous file with comments | « common.zip ('k') | test-standalone.jar » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698