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

Function eval

browsertests/browser_test.go:183–201  ·  view source on GitHub ↗

eval runs the specified javascript in the browser. The javascript must return an [][]any, where each of the []any starts with either "LOG" or "ERROR" (see testdata/testfixture.js).

(t *testing.T, js string)

Source from the content-addressed store, hash-verified

181// return an [][]any, where each of the []any starts with either "LOG" or
182// "ERROR" (see testdata/testfixture.js).
183func eval(t *testing.T, js string) chromedp.ActionFunc {
184 return func(ctx context.Context) error {
185 var result [][]any
186 err := chromedp.Evaluate(js, &result).Do(ctx)
187 if err != nil {
188 return err
189 }
190 for _, s := range result {
191 if len(s) > 0 && s[0] == "LOG" {
192 t.Log(s[1:]...)
193 } else if len(s) > 0 && s[0] == "ERROR" {
194 t.Error(s[1:]...)
195 } else {
196 t.Error(s...) // Treat missing prefix as an error.
197 }
198 }
199 return nil
200 }
201}
202
203//go:embed testdata/testfixture.js
204var jsTestFixture string

Callers 1

TestFlameGraphFunction · 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…