Look up breakpoints rather than relying on magic numbers (#19708)

* Look up breakpoints rather than relying on magic numbers

* Make breakpoint comment more obvious
diff --git a/packages/flutter_tools/test/integration/test_data/basic_project.dart b/packages/flutter_tools/test/integration/test_data/basic_project.dart
index d8cf9e4..e436d07 100644
--- a/packages/flutter_tools/test/integration/test_data/basic_project.dart
+++ b/packages/flutter_tools/test/integration/test_data/basic_project.dart
@@ -26,7 +26,7 @@
     @override
     Widget build(BuildContext context) {
       topLevelFunction();
-      return new MaterialApp(
+      return new MaterialApp( // BREAKPOINT
         title: 'Flutter Demo',
         home: new Container(),
       );
@@ -34,18 +34,13 @@
   }
 
   topLevelFunction() {
-    print("test");
+    print("topLevelFunction"); // TOP LEVEL BREAKPOINT
   }
   ''';
 
-  @override
-  String get breakpointFile => buildMethodBreakpointFile;
-  @override
-  int get breakpointLine => buildMethodBreakpointLine;
-
-  String get buildMethodBreakpointFile => fs.path.join(dir.path, 'lib', 'main.dart');
-  int get buildMethodBreakpointLine => 9;
+  String get buildMethodBreakpointFile => breakpointFile;
+  int get buildMethodBreakpointLine => breakpointLine;
 
   String get topLevelFunctionBreakpointFile => fs.path.join(dir.path, 'lib', 'main.dart');
-  int get topLevelFunctionBreakpointLine => 17;
+  int get topLevelFunctionBreakpointLine => lineContaining(main, '// TOP LEVEL BREAKPOINT');
 }
diff --git a/packages/flutter_tools/test/integration/test_data/test_project.dart b/packages/flutter_tools/test/integration/test_data/test_project.dart
index 7dfb9cf..af825d2 100644
--- a/packages/flutter_tools/test/integration/test_data/test_project.dart
+++ b/packages/flutter_tools/test/integration/test_data/test_project.dart
@@ -16,8 +16,8 @@
   String get main;
 
   // Valid locations for a breakpoint for tests that just need to break somewhere.
-  String get breakpointFile;
-  int get breakpointLine;
+  String get breakpointFile => fs.path.join(dir.path, 'lib', 'main.dart');
+  int get breakpointLine => lineContaining(main, '// BREAKPOINT');
 
   Future<void> setUpIn(Directory dir) async {
     this.dir = dir;
@@ -29,4 +29,11 @@
   void cleanup() {
     dir?.deleteSync(recursive: true);
   }
+
+  int lineContaining(String contents, String search) {
+    final int index = contents.split('\n').indexWhere((String l) => l.contains(search));
+    if (index == -1)
+      throw new Exception("Did not find '$search' inside the file");
+    return index;
+  }
 }