|
2 | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | 3 | // found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. |
4 | 4 |
|
| 5 | +import 'dart:convert'; |
| 6 | +import 'dart:io'; |
| 7 | + |
5 | 8 | import 'package:devtools_app/src/screens/profiler/cpu_profile_model.dart'; |
| 9 | +import 'package:devtools_app/src/screens/profiler/cpu_profile_service.dart'; |
6 | 10 | import 'package:devtools_app/src/service/service_manager.dart'; |
| 11 | +import 'package:devtools_app/src/shared/globals.dart'; |
7 | 12 | import 'package:devtools_app/src/shared/primitives/utils.dart'; |
8 | 13 | import 'package:devtools_app_shared/utils.dart'; |
9 | 14 | import 'package:devtools_test/devtools_test.dart'; |
@@ -40,6 +45,27 @@ void main() { |
40 | 45 | expect(filtered.profileMetaData.time!.end, 0); |
41 | 46 | }); |
42 | 47 |
|
| 48 | + // Regression test for https://github.com/flutter/devtools/issues/9526. |
| 49 | + test( |
| 50 | + 'code profile loads in advanced developer mode (regression test)', |
| 51 | + () async { |
| 52 | + final cpuSamplesFile = File( |
| 53 | + 'test/test_infra/test_data/cpu_profiler/cpu_samples_with_code_profile.json', |
| 54 | + ); |
| 55 | + final cpuSamplesJson = jsonDecode(cpuSamplesFile.readAsStringSync()); |
| 56 | + final cpuSamples = CpuSamples.parse(cpuSamplesJson)!; |
| 57 | + |
| 58 | + final profilePair = await serviceConnection.serviceManager.service! |
| 59 | + .processCpuSamples( |
| 60 | + cpuSamples: cpuSamples, |
| 61 | + isolateId: goldenSamplesIsolate, |
| 62 | + advancedDeveloperModeEnabled: true, |
| 63 | + ); |
| 64 | + expect(profilePair.codeProfile, isNotNull); |
| 65 | + expect(profilePair.functionProfile, isNotNull); |
| 66 | + }, |
| 67 | + ); |
| 68 | + |
43 | 69 | test('init from parse', () { |
44 | 70 | expect( |
45 | 71 | cpuProfileData.stackFramesJson, |
|
0 commit comments