Skip to content

Commit

Permalink
Remove test-specific debug class
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Jul 6, 2021
1 parent 86eeec2 commit 2d817e5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 45 deletions.
13 changes: 9 additions & 4 deletions java/client/src/org/openqa/selenium/internal/Debug.java
Expand Up @@ -26,11 +26,16 @@
*/
public class Debug {

private static final boolean IS_DEBUG;
private static boolean IS_DEBUG;
static {
IS_DEBUG = Boolean.getBoolean("selenium.webdriver.verbose") ||
// Thanks https://stackoverflow.com/a/6865049
ManagementFactory.getRuntimeMXBean().getInputArguments().toString().contains("-agentlib:jdwp");
boolean debugFlag = ManagementFactory.getRuntimeMXBean().getInputArguments().stream()
.map(str -> str.contains("-agentlib:jdwp"))
.reduce(Boolean::logicalOr)
.orElse(false);
boolean simpleProperty = Boolean.getBoolean("selenium.debug");
boolean longerProperty = Boolean.getBoolean("selenium.webdriver.verbose");

IS_DEBUG = debugFlag || simpleProperty || longerProperty;
}

private Debug() {
Expand Down
37 changes: 0 additions & 37 deletions java/client/test/org/openqa/selenium/build/Debug.java

This file was deleted.

Expand Up @@ -39,7 +39,7 @@

import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.toList;
import static org.openqa.selenium.build.Debug.isDebug;
import static org.openqa.selenium.internal.Debug.isDebugging;

public class CaptureLoggingRule implements TestRule {
@Override
Expand Down Expand Up @@ -71,7 +71,7 @@ public void evaluate() throws Throwable {
}

private List<Handler> beginLogCapture() {
if (isDebug()) {
if (isDebugging()) {
return emptyList();
}

Expand All @@ -92,7 +92,7 @@ private List<Handler> beginLogCapture() {
}

private void writeCapturedLogs() {
if (isDebug()) {
if (isDebugging()) {
return;
}

Expand All @@ -104,7 +104,7 @@ private void writeCapturedLogs() {
}

private void endLogCapture(List<Handler> handlers) {
if (isDebug()) {
if (isDebugging()) {
return;
}

Expand Down

0 comments on commit 2d817e5

Please sign in to comment.