chore(bootstrap): remove webkit_stack_test.go (functions moved to webkit/engine_init.go)
- commit
- d0fe704aebec0992e075e96fee2df93f603ce837
- author
- brice · · 2026-03-15 17:57 UTC
- parent
- 7f9d755
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +0 -55
D internal/bootstrap/webkit_stack_test.go +0 -55
| @@ -1,55 +0,0 @@ | |||
| 1 | - | package bootstrap | |
| 2 | - | ||
| 3 | - | import ( | |
| 4 | - | "testing" | |
| 5 | - | ||
| 6 | - | "github.com/bnema/dumber/internal/application/port" | |
| 7 | - | "github.com/bnema/dumber/internal/infrastructure/config" | |
| 8 | - | "github.com/jwijenbergh/puregotk/v4/gdk" | |
| 9 | - | "github.com/stretchr/testify/assert" | |
| 10 | - | "github.com/stretchr/testify/require" | |
| 11 | - | ) | |
| 12 | - | ||
| 13 | - | func TestBuildWebKitContextOptions_MapsPrivacyAndMemory(t *testing.T) { | |
| 14 | - | cfg := config.DefaultConfig() | |
| 15 | - | cfg.Privacy.CookiePolicy = config.CookiePolicyNever | |
| 16 | - | cfg.Privacy.ITPEnabled = false | |
| 17 | - | ||
| 18 | - | perf := &config.ResolvedPerformanceSettings{ | |
| 19 | - | WebProcessMemoryLimitMB: 1024, | |
| 20 | - | WebProcessMemoryPollIntervalSec: 11, | |
| 21 | - | WebProcessMemoryConservativeThreshold: 0.25, | |
| 22 | - | WebProcessMemoryStrictThreshold: 0.5, | |
| 23 | - | NetworkProcessMemoryLimitMB: 512, | |
| 24 | - | NetworkProcessMemoryPollIntervalSec: 13, | |
| 25 | - | } | |
| 26 | - | ||
| 27 | - | opts := buildWebKitContextOptions(cfg, "/tmp/data", "/tmp/cache", perf) | |
| 28 | - | ||
| 29 | - | assert.Equal(t, "/tmp/data", opts.DataDir) | |
| 30 | - | assert.Equal(t, "/tmp/cache", opts.CacheDir) | |
| 31 | - | assert.Equal(t, port.WebKitCookiePolicyNever, opts.CookiePolicy) | |
| 32 | - | assert.False(t, opts.ITPEnabled) | |
| 33 | - | ||
| 34 | - | require.NotNil(t, opts.WebProcessMemory) | |
| 35 | - | assert.Equal(t, 1024, opts.WebProcessMemory.MemoryLimitMB) | |
| 36 | - | assert.InDelta(t, 11.0, opts.WebProcessMemory.PollIntervalSec, 1e-9) | |
| 37 | - | assert.InDelta(t, 0.25, opts.WebProcessMemory.ConservativeThreshold, 1e-9) | |
| 38 | - | assert.InDelta(t, 0.5, opts.WebProcessMemory.StrictThreshold, 1e-9) | |
| 39 | - | ||
| 40 | - | require.NotNil(t, opts.NetworkProcessMemory) | |
| 41 | - | assert.Equal(t, 512, opts.NetworkProcessMemory.MemoryLimitMB) | |
| 42 | - | assert.InDelta(t, 13.0, opts.NetworkProcessMemory.PollIntervalSec, 1e-9) | |
| 43 | - | } | |
| 44 | - | ||
| 45 | - | func TestBuildWebKitContextOptions_DefaultPrivacyWhenConfigNil(t *testing.T) { | |
| 46 | - | opts := buildWebKitContextOptions(nil, "/tmp/data", "/tmp/cache", &config.ResolvedPerformanceSettings{}) | |
| 47 | - | ||
| 48 | - | assert.Equal(t, port.WebKitCookiePolicyNoThirdParty, opts.CookiePolicy) | |
| 49 | - | assert.True(t, opts.ITPEnabled) | |
| 50 | - | } | |
| 51 | - | ||
| 52 | - | func TestShouldPrewarmFirstWebView(t *testing.T) { | |
| 53 | - | assert.False(t, shouldPrewarmFirstWebView(nil)) | |
| 54 | - | assert.True(t, shouldPrewarmFirstWebView(&gdk.Display{})) | |
| 55 | - | } | |
| @@ -1,55 +0,0 @@ | |||||
| 1 | - | package bootstrap | |||
| 2 | - | ||||
| 3 | - | import ( | |||
| 4 | - | "testing" | |||
| 5 | - | ||||
| 6 | - | "github.com/bnema/dumber/internal/application/port" | |||
| 7 | - | "github.com/bnema/dumber/internal/infrastructure/config" | |||
| 8 | - | "github.com/jwijenbergh/puregotk/v4/gdk" | |||
| 9 | - | "github.com/stretchr/testify/assert" | |||
| 10 | - | "github.com/stretchr/testify/require" | |||
| 11 | - | ) | |||
| 12 | - | ||||
| 13 | - | func TestBuildWebKitContextOptions_MapsPrivacyAndMemory(t *testing.T) { | |||
| 14 | - | cfg := config.DefaultConfig() | |||
| 15 | - | cfg.Privacy.CookiePolicy = config.CookiePolicyNever | |||
| 16 | - | cfg.Privacy.ITPEnabled = false | |||
| 17 | - | ||||
| 18 | - | perf := &config.ResolvedPerformanceSettings{ | |||
| 19 | - | WebProcessMemoryLimitMB: 1024, | |||
| 20 | - | WebProcessMemoryPollIntervalSec: 11, | |||
| 21 | - | WebProcessMemoryConservativeThreshold: 0.25, | |||
| 22 | - | WebProcessMemoryStrictThreshold: 0.5, | |||
| 23 | - | NetworkProcessMemoryLimitMB: 512, | |||
| 24 | - | NetworkProcessMemoryPollIntervalSec: 13, | |||
| 25 | - | } | |||
| 26 | - | ||||
| 27 | - | opts := buildWebKitContextOptions(cfg, "/tmp/data", "/tmp/cache", perf) | |||
| 28 | - | ||||
| 29 | - | assert.Equal(t, "/tmp/data", opts.DataDir) | |||
| 30 | - | assert.Equal(t, "/tmp/cache", opts.CacheDir) | |||
| 31 | - | assert.Equal(t, port.WebKitCookiePolicyNever, opts.CookiePolicy) | |||
| 32 | - | assert.False(t, opts.ITPEnabled) | |||
| 33 | - | ||||
| 34 | - | require.NotNil(t, opts.WebProcessMemory) | |||
| 35 | - | assert.Equal(t, 1024, opts.WebProcessMemory.MemoryLimitMB) | |||
| 36 | - | assert.InDelta(t, 11.0, opts.WebProcessMemory.PollIntervalSec, 1e-9) | |||
| 37 | - | assert.InDelta(t, 0.25, opts.WebProcessMemory.ConservativeThreshold, 1e-9) | |||
| 38 | - | assert.InDelta(t, 0.5, opts.WebProcessMemory.StrictThreshold, 1e-9) | |||
| 39 | - | ||||
| 40 | - | require.NotNil(t, opts.NetworkProcessMemory) | |||
| 41 | - | assert.Equal(t, 512, opts.NetworkProcessMemory.MemoryLimitMB) | |||
| 42 | - | assert.InDelta(t, 13.0, opts.NetworkProcessMemory.PollIntervalSec, 1e-9) | |||
| 43 | - | } | |||
| 44 | - | ||||
| 45 | - | func TestBuildWebKitContextOptions_DefaultPrivacyWhenConfigNil(t *testing.T) { | |||
| 46 | - | opts := buildWebKitContextOptions(nil, "/tmp/data", "/tmp/cache", &config.ResolvedPerformanceSettings{}) | |||
| 47 | - | ||||
| 48 | - | assert.Equal(t, port.WebKitCookiePolicyNoThirdParty, opts.CookiePolicy) | |||
| 49 | - | assert.True(t, opts.ITPEnabled) | |||
| 50 | - | } | |||
| 51 | - | ||||
| 52 | - | func TestShouldPrewarmFirstWebView(t *testing.T) { | |||
| 53 | - | assert.False(t, shouldPrewarmFirstWebView(nil)) | |||
| 54 | - | assert.True(t, shouldPrewarmFirstWebView(&gdk.Display{})) | |||
| 55 | - | } | |||