Do not show source links in CPU profile when offline (#6769)
* Do not show source links in CPU profile when offline
* fix test
diff --git a/packages/devtools_app/lib/src/shared/profiler_utils.dart b/packages/devtools_app/lib/src/shared/profiler_utils.dart
index c6ad978..6f858ce 100644
--- a/packages/devtools_app/lib/src/shared/profiler_utils.dart
+++ b/packages/devtools_app/lib/src/shared/profiler_utils.dart
@@ -277,7 +277,8 @@
final sourceDisplay = '($packageUriWithSourceLine)';
final script = scriptManager.scriptRefForUri(packageUri);
- final showSourceAsLink = script != null;
+ final showSourceAsLink =
+ script != null && !offlineController.offlineMode.value;
if (showSourceAsLink) {
sourceTextSpans.add(
VmServiceObjectLink(
diff --git a/packages/devtools_app/test/cpu_profiler/method_table/method_table_test.dart b/packages/devtools_app/test/cpu_profiler/method_table/method_table_test.dart
index 6a385c2..55f2144 100644
--- a/packages/devtools_app/test/cpu_profiler/method_table/method_table_test.dart
+++ b/packages/devtools_app/test/cpu_profiler/method_table/method_table_test.dart
@@ -30,6 +30,7 @@
createMockServiceConnectionWithDefaults(),
);
setGlobal(IdeTheme, IdeTheme());
+ setGlobal(OfflineModeController, OfflineModeController());
final mockScriptManager = MockScriptManager();
when(mockScriptManager.sortedScripts).thenReturn(
ValueNotifier<List<ScriptRef>>([]),