dart-sdk/pkg/vm_service/test/utils_test.dart
Ben Konyi 368b3f0ab4 Reland "[ VM / Service ] Pulled in vm_service_drivers from its own repo."
Changes from original CL:
 * Removed service_undocumented.md
 * Removed generation of wrappers for undocumented RPCs
 * Cleaned up generation code which was used for generating wrappers for undocumented RPCs
 * Removed JARs from pkg/vm_service/java/third_party

This reverts commit 477a3c4748.

Change-Id: I8d36733c8b2602e4935c3f23698d3f7c97a20187
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110135
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-07-25 18:46:43 +00:00

36 lines
1.6 KiB
Dart

// Copyright (c) 2019, 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.
import 'package:test/test.dart';
import 'package:vm_service/utils.dart';
void main() {
test('convertToWebSocketUrl maps URIs correctly', () {
final testCases = {
'http://localhost:123/': 'ws://localhost:123/ws',
'https://localhost:123/': 'wss://localhost:123/ws',
'ws://localhost:123/': 'ws://localhost:123/ws',
'wss://localhost:123/': 'wss://localhost:123/ws',
'http://localhost:123/ABCDEF=/': 'ws://localhost:123/ABCDEF=/ws',
'https://localhost:123/ABCDEF=/': 'wss://localhost:123/ABCDEF=/ws',
'ws://localhost:123/ABCDEF=/': 'ws://localhost:123/ABCDEF=/ws',
'wss://localhost:123/ABCDEF=/': 'wss://localhost:123/ABCDEF=/ws',
'http://localhost:123': 'ws://localhost:123/ws',
'https://localhost:123': 'wss://localhost:123/ws',
'ws://localhost:123': 'ws://localhost:123/ws',
'wss://localhost:123': 'wss://localhost:123/ws',
'http://localhost:123/ABCDEF=': 'ws://localhost:123/ABCDEF=/ws',
'https://localhost:123/ABCDEF=': 'wss://localhost:123/ABCDEF=/ws',
'ws://localhost:123/ABCDEF=': 'ws://localhost:123/ABCDEF=/ws',
'wss://localhost:123/ABCDEF=': 'wss://localhost:123/ABCDEF=/ws',
};
testCases.forEach((String input, String expected) {
final inputUri = Uri.parse(input);
final actualUri = convertToWebSocketUrl(serviceProtocolUrl: inputUri);
expect(actualUri.toString(), equals(expected));
});
});
}