a2d2d693dc
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-android-release-arm64c-try Fixes: b/232495224 Change-Id: I0338db48c0cc89ec35d52bff2f508105e80c3538 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248008 Commit-Queue: Alexander Thomas <athom@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com>
58 lines
1.5 KiB
Dart
58 lines
1.5 KiB
Dart
// Copyright (c) 2022, 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 'dart:io';
|
|
|
|
import 'package:expect/expect.dart';
|
|
import 'package:smith/smith.dart';
|
|
import 'package:test_runner/src/browser_controller.dart';
|
|
import 'package:test_runner/src/service/web_driver_service.dart';
|
|
|
|
void main() async {
|
|
final chromePath = Platform.environment['CHROME_PATH'];
|
|
if (chromePath != null) {
|
|
print('Testing Chrome');
|
|
await testChrome(chromePath);
|
|
}
|
|
final firefoxPath = Platform.environment['FIREFOX_PATH'];
|
|
if (firefoxPath != null) {
|
|
print('Testing Firefox');
|
|
await testFirefox(firefoxPath);
|
|
}
|
|
if (Platform.isMacOS) {
|
|
print('Testing Safari');
|
|
await testSafari();
|
|
}
|
|
}
|
|
|
|
Future<void> testChrome(String path) {
|
|
return testBrowser(Chrome(path));
|
|
}
|
|
|
|
Future<void> testFirefox(String path) {
|
|
return testBrowser(Firefox(path));
|
|
}
|
|
|
|
Future<void> testSafari() async {
|
|
var service = await WebDriverService.startServiceForRuntime(Runtime.safari);
|
|
await testBrowser(Safari(service.port));
|
|
service.allDone();
|
|
}
|
|
|
|
Future<void> testBrowser(Browser browser) async {
|
|
browser.debugPrint = true;
|
|
await browser.version;
|
|
await testStartStop(browser);
|
|
}
|
|
|
|
Future<void> testStartStop(Browser browser) async {
|
|
var closed = false;
|
|
try {
|
|
Expect.isTrue(await browser.start('about:blank'));
|
|
} finally {
|
|
closed = await browser.close();
|
|
}
|
|
Expect.isTrue(closed);
|
|
}
|