MCPcopy Create free account
hub / github.com/google/pprof / newContext

Function newContext

browsertests/browser_test.go:114–134  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T)

Source from the content-addressed store, hash-verified

112}
113
114func newContext(ctx context.Context, t *testing.T) context.Context {
115 opts := append(chromedp.DefaultExecAllocatorOptions[:],
116 // Ubuntu 23+ enables AppArmor in a way that conflicts with Chrome's usage
117 // of unprivileged user namespaces as part of the sandboxing. Since our
118 // test does not visit any external websites, we don't really need the
119 // sandbox, so disable it.
120 chromedp.NoSandbox,
121 )
122
123 // browserDeadline is the deadline to use for browser tests. This is long to
124 // reduce flakiness in CI workflows.
125 const browserDeadline = time.Second * 90
126
127 ctx, cancel := chromedp.NewExecAllocator(ctx, opts...)
128 t.Cleanup(cancel)
129 ctx, cancel = context.WithTimeout(ctx, browserDeadline)
130 t.Cleanup(cancel)
131 ctx, cancel = chromedp.NewContext(ctx)
132 t.Cleanup(cancel)
133 return ctx
134}
135
136// matchRegexp is a chromedp.Action that fetches the text of the first
137// node that matched query and checks that the text matches regexp re.

Callers 3

TestTopTableFunction · 0.85
TestFlameGraphFunction · 0.85
TestSourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…