Ian Hickson 8f56f6fdd1 Add documentation and clean up code. (#11330)
Mainly, this adds documentation to members that were previously
lacking documentation.

It also adds a big block of documentation about improving performance
of widgets.

This also removes some references to package:collection and adds
global setEquals and listEquals methods in foundation that we can use.
(setEquals in particular should be much faster than the
package:collection equivalent, though both should be faster as they
avoid allocating new objects.) All remaining references now qualify
the import so we know what our remaining dependencies are.

Also lots of code reordering in Flutter driver to make the code
consistent and apply the style guide more thoroughly.
2017-07-21 16:39:04 -07:00

55 lines
1.6 KiB
Dart

// Copyright 2016 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 'enum_util.dart';
import 'message.dart';
/// A Flutter Driver command that requests an application health check.
class GetHealth extends Command {
/// Create a health check command.
GetHealth({ Duration timeout }) : super(timeout: timeout);
/// Deserializes this command from the value generated by [serialize].
GetHealth.deserialize(Map<String, String> json) : super.deserialize(json);
@override
final String kind = 'get_health';
}
/// A description of application state.
enum HealthStatus {
/// Application is known to be in a good shape and should be able to respond.
ok,
/// Application is not known to be in a good shape and may be unresponsive.
bad,
}
final EnumIndex<HealthStatus> _healthStatusIndex =
new EnumIndex<HealthStatus>(HealthStatus.values);
/// A description of the application state, as provided in response to a
/// [FlutterDriver.checkHealth] test.
class Health extends Result {
/// Creates a [Health] object with the given [status].
Health(this.status) {
assert(status != null);
}
/// The status represented by this object.
///
/// If the application responded, this will be [HealthStatus.ok].
final HealthStatus status;
/// Deserializes the result from JSON.
static Health fromJson(Map<String, dynamic> json) {
return new Health(_healthStatusIndex.lookupBySimpleName(json['status']));
}
@override
Map<String, dynamic> toJson() => <String, dynamic>{
'status': _healthStatusIndex.toSimpleName(status),
};
}