1// Copyright 2019 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5import '../base/context.dart'; 6import '../base/platform.dart'; 7import '../base/process_manager.dart'; 8import '../doctor.dart'; 9import '../features.dart'; 10import 'chrome.dart'; 11 12/// The web workflow instance. 13WebWorkflow get webWorkflow => context.get<WebWorkflow>(); 14 15class WebWorkflow extends Workflow { 16 const WebWorkflow(); 17 18 @override 19 bool get appliesToHostPlatform => featureFlags.isWebEnabled && (platform.isWindows || platform.isMacOS || platform.isLinux); 20 21 @override 22 bool get canLaunchDevices => featureFlags.isWebEnabled && canFindChrome(); 23 24 @override 25 bool get canListDevices => featureFlags.isWebEnabled && canFindChrome(); 26 27 @override 28 bool get canListEmulators => false; 29} 30 31/// Whether we can locate the chrome executable. 32bool canFindChrome() { 33 final String chrome = findChromeExecutable(); 34 try { 35 return processManager.canRun(chrome); 36 } on ArgumentError { 37 return false; 38 } 39} 40