OLD | NEW |
1 # Copyright (C) 2009 Google Inc. All rights reserved. | 1 # Copyright (C) 2009 Google Inc. All rights reserved. |
2 # Copyright (C) 2012 Intel Corporation. All rights reserved. | 2 # Copyright (C) 2012 Intel Corporation. All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 options_defaults.update(kwargs) | 45 options_defaults.update(kwargs) |
46 options = optparse.Values(dict(**options_defaults)) | 46 options = optparse.Values(dict(**options_defaults)) |
47 tool = MockWebKitPatch() | 47 tool = MockWebKitPatch() |
48 tool.port_factory.all_port_names = lambda: [ | 48 tool.port_factory.all_port_names = lambda: [ |
49 'test-linux-trusty', 'test-linux-precise', | 49 'test-linux-trusty', 'test-linux-precise', |
50 'test-mac-mac10.11', 'test-mac-mac10.10', | 50 'test-mac-mac10.11', 'test-mac-mac10.10', |
51 'test-win-win10', 'test-win-win7' | 51 'test-win-win10', 'test-win-win7' |
52 ] | 52 ] |
53 command = PrintExpectations() | 53 command = PrintExpectations() |
54 command.bind_to_tool(tool) | |
55 | 54 |
56 oc = OutputCapture() | 55 oc = OutputCapture() |
57 try: | 56 try: |
58 oc.capture_output() | 57 oc.capture_output() |
59 command.execute(options, tests, tool) | 58 command.execute(options, tests, tool) |
60 finally: | 59 finally: |
61 stdout, _, _ = oc.restore_output() | 60 stdout, _, _ = oc.restore_output() |
62 self.assertMultiLineEqual(stdout, expected_stdout) | 61 self.assertMultiLineEqual(stdout, expected_stdout) |
63 | 62 |
64 def test_basic(self): | 63 def test_basic(self): |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 self.oc = OutputCapture() | 132 self.oc = OutputCapture() |
134 self.oc.capture_output() | 133 self.oc.capture_output() |
135 | 134 |
136 def restore_output(self): | 135 def restore_output(self): |
137 stdout, stderr, logs = self.oc.restore_output() | 136 stdout, stderr, logs = self.oc.restore_output() |
138 self.oc = None | 137 self.oc = None |
139 return (stdout, stderr, logs) | 138 return (stdout, stderr, logs) |
140 | 139 |
141 def test_basic(self): | 140 def test_basic(self): |
142 command = PrintBaselines() | 141 command = PrintBaselines() |
143 command.bind_to_tool(self.tool) | |
144 self.capture_output() | 142 self.capture_output() |
145 options = optparse.Values({'all': False, 'include_virtual_tests': False,
'csv': False, 'platform': None}) | 143 options = optparse.Values({'all': False, 'include_virtual_tests': False,
'csv': False, 'platform': None}) |
146 command.execute(options, ['passes/text.html'], self.tool) | 144 command.execute(options, ['passes/text.html'], self.tool) |
147 stdout, _, _ = self.restore_output() | 145 stdout, _, _ = self.restore_output() |
148 self.assertMultiLineEqual(stdout, | 146 self.assertMultiLineEqual(stdout, |
149 ('// For test-win-win7\n' | 147 ('// For test-win-win7\n' |
150 'passes/text-expected.png\n' | 148 'passes/text-expected.png\n' |
151 'passes/text-expected.txt\n')) | 149 'passes/text-expected.txt\n')) |
152 | 150 |
153 def test_multiple(self): | 151 def test_multiple(self): |
154 command = PrintBaselines() | 152 command = PrintBaselines() |
155 command.bind_to_tool(self.tool) | |
156 self.capture_output() | 153 self.capture_output() |
157 options = optparse.Values({'all': False, 'include_virtual_tests': False,
'csv': False, 'platform': 'test-win-*'}) | 154 options = optparse.Values({'all': False, 'include_virtual_tests': False,
'csv': False, 'platform': 'test-win-*'}) |
158 command.execute(options, ['passes/text.html'], self.tool) | 155 command.execute(options, ['passes/text.html'], self.tool) |
159 stdout, _, _ = self.restore_output() | 156 stdout, _, _ = self.restore_output() |
160 self.assertMultiLineEqual(stdout, | 157 self.assertMultiLineEqual(stdout, |
161 ('// For test-win-win10\n' | 158 ('// For test-win-win10\n' |
162 'passes/text-expected.png\n' | 159 'passes/text-expected.png\n' |
163 'passes/text-expected.txt\n' | 160 'passes/text-expected.txt\n' |
164 '\n' | 161 '\n' |
165 '// For test-win-win7\n' | 162 '// For test-win-win7\n' |
166 'passes/text-expected.png\n' | 163 'passes/text-expected.png\n' |
167 'passes/text-expected.txt\n')) | 164 'passes/text-expected.txt\n')) |
168 | 165 |
169 def test_csv(self): | 166 def test_csv(self): |
170 command = PrintBaselines() | 167 command = PrintBaselines() |
171 command.bind_to_tool(self.tool) | |
172 self.capture_output() | 168 self.capture_output() |
173 options = optparse.Values({'all': False, 'platform': '*win7', 'csv': Tru
e, 'include_virtual_tests': False}) | 169 options = optparse.Values({'all': False, 'platform': '*win7', 'csv': Tru
e, 'include_virtual_tests': False}) |
174 command.execute(options, ['passes/text.html'], self.tool) | 170 command.execute(options, ['passes/text.html'], self.tool) |
175 stdout, _, _ = self.restore_output() | 171 stdout, _, _ = self.restore_output() |
176 self.assertMultiLineEqual(stdout, | 172 self.assertMultiLineEqual(stdout, |
177 ('test-win-win7,passes/text.html,None,png,pass
es/text-expected.png,None\n' | 173 ('test-win-win7,passes/text.html,None,png,pass
es/text-expected.png,None\n' |
178 'test-win-win7,passes/text.html,None,txt,pass
es/text-expected.txt,None\n')) | 174 'test-win-win7,passes/text.html,None,txt,pass
es/text-expected.txt,None\n')) |
OLD | NEW |