Skip to content

Commit f29a5bd

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored andcommitted
RPP: Add test for AICallTree setFlavor integration
Bug: none Change-Id: Ib611461992cdf99ecee335afb2754321dc64fe44 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6197939 Reviewed-by: Andres Olivares <[email protected]> Commit-Queue: Andres Olivares <[email protected]> Commit-Queue: Jack Franklin <[email protected]> Auto-Submit: Jack Franklin <[email protected]>
1 parent 2f6558f commit f29a5bd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

front_end/panels/timeline/TimelineFlameChartView.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import * as PerfUI from '../../ui/legacy/components/perf_ui/perf_ui.js';
1313
import * as UI from '../../ui/legacy/legacy.js';
1414

1515
import * as Timeline from './timeline.js';
16+
import * as Utils from './utils/utils.js';
1617

1718
const {urlString} = Platform.DevToolsPath;
1819

@@ -778,6 +779,27 @@ describeWithEnvironment('TimelineFlameChartView', function() {
778779
});
779780
});
780781

782+
describe('updating the active AI call tree', () => {
783+
it('updates the UI Context with the active AI Call tree for the selected event', async function() {
784+
const {parsedTrace, metadata} = await TraceLoader.traceEngine(this, 'web-dev-with-commit.json.gz');
785+
const mockViewDelegate = new MockViewDelegate();
786+
const flameChartView = new Timeline.TimelineFlameChartView.TimelineFlameChartView(mockViewDelegate);
787+
flameChartView.setModel(parsedTrace, metadata);
788+
// Find some task in the main thread that we can build an AI Call Tree from
789+
const task = parsedTrace.Renderer.allTraceEntries.find(event => {
790+
return Trace.Types.Events.isRunTask(event) && event.dur > 5_000 &&
791+
Utils.AICallTree.AICallTree.from(event, parsedTrace) !== null;
792+
});
793+
794+
assert.isOk(task);
795+
UI.Context.Context.instance().setFlavor(Utils.AICallTree.AICallTree, null);
796+
const selection = Timeline.TimelineSelection.selectionFromEvent(task);
797+
flameChartView.setSelectionAndReveal(selection);
798+
const flavor = UI.Context.Context.instance().flavor(Utils.AICallTree.AICallTree);
799+
assert.instanceOf(flavor, Utils.AICallTree.AICallTree);
800+
});
801+
});
802+
781803
describe('Link between entries annotation in progress', function() {
782804
let flameChartView: Timeline.TimelineFlameChartView.TimelineFlameChartView;
783805
let parsedTrace: Trace.Handlers.Types.ParsedTrace;

0 commit comments

Comments
 (0)