MockRemoteProcess.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 2023 KeePassXC Team <team@keepassxc.org>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 or (at your option)
  7. * version 3 of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include <QFile>
  18. #include "MockRemoteProcess.h"
  19. MockRemoteProcess::MockRemoteProcess(QObject* parent, const QString& dbPath)
  20. : RemoteProcess(parent)
  21. , m_dbPath(dbPath)
  22. {
  23. }
  24. void MockRemoteProcess::start(const QString&)
  25. {
  26. QFile ::copy(m_dbPath, m_tempFileLocation);
  27. }
  28. qint64 MockRemoteProcess::write(const QString& data)
  29. {
  30. return data.length();
  31. }
  32. bool MockRemoteProcess::waitForBytesWritten()
  33. {
  34. return true;
  35. }
  36. void MockRemoteProcess::closeWriteChannel()
  37. {
  38. // nothing to do
  39. }
  40. bool MockRemoteProcess::waitForFinished(int)
  41. {
  42. return true; // no need to wait
  43. }
  44. int MockRemoteProcess::exitCode() const
  45. {
  46. return 0; // always return success
  47. }