49
49
*/
50
50
public class SafariOptions extends MutableCapabilities {
51
51
52
+ private static final String SAFARI_TECH_PREVIEW = "Safari Technology Preview" ;
53
+
52
54
/**
53
55
* Key used to store SafariOptions in a {@link Capabilities} object.
54
56
* @deprecated No replacement. Use the methods on this class
@@ -63,9 +65,6 @@ private interface Option {
63
65
// Defined by Apple
64
66
String AUTOMATIC_INSPECTION = "safari:automaticInspection" ;
65
67
String AUTOMATIC_PROFILING = "safari:automaticProfiling" ;
66
-
67
- // Defined by us
68
- String TECH_PREVIEW = "se:safari:techPreview" ;
69
68
}
70
69
71
70
private Map <String , Object > options = new TreeMap <>();
@@ -155,14 +154,13 @@ public SafariOptions setAutomaticProfiling(boolean automaticProfiling) {
155
154
public SafariOptions setUseTechnologyPreview (boolean useTechnologyPreview ) {
156
155
options .put (Option .TECHNOLOGY_PREVIEW , useTechnologyPreview );
157
156
// Use an object here, rather than a boolean to avoid a stack overflow
158
- super .setCapability (Option .TECH_PREVIEW , Boolean .valueOf (useTechnologyPreview ));
159
- super .setCapability (BROWSER_NAME , useTechnologyPreview ? "Safari Technology Preview" : "safari" );
157
+ super .setCapability (BROWSER_NAME , useTechnologyPreview ? SAFARI_TECH_PREVIEW : "safari" );
160
158
return this ;
161
159
}
162
160
163
161
@ Override
164
162
public void setCapability (String key , Object value ) {
165
- if (Option .TECHNOLOGY_PREVIEW .equals (key ) || Option . TECH_PREVIEW . equals ( key ) ) {
163
+ if (Option .TECHNOLOGY_PREVIEW .equals (key )) {
166
164
setUseTechnologyPreview (Boolean .valueOf (value .toString ()));
167
165
} else {
168
166
super .setCapability (key , value );
@@ -171,7 +169,7 @@ public void setCapability(String key, Object value) {
171
169
172
170
@ Override
173
171
public void setCapability (String key , boolean value ) {
174
- if (Option .TECHNOLOGY_PREVIEW .equals (key ) || Option . TECH_PREVIEW . equals ( key ) ) {
172
+ if (Option .TECHNOLOGY_PREVIEW .equals (key )) {
175
173
setUseTechnologyPreview (value );
176
174
} else {
177
175
super .setCapability (key , value );
@@ -194,7 +192,8 @@ public boolean getAutomaticProfiling() {
194
192
}
195
193
196
194
public boolean getUseTechnologyPreview () {
197
- return is (Option .TECH_PREVIEW )|| options .get (Option .TECHNOLOGY_PREVIEW ) == Boolean .TRUE ;
195
+ return SAFARI_TECH_PREVIEW .equals (getBrowserName ()) ||
196
+ options .get (Option .TECHNOLOGY_PREVIEW ) == Boolean .TRUE ;
198
197
}
199
198
200
199
// (De)serialization of the options
0 commit comments