class FakeGraph
Defined at line 226 of file ../../src/media/audio/services/mixer/fidl/testing/fake_graph.h
This class makes it easy to create graphs of FakeNodes during tests. For example, the following
code:
```
auto graph = FakeGraph::Create({
.meta_nodes = {
{1, {
.source_children = {2, 3},
.dest_children = {4, 5},
}},
},
.edges = {
{0, 2},
{4, 6},
{5, 7},
},
});
```
Creates a graph that looks like:
```
0
|
+-V-----+
| 2 3 |
| 1 |
| 4 5 |
+-|---|-+
V V
6 7
```
The destructor deletes all edges (to remove circular references) and drops all references to
FakeNodes that were created by this FakeGraph.
Not safe for concurrent use.
Public Methods
void FakeGraph (Args args)
Defined at line 104 of file ../../src/media/audio/services/mixer/fidl/testing/fake_graph.cc
void ~FakeGraph ()
Defined at line 197 of file ../../src/media/audio/services/mixer/fidl/testing/fake_graph.cc
FakeGraphThreadPtr CreateThread (std::optional<ThreadId> id)
Creates a thread with the given `id`.
If `id` is unspecified, an `id` is selected automatically.
Defined at line 222 of file ../../src/media/audio/services/mixer/fidl/testing/fake_graph.cc
FakeNodePtr CreateMetaNode (std::optional<NodeId> id)
Creates a meta node or return the node if the `id` already exists.
It is illegal to call CreateMetaNode and CreateOrdinaryNode with the same `id`.
If `id` is unspecified, an `id` is selected automatically.
Defined at line 231 of file ../../src/media/audio/services/mixer/fidl/testing/fake_graph.cc
FakeNodePtr CreateOrdinaryNode (std::optional<NodeId> id, FakeNodePtr parent, Node::Type type)
Creates an ordinary node or return the node if `id` already exists.
It is illegal to call CreateMetaNode and CreateOrdinaryNode with the same `id`.
If `id` is unspecified, an `id` is selected automatically.
If `parent` is specified and `id` already exists, the given `parent` must match the old parent.
Defined at line 248 of file ../../src/media/audio/services/mixer/fidl/testing/fake_graph.cc
FakeGraphThreadPtr thread (ThreadId id)
Returns the thread with the given ID.
Must exist.
Defined at line 300 of file ../../src/media/audio/services/mixer/fidl/testing/fake_graph.h
FakeNodePtr node (NodeId id)
Returns the node with the given ID.
Must exist.
Defined at line 308 of file ../../src/media/audio/services/mixer/fidl/testing/fake_graph.h
const Node::GraphContext & ctx ()
Returns the graph context.
Defined at line 315 of file ../../src/media/audio/services/mixer/fidl/testing/fake_graph.h
std::shared_ptr<GlobalTaskQueue> global_task_queue ()
Returns the task queue used by this FakeGraph.
Defined at line 318 of file ../../src/media/audio/services/mixer/fidl/testing/fake_graph.h