- status = adb_->SetCommandLineFile(serial_, command_line_file, exec_name,
- args);
- if (!status.IsOk())
- return status;
+ // If Chrome is set as the debug app it looks in /data/local/tmp/.
+ // There's no way to know if this is set, so write to both locations.
+ // This can be removed once support for pre-M33 is no longer needed.
+ if (command_line_file == kChromeCmdLineFileBeforeM33) {
+ status = adb_->SetCommandLineFile(
+ serial_, kChromeCmdLineFileBeforeM33, exec_name, args);
+ Status status2 = adb_->SetCommandLineFile(
+ serial_, kChromeCmdLineFile, exec_name, args);
+ if (status.IsError() && status2.IsError())
+ return Status(kUnknownError,
+ "Failed to set Chrome's command line file on device " + serial_);
+ } else {
+ status = adb_->SetCommandLineFile(
+ serial_, command_line_file, exec_name, args);
+ if (status.IsError())
+ return status;
+ }