Add integration test for the Platform Services app (#8826)

diff --git a/dev/devicelab/bin/tasks/platform_services_test.dart b/dev/devicelab/bin/tasks/platform_services_test.dart
new file mode 100644
index 0000000..d1afc67
--- /dev/null
+++ b/dev/devicelab/bin/tasks/platform_services_test.dart
@@ -0,0 +1,14 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:flutter_devicelab/tasks/perf_tests.dart';
+import 'package:flutter_devicelab/framework/adb.dart';
+import 'package:flutter_devicelab/framework/framework.dart';
+
+Future<Null> main() async {
+  deviceOperatingSystem = DeviceOperatingSystem.android;
+  await task(createPlatformServiceDriverTest());
+}
diff --git a/dev/devicelab/bin/tasks/platform_services_test_ios.dart b/dev/devicelab/bin/tasks/platform_services_test_ios.dart
new file mode 100644
index 0000000..07760fb
--- /dev/null
+++ b/dev/devicelab/bin/tasks/platform_services_test_ios.dart
@@ -0,0 +1,14 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:flutter_devicelab/tasks/perf_tests.dart';
+import 'package:flutter_devicelab/framework/adb.dart';
+import 'package:flutter_devicelab/framework/framework.dart';
+
+Future<Null> main() async {
+  deviceOperatingSystem = DeviceOperatingSystem.ios;
+  await task(createPlatformServiceDriverTest());
+}
diff --git a/dev/devicelab/lib/tasks/perf_tests.dart b/dev/devicelab/lib/tasks/perf_tests.dart
index d8c18f3..440f78b 100644
--- a/dev/devicelab/lib/tasks/perf_tests.dart
+++ b/dev/devicelab/lib/tasks/perf_tests.dart
@@ -9,6 +9,14 @@
 import '../framework/framework.dart';
 import '../framework/utils.dart';
 
+
+TaskFunction createPlatformServiceDriverTest() {
+  return new DriverTest(
+      '${flutterDirectory.path}/examples/platform_services',
+      'test_driver/button_tap.dart',
+  );
+}
+
 TaskFunction createComplexLayoutScrollPerfTest() {
   return new PerfTest(
     '${flutterDirectory.path}/dev/benchmarks/complex_layout',
@@ -152,6 +160,39 @@
   }
 }
 
+
+class DriverTest {
+
+  DriverTest(this.testDirectory, this.testTarget);
+
+  final String testDirectory;
+  final String testTarget;
+
+  Future<TaskResult> call() {
+    return inDirectory(testDirectory, () async {
+      final Device device = await devices.workingDevice;
+      await device.unlock();
+      final String deviceId = device.deviceId;
+      await flutter('packages', options: <String>['get']);
+
+      if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
+        // This causes an Xcode project to be created.
+        await flutter('build', options: <String>['ios', '--profile']);
+      }
+
+      await flutter('drive', options: <String>[
+        '-v',
+        '-t',
+        testTarget,
+        '-d',
+        deviceId,
+      ]);
+
+      return new TaskResult.success(null);
+    });
+  }
+}
+
 class BuildTest {
 
   BuildTest(this.testDirectory);
diff --git a/dev/devicelab/manifest.yaml b/dev/devicelab/manifest.yaml
index 8830c5c..8561cf2 100644
--- a/dev/devicelab/manifest.yaml
+++ b/dev/devicelab/manifest.yaml
@@ -83,6 +83,12 @@
     stage: devicelab
     required_agent_capabilities: ["has-android-device"]
 
+  platform_services_test:
+    description: >
+     Runs a driver test on the Platform Services sample app on Android.
+    stage: devicelab
+    required_agent_capabilities: ["has-android-device"]
+
   flutter_gallery__start_up:
     description: >
       Measures the startup time of the Flutter Gallery app on Android.
@@ -138,9 +144,14 @@
     stage: devicelab
     required_agent_capabilities: ["has-android-device"]
 
-
   # iOS on-device tests
 
+  platform_services_test_ios:
+    description: >
+      Runs a driver test on the Platform Services sample app on iOS.
+    stage: devicelab_ios
+    required_agent_capabilities: ["has-ios-device"]
+
   complex_layout_scroll_perf_ios__timeline_summary:
     description: >
       Measures the runtime performance of the Complex Layout sample app on