mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
fix unit testing with platform deps requirement
This commit is contained in:
@@ -274,12 +274,20 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn pumpMessageLoop(self: *const Self) bool {
|
pub fn pumpMessageLoop(self: *const Self) bool {
|
||||||
if (self.platform == null) return false;
|
if (self.platform == null) {
|
||||||
|
// In test mode only, platform can be null.
|
||||||
|
if (builtin.is_test) return false;
|
||||||
|
@panic("platform is null");
|
||||||
|
}
|
||||||
return self.platform.?.inner.pumpMessageLoop(self.isolate, false);
|
return self.platform.?.inner.pumpMessageLoop(self.isolate, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn runIdleTasks(self: *const Self) void {
|
pub fn runIdleTasks(self: *const Self) void {
|
||||||
if (self.platform == null) return;
|
if (self.platform == null) {
|
||||||
|
// In test mode only, platform can be null.
|
||||||
|
if (builtin.is_test) return;
|
||||||
|
@panic("platform is null");
|
||||||
|
}
|
||||||
return self.platform.?.inner.runIdleTasks(self.isolate, 1);
|
return self.platform.?.inner.runIdleTasks(self.isolate, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ pub fn Runner(comptime State: type, comptime Global: type, comptime types: anyty
|
|||||||
const self = try allocator.create(Self);
|
const self = try allocator.create(Self);
|
||||||
errdefer allocator.destroy(self);
|
errdefer allocator.destroy(self);
|
||||||
|
|
||||||
self.env = try Env.init(allocator, .{});
|
self.env = try Env.init(allocator, null, .{});
|
||||||
errdefer self.env.deinit();
|
errdefer self.env.deinit();
|
||||||
|
|
||||||
self.executor = try self.env.newExecutionWorld();
|
self.executor = try self.env.newExecutionWorld();
|
||||||
|
|||||||
Reference in New Issue
Block a user