Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(772)

Side by Side Diff: tools/telemetry/telemetry/core/platform/linux_platform_backend_unittest.py

Issue 381293003: [Telemetry] Consider linux distribution number is 0 when it cannot be parsed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2014 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
5 import os
6 import unittest
7
8 from telemetry import decorators
9 from telemetry.core import util
10 from telemetry.core.platform import linux_platform_backend
11
12 class TestBackend(
13 linux_platform_backend.LinuxPlatformBackend):
14
15 def __init__(self):
16 super(TestBackend, self).__init__()
17 self._mock_files = {}
18
19 def SetMockFile(self, filename, output):
20 self._mock_files[filename] = output
21
22 def _GetFileContents(self, filename):
23 return self._mock_files[filename]
24
25 def StartRawDisplayFrameRateMeasurement(self):
26 raise NotImplementedError()
27
28 def StopRawDisplayFrameRateMeasurement(self):
29 raise NotImplementedError()
30
31 def GetRawDisplayFrameRateMeasurements(self):
32 raise NotImplementedError()
33
34 def IsThermallyThrottled(self):
35 raise NotImplementedError()
36
37 def HasBeenThermallyThrottled(self):
38 raise NotImplementedError()
39
40 def GetSystemCommitCharge(self):
41 raise NotImplementedError()
42
43 def StopVideoCapture(self):
44 raise NotImplementedError()
45
46 def StartVideoCapture(self, min_bitrate_mbps):
47 raise NotImplementedError()
48
49 def GetSystemTotalPhysicalMemory(self):
50 raise NotImplementedError()
51
52
53 class LinuxPlatformBackendTest(unittest.TestCase):
54 @decorators.Enabled('linux')
55 def testGetOSVersionNameSaucy(self):
56 backend = TestBackend()
57 path = os.path.join(util.GetUnittestDataDir(), 'ubuntu-saucy-lsb-release')
58 with open(path) as f:
59 backend.SetMockFile('/etc/lsb-release', f.read())
60
61 self.assertEqual(backend.GetOSVersionName(), 'saucy')
62
63 @decorators.Enabled('linux')
64 def testGetOSVersionNameArch(self):
65 backend = TestBackend()
66 path = os.path.join(util.GetUnittestDataDir(), 'arch-lsb-release')
67 with open(path) as f:
68 backend.SetMockFile('/etc/lsb-release', f.read())
69
70 # a distribution may not have a codename or a release number. We just check
71 # that GetOSVersionName doesn't raise an exception
72 backend.GetOSVersionName()
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/core/platform/linux_platform_backend.py ('k') | tools/telemetry/unittest_data/arch-lsb-release » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698