| Index: tools/telemetry/telemetry/core/platform/linux_platform_backend_unittest.py
|
| diff --git a/tools/telemetry/telemetry/core/platform/linux_platform_backend_unittest.py b/tools/telemetry/telemetry/core/platform/linux_platform_backend_unittest.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ca6d15f902c9c4d8bdf444bfed9c8c1551c9bd7d
|
| --- /dev/null
|
| +++ b/tools/telemetry/telemetry/core/platform/linux_platform_backend_unittest.py
|
| @@ -0,0 +1,72 @@
|
| +# Copyright 2014 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import os
|
| +import unittest
|
| +
|
| +from telemetry import decorators
|
| +from telemetry.core import util
|
| +from telemetry.core.platform import linux_platform_backend
|
| +
|
| +class TestBackend(
|
| + linux_platform_backend.LinuxPlatformBackend):
|
| +
|
| + def __init__(self):
|
| + super(TestBackend, self).__init__()
|
| + self._mock_files = {}
|
| +
|
| + def SetMockFile(self, filename, output):
|
| + self._mock_files[filename] = output
|
| +
|
| + def _GetFileContents(self, filename):
|
| + return self._mock_files[filename]
|
| +
|
| + def StartRawDisplayFrameRateMeasurement(self):
|
| + raise NotImplementedError()
|
| +
|
| + def StopRawDisplayFrameRateMeasurement(self):
|
| + raise NotImplementedError()
|
| +
|
| + def GetRawDisplayFrameRateMeasurements(self):
|
| + raise NotImplementedError()
|
| +
|
| + def IsThermallyThrottled(self):
|
| + raise NotImplementedError()
|
| +
|
| + def HasBeenThermallyThrottled(self):
|
| + raise NotImplementedError()
|
| +
|
| + def GetSystemCommitCharge(self):
|
| + raise NotImplementedError()
|
| +
|
| + def StopVideoCapture(self):
|
| + raise NotImplementedError()
|
| +
|
| + def StartVideoCapture(self, min_bitrate_mbps):
|
| + raise NotImplementedError()
|
| +
|
| + def GetSystemTotalPhysicalMemory(self):
|
| + raise NotImplementedError()
|
| +
|
| +
|
| +class LinuxPlatformBackendTest(unittest.TestCase):
|
| + @decorators.Enabled('linux')
|
| + def testGetOSVersionNameSaucy(self):
|
| + backend = TestBackend()
|
| + path = os.path.join(util.GetUnittestDataDir(), 'ubuntu-saucy-lsb-release')
|
| + with open(path) as f:
|
| + backend.SetMockFile('/etc/lsb-release', f.read())
|
| +
|
| + self.assertEqual(backend.GetOSVersionName(), 'saucy')
|
| +
|
| + @decorators.Enabled('linux')
|
| + def testGetOSVersionNameArch(self):
|
| + backend = TestBackend()
|
| + path = os.path.join(util.GetUnittestDataDir(), 'arch-lsb-release')
|
| + with open(path) as f:
|
| + backend.SetMockFile('/etc/lsb-release', f.read())
|
| +
|
| + # a distribution may not have a codename or a release number. We just check
|
| + # that GetOSVersionName doesn't raise an exception
|
| + backend.GetOSVersionName()
|
|
|