| Index: runtime/observatory/tests/service/developer_server_control_test.dart
|
| diff --git a/runtime/observatory/tests/service/developer_server_control_test.dart b/runtime/observatory/tests/service/developer_server_control_test.dart
|
| index fc1e9405cf4fcd4e0e4cbfa7ff6a0bf5687dbb30..400796b8eeb8b3a3907886c80c8752b1482e7b8a 100644
|
| --- a/runtime/observatory/tests/service/developer_server_control_test.dart
|
| +++ b/runtime/observatory/tests/service/developer_server_control_test.dart
|
| @@ -9,12 +9,63 @@ import 'package:observatory/service_io.dart';
|
| import 'package:unittest/unittest.dart';
|
| import 'test_helper.dart';
|
|
|
| +int majorVersion;
|
| +int minorVersion;
|
| +Uri serverUri;
|
| +
|
| Future<Null> testeeBefore() async {
|
| print('testee before');
|
| - print(await Service.getInfo());
|
| - // Start the web server.
|
| - ServiceProtocolInfo info = await Service.controlWebServer(enable: true);
|
| - print(info);
|
| + // First grab the URL where the observatory is listening on and the
|
| + // service protocol version numbers. We expect the URL to be null as
|
| + // the server has not been started yet.
|
| + ServiceProtocolInfo info = await Service.getInfo();
|
| + majorVersion = info.majorVersion;
|
| + minorVersion = info.minorVersion;
|
| + serverUri = info.serverUri;
|
| + expect(info.serverUri, isNull);
|
| + {
|
| + // Now, start the web server and store the URI which is expected to be
|
| + // non NULL in the top level variable.
|
| + ServiceProtocolInfo info = await Service.controlWebServer(enable: true);
|
| + expect(info.majorVersion, equals(majorVersion));
|
| + expect(info.minorVersion, equals(minorVersion));
|
| + expect(info.serverUri, isNotNull);
|
| + serverUri = info.serverUri;
|
| + }
|
| + {
|
| + // Now try starting the web server again, this should just return the
|
| + // existing state without any change (port number does not change).
|
| + ServiceProtocolInfo info = await Service.controlWebServer(enable: true);
|
| + expect(info.majorVersion, equals(majorVersion));
|
| + expect(info.minorVersion, equals(minorVersion));
|
| + expect(info.serverUri, equals(serverUri));
|
| + }
|
| + {
|
| + // Try turning off the web server, this should turn off the server and
|
| + // the Uri returned should be null.
|
| + ServiceProtocolInfo info = await Service.controlWebServer(enable: false);
|
| + expect(info.majorVersion, equals(majorVersion));
|
| + expect(info.minorVersion, equals(minorVersion));
|
| + expect(info.serverUri, isNull);
|
| + }
|
| + {
|
| + // Try turning off the web server again, this should be a nop
|
| + // and the Uri returned should be null.
|
| + ServiceProtocolInfo info = await Service.controlWebServer(enable: false);
|
| + expect(info.majorVersion, equals(majorVersion));
|
| + expect(info.minorVersion, equals(minorVersion));
|
| + expect(info.serverUri, isNull);
|
| + }
|
| + {
|
| + // Start the web server again for the test below.
|
| + ServiceProtocolInfo info = await Service.controlWebServer(enable: true);
|
| + majorVersion = info.majorVersion;
|
| + minorVersion = info.minorVersion;
|
| + serverUri = info.serverUri;
|
| + expect(info.majorVersion, equals(majorVersion));
|
| + expect(info.minorVersion, equals(minorVersion));
|
| + expect(info.serverUri, equals(serverUri));
|
| + }
|
| }
|
|
|
| var tests = [
|
|
|