| Index: runtime/observatory/tests/service/auth_token_test.dart
|
| diff --git a/runtime/observatory/tests/service/auth_token_test.dart b/runtime/observatory/tests/service/auth_token_test.dart
|
| index ce75e4f298b595e9a589d3ce7639093771d29205..6d38fcaa310dd89577af4ee17985b72134f304f0 100644
|
| --- a/runtime/observatory/tests/service/auth_token_test.dart
|
| +++ b/runtime/observatory/tests/service/auth_token_test.dart
|
| @@ -1,10 +1,11 @@
|
| -// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
| // VMOptions=--error_on_bad_type --error_on_bad_override
|
|
|
| import 'dart:async';
|
| import 'dart:developer';
|
| +import 'dart:io' as io;
|
| import 'package:observatory/service_io.dart';
|
| import 'package:unittest/unittest.dart';
|
| import 'test_helper.dart';
|
| @@ -19,6 +20,26 @@ Future<Null> testeeBefore() async {
|
| expect(info.serverUri.pathSegments.length, greaterThan(1));
|
| // Sanity check the length of the auth token.
|
| expect(info.serverUri.pathSegments[0].length, greaterThan(8));
|
| +
|
| + // Try connecting to the server without the auth token, it should throw
|
| + // an exception.
|
| + var port = info.serverUri.port;
|
| + var url = Uri.parse('http://127.0.0.1:$port');
|
| + var httpClient = new io.HttpClient();
|
| + try {
|
| + var request = await httpClient.getUrl(url);
|
| + expect(true, false);
|
| + } catch (e) {
|
| + expect(true, true);
|
| + }
|
| +
|
| + // Try connecting to the server with the auth token, it should succeed.
|
| + try {
|
| + var request = await httpClient.getUrl(info.serverUri);
|
| + expect(true, true);
|
| + } catch (e) {
|
| + expect(true, false);
|
| + }
|
| }
|
|
|
| var tests = [
|
|
|