Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1423)

Unified Diff: runtime/observatory/tests/service/developer_server_control_test.dart

Issue 2500543002: Add following tests : (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/tests/service/auth_token_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 = [
« no previous file with comments | « runtime/observatory/tests/service/auth_token_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698