1# Copyright 2013 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 os
6import subprocess
7
8from telemetry.internal.util import binary_manager
9from telemetry.internal.platform import platform_backend
10
11
12class DesktopPlatformBackend(platform_backend.PlatformBackend):
13
14  # This is an abstract class. It is OK to have abstract methods.
15  # pylint: disable=abstract-method
16
17  def FlushSystemCacheForDirectory(self, directory):
18    assert directory and os.path.exists(directory), \
19        'Target directory %s must exist' % directory
20    flush_command = binary_manager.FetchPath(
21        'clear_system_cache', self.GetArchName(), self.GetOSName())
22    assert flush_command, 'You must build clear_system_cache first'
23
24    subprocess.check_call([flush_command, '--recurse', directory])
25
26  def GetDeviceTypeName(self):
27    return 'Desktop'
28