Merge pull request #3625 from lightpanda-io/speed-up-slow-tests

dev: speed up some slow tests
This commit is contained in:
Karl Seguin authored and GitHub committed 2026-09-24 15:28:48 +08:00
commit 7e2fcec7c7
2 files changed
+13 -3

No files matched your search

@@ -1 +1 @@
<!doctype html><title>Parent jobs</title><iframe src="/redirect-cross-origin/src/browser/tests/cdp/isolated_world_one.html?delay_ms=1000"></iframe>
<!doctype html><title>Parent jobs</title><iframe src="/redirect-cross-origin/src/browser/tests/cdp/isolated_world_one.html?delay_ms=300"></iframe>
+12 -2
View File
@@ -2496,9 +2496,16 @@ test "server: HTTP execute script" {
// selenium/http/demo.js in ../demo is what actually catches it.
const late = try executeRaw(&c, &session_id, "async", "var cb = arguments[0]; setTimeout(function() { window.__late = true; cb('way late'); }, 150);", "[]");
try testing.expect(std.mem.indexOf(u8, late, "\"error\":\"script timeout\"") != null);
lp.io.sleep(.fromMilliseconds(400), .awake) catch {};
// the assertion only means anything if the stale resolve actually ran
try testing.expectEqual("{\"value\":true}", try executeSync(&c, &session_id, "return window.__late === true;", "[]"));
var ran = false;
for (0..200) |_| {
if (std.mem.eql(u8, "{\"value\":true}", try executeSync(&c, &session_id, "return window.__late === true;", "[]"))) {
ran = true;
break;
}
lp.io.sleep(.fromMilliseconds(10), .awake) catch {};
}
try testing.expect(ran);
try testing.expectEqual("{\"value\":\"alive\"}", try executeSync(&c, &session_id, "return 'alive';", "[]"));
}
@@ -3112,6 +3119,9 @@ fn createTestClient() !TestClient {
});
try posix.setsockopt(socket, posix.SOL.SOCKET, posix.SO.RCVTIMEO, &timeout);
try posix.setsockopt(socket, posix.SOL.SOCKET, posix.SO.SNDTIMEO, &timeout);
if (@hasDecl(posix.TCP, "NODELAY")) {
try posix.setsockopt(socket, posix.IPPROTO.TCP, posix.TCP.NODELAY, &std.mem.toBytes(@as(c_int, 1)));
}
return .{
.socket = socket,
.reader = .{