Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DriverOptions.java #1256

Merged
merged 1 commit into from
Aug 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public class DriverOptions {
public final Logger driverLogger;
public final String uniqueName;
public final File workingDir;
public final boolean disableNotifications;
public final String userAgent;
Comment on lines +84 to +85
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can ignore that!

public final String userDataDir;
public final String processLogFile;
public final int maxPayloadSize;
Expand Down Expand Up @@ -167,12 +169,20 @@ public DriverOptions(ScenarioContext context, Map<String, Object> options, LogAp
args.add(executable);
}
}
workingDir = new File(FileUtils.getBuildDir() + File.separator + uniqueName);
if (options.containsKey("userDataDir")) { // special case allow user-specified null
userDataDir = (String) options.get("userDataDir");
disableNotifications = get("disableNotifications", false);
userAgent = get("userAgent", null);
Comment on lines +172 to +173
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this too!

String place = get("userDataDir", null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted user to provide null in which case chrome would use system defaults
and not providing would default to workingDir

will this work the same way

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving workingDir like that, will create countless 'chrome_1234567890' folders inside target with zero content.

Beacause Command class will check if it exists and create one if not.

This way, workingDir and userDataDir are the same.

if (place != null) { // special case allow user-specified null
if (place.startsWith(".")){
workingDir = new File((new File(place)).getAbsolutePath());
} else{
workingDir = new File(place);
}
userDataDir = workingDir.getAbsolutePath();
} else {
workingDir = new File(FileUtils.getBuildDir() + File.separator + uniqueName);
userDataDir = workingDir.getAbsolutePath();
}
}
processLogFile = workingDir.getPath() + File.separator + type + ".log";
maxPayloadSize = get("maxPayloadSize", 4194304);
target = get("target", null);
Expand Down