2021-04-01 18:05:04 +08:00
|
|
|
import 'dart:async';
|
|
|
|
|
2019-07-23 18:10:24 +08:00
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:system_proxy/system_proxy.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
const MethodChannel channel = MethodChannel('system_proxy');
|
|
|
|
|
|
|
|
setUp(() {
|
|
|
|
channel.setMockMethodCallHandler((MethodCall methodCall) async {
|
2021-04-01 18:05:04 +08:00
|
|
|
return {'host': '127.0.0.1', 'port': '8899'};
|
2019-07-23 18:10:24 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
tearDown(() {
|
|
|
|
channel.setMockMethodCallHandler(null);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('getProxySettings', () async {
|
2021-04-01 18:05:04 +08:00
|
|
|
Map<String, String> proxy = await (SystemProxy.getProxySettings() as FutureOr<Map<String, String>>);
|
2019-07-23 18:10:24 +08:00
|
|
|
|
|
|
|
expect(proxy['host'], '127.0.0.1');
|
|
|
|
expect(proxy['port'], '8899');
|
|
|
|
});
|
|
|
|
}
|