• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5from __future__ import annotations
6
7import abc
8import pathlib
9from unittest import mock
10
11from tests.crossbench.base import BaseCrossbenchTestCase
12
13
14class AbstractDownloaderTestCase(BaseCrossbenchTestCase, metaclass=abc.ABCMeta):
15  __test__ = False
16
17  def setUp(self) -> None:
18    super().setUp()
19    self.platform = mock.Mock(
20        is_remote=False,
21        is_linux=False,
22        is_macos=False,
23        exists=self.fs.exists,
24        sh_results=[],
25        path=pathlib.Path)
26    self.platform.search_app = lambda x: x
27    self.platform.which = pathlib.Path
28    self.platform.host_platform = self.platform
29    self.cache_dir = pathlib.Path("crossbench/binary_cache")
30    self.fs.create_dir(self.cache_dir)
31