|
2 | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | 3 | // found in the LICENSE file. |
4 | 4 |
|
| 5 | +import 'dart:async'; |
| 6 | + |
5 | 7 | import 'package:flutter_devicelab/framework/runner.dart'; |
6 | 8 | import 'package:flutter_devicelab/framework/task_result.dart'; |
7 | 9 |
|
@@ -43,6 +45,30 @@ void main() { |
43 | 45 | expect(result.data['benchmark'], 'data'); |
44 | 46 | }); |
45 | 47 |
|
| 48 | + test('sets environment', () async { |
| 49 | + final StringBuffer capturedPrintLines = StringBuffer(); |
| 50 | + await runZoned<Future<void>>( |
| 51 | + () async { |
| 52 | + await runTask( |
| 53 | + 'smoke_test_build_test', |
| 54 | + taskArgs: <String>['--test'], |
| 55 | + deviceId: 'FAKE_SUCCESS', |
| 56 | + isolateParams: isolateParams, |
| 57 | + ); |
| 58 | + }, |
| 59 | + zoneSpecification: ZoneSpecification( |
| 60 | + // Intercept printing from the task. |
| 61 | + print: (Zone self, ZoneDelegate parent, Zone zone, String line) async { |
| 62 | + capturedPrintLines.writeln(line); |
| 63 | + }, |
| 64 | + ), |
| 65 | + ); |
| 66 | + final String capturedPrint = capturedPrintLines.toString(); |
| 67 | + expect(capturedPrint, |
| 68 | + contains('with environment {FLUTTER_DEVICELAB_DEVICEID: FAKE_SUCCESS, BOT: true, LANG: en_US.UTF-8}')); |
| 69 | + expect(capturedPrint, contains('exit code: 0')); |
| 70 | + }); |
| 71 | + |
46 | 72 | test('throws exception when build and test arg are given', () async { |
47 | 73 | final TaskResult result = await runTask( |
48 | 74 | 'smoke_test_build_test', |
|
0 commit comments