OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import sys | 6 import sys |
| 7 import traceback |
7 import unittest | 8 import unittest |
8 import traceback | |
9 | 9 |
10 from telemetry import value | 10 from telemetry import value |
11 from telemetry.page import page_set | 11 from telemetry.page import page_set |
12 from telemetry.value import failure | 12 from telemetry.value import failure |
13 | 13 |
| 14 |
14 class TestBase(unittest.TestCase): | 15 class TestBase(unittest.TestCase): |
15 def setUp(self): | 16 def setUp(self): |
16 self.page_set = page_set.PageSet(file_path=os.path.dirname(__file__)) | 17 self.page_set = page_set.PageSet(file_path=os.path.dirname(__file__)) |
17 self.page_set.AddPageWithDefaultRunNavigate("http://www.bar.com/") | 18 self.page_set.AddPageWithDefaultRunNavigate("http://www.bar.com/") |
18 | 19 |
19 @property | 20 @property |
20 def pages(self): | 21 def pages(self): |
21 return self.page_set.pages | 22 return self.page_set.pages |
22 | 23 |
23 class ValueTest(TestBase): | 24 class ValueTest(TestBase): |
(...skipping 28 matching lines...) Expand all Loading... |
52 d = { | 53 d = { |
53 'type': 'failure', | 54 'type': 'failure', |
54 'name': exc_info[0].__name__, | 55 'name': exc_info[0].__name__, |
55 'units': '', | 56 'units': '', |
56 'value': ''.join(traceback.format_exception(*exc_info)) | 57 'value': ''.join(traceback.format_exception(*exc_info)) |
57 } | 58 } |
58 v = value.Value.FromDict(d, {}) | 59 v = value.Value.FromDict(d, {}) |
59 | 60 |
60 self.assertTrue(isinstance(v, failure.FailureValue)) | 61 self.assertTrue(isinstance(v, failure.FailureValue)) |
61 self.assertEquals(v.name, 'Exception') | 62 self.assertEquals(v.name, 'Exception') |
OLD | NEW |