mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
Make the App own the Platform
Removes optional platform, which only existed for tests.
There is now a global `@import("testing.zig").test_app` available. This is setup
when the test runner starts, and cleaned up at the end of tests. Individual
tests don't have to worry about creating app, which I assume was the reason I
Platform optional, since that woul dhave been something else that needed to be
setup.
This commit is contained in:
@@ -71,7 +71,6 @@ const TestCDP = main.CDPT(struct {
|
||||
});
|
||||
|
||||
const TestContext = struct {
|
||||
app: *App,
|
||||
client: ?Client = null,
|
||||
cdp_: ?TestCDP = null,
|
||||
arena: ArenaAllocator,
|
||||
@@ -80,7 +79,6 @@ const TestContext = struct {
|
||||
if (self.cdp_) |*c| {
|
||||
c.deinit();
|
||||
}
|
||||
self.app.deinit();
|
||||
self.arena.deinit();
|
||||
}
|
||||
|
||||
@@ -89,7 +87,7 @@ const TestContext = struct {
|
||||
self.client = Client.init(self.arena.allocator());
|
||||
// Don't use the arena here. We want to detect leaks in CDP.
|
||||
// The arena is only for test-specific stuff
|
||||
self.cdp_ = TestCDP.init(self.app, &self.client.?) catch unreachable;
|
||||
self.cdp_ = TestCDP.init(base.test_app, &self.client.?) catch unreachable;
|
||||
}
|
||||
return &self.cdp_.?;
|
||||
}
|
||||
@@ -221,7 +219,6 @@ const TestContext = struct {
|
||||
|
||||
pub fn context() TestContext {
|
||||
return .{
|
||||
.app = App.init(std.testing.allocator, .{ .run_mode = .serve }) catch unreachable,
|
||||
.arena = ArenaAllocator.init(std.testing.allocator),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user