1// Copyright 2018 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5// Integration tests which invoke flutter instead of unit testing the code 6// will not produce meaningful coverage information - we can measure coverage 7// from the isolate running the test, but not from the isolate started via 8// the command line process. 9@Tags(<String>['no_coverage']) 10import 'package:file/file.dart'; 11import 'package:flutter_tools/src/base/file_system.dart'; 12 13import '../src/common.dart'; 14import 'test_data/stepping_project.dart'; 15import 'test_driver.dart'; 16import 'test_utils.dart'; 17 18void main() { 19 group('debugger', () { 20 Directory tempDir; 21 final SteppingProject _project = SteppingProject(); 22 FlutterRunTestDriver _flutter; 23 24 setUp(() async { 25 tempDir = createResolvedTempDirectorySync('debugger_stepping_test.'); 26 await _project.setUpIn(tempDir); 27 _flutter = FlutterRunTestDriver(tempDir); 28 }); 29 30 tearDown(() async { 31 await _flutter.stop(); 32 tryToDelete(tempDir); 33 }); 34 35 test('can step over statements', () async { 36 await _flutter.run(withDebugger: true, startPaused: true); 37 await _flutter.addBreakpoint(_project.breakpointUri, _project.breakpointLine); 38 await _flutter.resume(); 39 await _flutter.waitForPause(); // Now we should be on the breakpoint. 40 41 expect((await _flutter.getSourceLocation()).line, equals(_project.breakpointLine)); 42 43 // Issue 5 steps, ensuring that we end up on the annotated lines each time. 44 for (int i = 1; i <= _project.numberOfSteps; i += 1) { 45 await _flutter.stepOverOrOverAsyncSuspension(); 46 final SourcePosition location = await _flutter.getSourceLocation(); 47 final int actualLine = location.line; 48 49 // Get the line we're expected to stop at by searching for the comment 50 // within the source code. 51 final int expectedLine = _project.lineForStep(i); 52 53 expect(actualLine, equals(expectedLine), 54 reason: 'After $i steps, debugger should stop at $expectedLine but stopped at $actualLine'); 55 } 56 }); 57 }, timeout: const Timeout.factor(10), tags: <String>['integration']); // The DevFS sync takes a really long time, so these tests can be slow. 58} 59