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

Side by Side Diff: tools/telemetry/telemetry/core/gpu_device_unittest.py

Issue 21682002: Expose GPU information to Telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed more unnecessary includes. Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 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 import unittest
5
6 from telemetry.core import gpu_device
7
8 class TestGPUDevice(unittest.TestCase):
9 def testConstruction(self):
10 device = gpu_device.GPUDevice(1000, 2000, 'test_vendor', 'test_device')
11 self.assertEquals(device.vendor_id, 1000)
12 self.assertEquals(device.device_id, 2000)
13 self.assertEquals(device.vendor_string, 'test_vendor')
14 self.assertEquals(device.device_string, 'test_device')
15
16 def testFromDict(self):
17 dictionary = { 'vendor_id': 3000,
18 'device_id': 4000,
19 'vendor_string': 'test_vendor_2',
20 'device_string': 'test_device_2' }
21 device = gpu_device.GPUDevice.FromDict(dictionary)
22 self.assertEquals(device.vendor_id, 3000)
23 self.assertEquals(device.device_id, 4000)
24 self.assertEquals(device.vendor_string, 'test_vendor_2')
25 self.assertEquals(device.device_string, 'test_device_2')
26
27 def testMissingAttrsFromDict(self):
28 data = {
29 'vendor_id': 1,
30 'device_id': 2,
31 'vendor_string': 'a',
32 'device_string': 'b'
33 }
34
35 for k in data:
36 data_copy = data.copy()
37 del data_copy[k]
38 try:
39 gpu_device.GPUDevice.FromDict(data_copy)
40 self.fail('Should raise exception if attribute "%s" is missing' % k)
41 except AssertionError:
42 raise
43 except:
44 pass
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698