| OLD | NEW |
| (Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 """Test that the fuzzer works the way ClusterFuzz invokes it.""" |
| 6 |
| 7 import glob |
| 8 import os |
| 9 import shutil |
| 10 import sys |
| 11 import tempfile |
| 12 import unittest |
| 13 |
| 14 import fuzz_main_run |
| 15 import setup |
| 16 |
| 17 |
| 18 class WebBluetoothFuzzerTest(unittest.TestCase): |
| 19 |
| 20 def setUp(self): |
| 21 self._output_dir = tempfile.mkdtemp() |
| 22 self._resources_path = setup.RetrieveResources() |
| 23 |
| 24 def tearDown(self): |
| 25 shutil.rmtree(self._output_dir) |
| 26 shutil.rmtree(self._resources_path) |
| 27 |
| 28 def testCanGenerate100Files(self): |
| 29 sys.argv = ['fuzz_main_run.py', '--no_of_files=100', |
| 30 '--input_dir={}'.format(self._output_dir), |
| 31 '--output_dir={}'.format(self._output_dir)] |
| 32 |
| 33 fuzz_main_run.main() |
| 34 |
| 35 written_files = glob.glob(os.path.join(self._output_dir, '*.html')) |
| 36 |
| 37 self.assertEquals(100, len(written_files), 'Should have written 100 ' |
| 38 'test files.') |
| 39 |
| 40 if __name__ == '__main__': |
| 41 unittest.main() |
| OLD | NEW |