Skip to content

Commit

Permalink
Fixing compilation error in PerformanceLoggingTest
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Sep 22, 2017
1 parent 0530de0 commit c9b7c73
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,21 @@
import static org.openqa.selenium.testing.Driver.PHANTOMJS;
import static org.openqa.selenium.testing.Driver.SAFARI;

import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;

import org.junit.After;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.ImmutableCapabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.logging.profiler.EventType;
import org.openqa.selenium.testing.Ignore;
import org.openqa.selenium.testing.JUnit4TestBase;
import org.openqa.selenium.testing.drivers.WebDriverBuilder;

import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

@Ignore(HTMLUNIT)
@Ignore(IE)
Expand Down Expand Up @@ -118,7 +117,7 @@ public void testGetsYieldToPageLoadLogEntries() throws Exception {
private void startLoggingDriver() {
if (loggingDriver == null) {
WebDriverBuilder builder = new WebDriverBuilder().setDesiredCapabilities(
getCapabilitiesWithProfilerOn(true));
new ImmutableCapabilities(ENABLE_PROFILING_CAPABILITY, true));
loggingDriver = builder.get();
}
}
Expand All @@ -129,16 +128,7 @@ private LogEntries getProfilerEntries(WebDriver driver) {

private ImmutableList<LogEntry> getProfilerEntriesOfType(final LogEntries entries,
final EventType eventType) {
return ImmutableList.copyOf(Iterables.filter(entries, new Predicate<LogEntry>() {
public boolean apply(LogEntry entry) {
return entry.getMessage().contains(eventType.toString());
}
}));
}

private static Capabilities getCapabilitiesWithProfilerOn(boolean enabled) {
FirefoxOptions options = new FirefoxOptions();
options.setCapability(ENABLE_PROFILING_CAPABILITY, enabled);
return options;
return ImmutableList.copyOf(StreamSupport.stream(entries.spliterator(), false).filter(
entry -> entry.getMessage().contains(eventType.toString())).collect(Collectors.toList()));
}
}

0 comments on commit c9b7c73

Please sign in to comment.