Fixing compilation error in PerformanceLoggingTest
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)
@@ -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();
}
}
@@ -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()));
}
}
