Skip to content

Commit 1080c91

Browse files
committed
All Platforms have a family.
For `Platform` values that represent a platform family, that value is itself.
1 parent ce962bd commit 1080c91

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

java/client/src/org/openqa/selenium/Platform.java

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ public enum Platform {
3232
/**
3333
* Never returned, but can be used to request a browser running on any version of Windows.
3434
*/
35-
WINDOWS("") {},
35+
WINDOWS("") {
36+
@Override
37+
public Platform family() {
38+
return WINDOWS;
39+
}
40+
},
3641

3742
/**
3843
* For versions of Windows that "feel like" Windows XP. These are ones that store files in
@@ -79,7 +84,12 @@ public Platform family() {
7984
}
8085
},
8186

82-
MAC("mac", "darwin", "macOS", "os x") {},
87+
MAC("mac", "darwin", "macOS", "os x") {
88+
@Override
89+
public Platform family() {
90+
return MAC;
91+
}
92+
},
8393

8494
SNOW_LEOPARD("snow leopard", "os x 10.6") {
8595
@Override
@@ -150,12 +160,17 @@ public String toString() {
150160
/**
151161
* Many platforms have UNIX traits, amongst them LINUX, Solaris and BSD.
152162
*/
153-
UNIX("solaris", "bsd") {},
163+
UNIX("solaris", "bsd") {
164+
@Override
165+
public Platform family() {
166+
return UNIX;
167+
}
168+
},
154169

155170
LINUX("linux") {
156171
@Override
157172
public Platform family() {
158-
return UNIX;
173+
return LINUX;
159174
}
160175
},
161176

@@ -166,20 +181,20 @@ public Platform family() {
166181
}
167182
},
168183

169-
/**
170-
* Provide a temporary workaround for an issue where platformName was being overridden by
171-
* platform for external providers.
172-
*/
173-
@Deprecated
174184
IOS("iOS") {
175185
@Override
176-
public Platform family() { return MAC; }
186+
public Platform family() { return IOS; }
177187
},
178188

179189
/**
180190
* Never returned, but can be used to request a browser running on any operating system.
181191
*/
182192
ANY("") {
193+
@Override
194+
public Platform family() {
195+
return ANY;
196+
}
197+
183198
@Override
184199
public boolean is(Platform compareWith) {
185200
return this == compareWith;
@@ -190,7 +205,7 @@ public boolean is(Platform compareWith) {
190205
private int minorVersion = 0;
191206
private int majorVersion = 0;
192207

193-
private Platform(String... partOfOsName) {
208+
Platform(String... partOfOsName) {
194209
this.partOfOsName = partOfOsName;
195210
}
196211

@@ -340,9 +355,7 @@ public boolean is(Platform compareWith) {
340355
*
341356
* @return the family platform for the current one
342357
*/
343-
public Platform family() {
344-
return ANY;
345-
}
358+
public abstract Platform family();
346359

347360
private boolean isCurrentPlatform(String osName, String matchAgainst) {
348361
return osName.contains(matchAgainst);

0 commit comments

Comments
 (0)