Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions java/src/org/openqa/selenium/concurrent/Lazy.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public T get() {
if (value == null) {
try {
value = supplier.get();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new InitializationException(e);
Comment thread
VietND96 marked this conversation as resolved.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assumptions.assumeThat;
import static org.openqa.selenium.testing.drivers.Browser.CHROME;
import static org.openqa.selenium.testing.drivers.Browser.EDGE;

import java.util.List;
import java.util.Map;
Expand All @@ -33,7 +32,6 @@
import org.openqa.selenium.bidi.module.Browser;
import org.openqa.selenium.testing.JupiterTestBase;
import org.openqa.selenium.testing.NeedsFreshDriver;
import org.openqa.selenium.testing.NotYetImplemented;
import org.openqa.selenium.testing.TestUtilities;

class SetScreenSettingsOverrideTest extends JupiterTestBase {
Expand All @@ -48,7 +46,6 @@ private Dimension getScreenDimensions(String context) {

@Test
@NeedsFreshDriver
@NotYetImplemented(EDGE)
void canSetScreenSettingsOverrideInContext() {
if (org.openqa.selenium.testing.drivers.Browser.detect() == CHROME) {
assumeThat(TestUtilities.getChromeVersion(driver)).isGreaterThanOrEqualTo(146);
Expand Down Expand Up @@ -82,7 +79,6 @@ void canSetScreenSettingsOverrideInContext() {

@Test
@NeedsFreshDriver
@NotYetImplemented(EDGE)
void canSetScreenSettingsOverrideInUserContext() {
if (org.openqa.selenium.testing.drivers.Browser.detect() == CHROME) {
assumeThat(TestUtilities.getChromeVersion(driver)).isGreaterThanOrEqualTo(146);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import static org.mockito.Mockito.when;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -128,11 +130,20 @@ void stopWithoutVideo_logsAndBrowserContainerStopped() throws Exception {
@Test
void stop_logsWrittenBeforeBrowserContainerStopped() throws Exception {
byte[] logBytes = "INFO: Session started\nINFO: Session ended\n".getBytes();
// Docker multiplexed stream format: [stream-type(1)][padding(3)][payload-size(4)][payload]
ByteArrayOutputStream buf = new ByteArrayOutputStream();
DataOutputStream header = new DataOutputStream(buf);
header.writeByte(1); // stdout
header.write(new byte[3]); // padding
header.writeInt(logBytes.length);
header.flush();
buf.write(logBytes);
byte[] multiplexed = buf.toByteArray();
when(browserContainer.getLogs())
.thenReturn(
new ContainerLogs(
new ContainerId("browser-id"),
Contents.fromStream(new ByteArrayInputStream(logBytes), logBytes.length)));
Contents.fromStream(new ByteArrayInputStream(multiplexed), multiplexed.length)));

// saveLogs() writes to sessionAssetsPath/selenium-server.log; parent dir must exist
Path sessionDir = tempDir.resolve(sessionId.toString());
Expand Down
Loading