MCPcopy Create free account
hub / github.com/google/gapid / TestStateTreeNode

Function TestStateTreeNode

gapis/resolve/state_tree_test.go:196–629  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

194 }
195}
196func TestStateTreeNode(t *testing.T) {
197 ctx := log.Testing(t)
198 ctx = database.Put(ctx, database.NewInMemory(ctx))
199 header := capture.Header{ABI: device.AndroidARM64v8a}
200 cap, err := capture.NewGraphicsCapture(ctx, arena.New(), "test-capture", &header, nil, []api.Cmd{})
201 if err != nil {
202 panic(err)
203 }
204 c, err := cap.Path(ctx)
205 if err != nil {
206 panic(err)
207 }
208 ctx = capture.Put(ctx, c)
209 rootPath := c.Command(0).StateAfter()
210 gs, err := capture.NewState(ctx)
211 if err != nil {
212 panic(err)
213 }
214 tree := &stateTree{
215 globalState: gs,
216 root: &stn{
217 name: "root",
218 value: reflect.ValueOf(testState),
219 path: rootPath,
220 },
221 api: &path.API{ID: path.NewID(id.ID(test.API{}.ID()))},
222 groupLimit: 10,
223 }
224 root := &path.StateTreeNode{Indices: []uint64{}}
225
226 // Write some data to 0x1000.
227 e := gs.MemoryEncoder(memory.ApplicationPool, memory.Range{Base: 0x1000, Size: 0x8000})
228 for i := 0; i < 0x1000; i++ {
229 e.I64(int64(i * 10))
230 }
231
232 for _, test := range []struct {
233 path *path.StateTreeNode
234 expected *service.StateTreeNode
235 }{
236 {
237 root,
238 &service.StateTreeNode{
239 NumChildren: 7,
240 Name: "root",
241 ValuePath: rootPath.Path(),
242 },
243 }, {
244 root.Index(0), // 0
245 &service.StateTreeNode{
246 NumChildren: 0,
247 Name: "Bool",
248 ValuePath: rootPath.Field("Bool").Path(),
249 Preview: box.NewValue(true),
250 PreviewIsValue: true,
251 },
252 }, {
253 root.Index(1), // 1

Callers

nothing calls this directly

Calls 15

PathMethod · 0.95
IndexMethod · 0.95
stateTreeNodeFunction · 0.85
stateTreeNodePathFunction · 0.85
StateAfterMethod · 0.80
NewStateMethod · 0.80
MemoryEncoderMethod · 0.80
SucceededMethod · 0.80
ThatErrorMethod · 0.80
ForMethod · 0.80
ThatMethod · 0.80
ThatSliceMethod · 0.80

Tested by

no test coverage detected