@@ -157,19 +157,16 @@ Future<void> evaluateTrivialExpressions(FlutterTestDriver flutter) async {
157157}
158158
159159Future <void > evaluateComplexExpressions (FlutterTestDriver flutter) async {
160- final ObjRef res = await flutter.evaluateInFrame ('new DateTime.now( ).year' );
161- expectValueOfType (res, InstanceKind .kInt, DateTime . now ().year. toString () );
160+ final ObjRef res = await flutter.evaluateInFrame ('new DateTime(2000 ).year' );
161+ expectValueOfType (res, InstanceKind .kInt, '2000' );
162162}
163163
164164Future <void > evaluateComplexReturningExpressions (FlutterTestDriver flutter) async {
165- final DateTime now = DateTime . now ( );
166- final ObjRef resp = await flutter.evaluateInFrame ('new DateTime.now( )' );
165+ final DateTime date = DateTime ( 2000 );
166+ final ObjRef resp = await flutter.evaluateInFrame ('new DateTime(2000 )' );
167167 expectInstanceOfClass (resp, 'DateTime' );
168- // Ensure we got a reasonable approximation. The more accurate we try to
169- // make this, the more likely it'll fail due to differences in the time
170- // in the remote VM and the local VM at the time the code runs.
171168 final ObjRef res = await flutter.evaluate (resp.id, r'"$year-$month-$day"' );
172- expectValue (res, '${now .year }-${now .month }-${now .day }' );
169+ expectValue (res, '${date .year }-${date .month }-${date .day }' );
173170}
174171
175172void expectInstanceOfClass (ObjRef result, String name) {
0 commit comments