OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 json | 5 import json |
6 import mock | 6 import mock |
7 import os | 7 import os |
8 import tempfile | 8 import tempfile |
9 import unittest | 9 import unittest |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 elif file_path == 'flaky.html': | 68 elif file_path == 'flaky.html': |
69 if self.__class__._num_flaky_runs_to_fail > 0: | 69 if self.__class__._num_flaky_runs_to_fail > 0: |
70 self.__class__._num_flaky_runs_to_fail -= 1 | 70 self.__class__._num_flaky_runs_to_fail -= 1 |
71 self.fail('Expected flaky failure') | 71 self.fail('Expected flaky failure') |
72 elif file_path == 'error.html': | 72 elif file_path == 'error.html': |
73 raise Exception('Expected exception') | 73 raise Exception('Expected exception') |
74 | 74 |
75 | 75 |
76 class GpuIntegrationTestUnittest(unittest.TestCase): | 76 class GpuIntegrationTestUnittest(unittest.TestCase): |
77 @mock.patch('telemetry.internal.util.binary_manager.InitDependencyManager') | 77 @mock.patch('telemetry.internal.util.binary_manager.InitDependencyManager') |
78 # https://crbug.com/352807 | |
79 @unittest.skip("Temporarily skip until Catapult rolls forward") | |
80 def testSimpleIntegrationUnittest(self, mockInitDependencyManager): | 78 def testSimpleIntegrationUnittest(self, mockInitDependencyManager): |
81 options = browser_test_runner.TestRunOptions() | 79 options = browser_test_runner.TestRunOptions() |
82 # Suppress printing out information for passing tests. | 80 # Suppress printing out information for passing tests. |
83 options.verbosity = 0 | 81 options.verbosity = 0 |
84 config = gpu_project_config.CONFIG | 82 config = gpu_project_config.CONFIG |
85 temp_file = tempfile.NamedTemporaryFile(delete=False) | 83 temp_file = tempfile.NamedTemporaryFile(delete=False) |
86 temp_file.close() | 84 temp_file.close() |
87 temp_file_name = temp_file.name | 85 temp_file_name = temp_file.name |
88 try: | 86 try: |
89 browser_test_runner.Run( | 87 browser_test_runner.Run( |
90 config, options, | 88 config, options, |
91 ['simple_integration_unittest', | 89 ['simple_integration_unittest', |
92 '--write-abbreviated-json-results-to=%s' % temp_file_name]) | 90 '--write-abbreviated-json-results-to=%s' % temp_file_name]) |
93 with open(temp_file_name) as f: | 91 with open(temp_file_name) as f: |
94 test_result = json.load(f) | 92 test_result = json.load(f) |
95 prefix = 'gpu_tests.gpu_integration_test_unittest.' + \ | |
96 'SimpleIntegrationUnittest.' | |
97 self.assertEquals(test_result['failures'], [ | 93 self.assertEquals(test_result['failures'], [ |
98 prefix + 'unexpected_error', | 94 'unexpected_error', |
99 prefix + 'unexpected_failure']) | 95 'unexpected_failure']) |
100 self.assertEquals(test_result['successes'], [ | 96 self.assertEquals(test_result['successes'], [ |
101 prefix + 'expected_failure', | 97 'expected_failure', |
102 prefix + 'expected_flaky']) | 98 'expected_flaky']) |
103 self.assertEquals(test_result['valid'], True) | 99 self.assertEquals(test_result['valid'], True) |
104 # It might be nice to be more precise about the order of operations | 100 # It might be nice to be more precise about the order of operations |
105 # with these browser restarts, but this is at least a start. | 101 # with these browser restarts, but this is at least a start. |
106 self.assertEquals(SimpleIntegrationUnittest._num_browser_starts, 5) | 102 self.assertEquals(SimpleIntegrationUnittest._num_browser_starts, 5) |
107 finally: | 103 finally: |
108 os.remove(temp_file_name) | 104 os.remove(temp_file_name) |
OLD | NEW |