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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzz_integration_test.py

Issue 2166463002: bluetooth: Basic Web Bluetooth Fuzzer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Move to testing/clusterfuzz directory Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzz_integration_test.py
diff --git a/third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzz_integration_test.py b/third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzz_integration_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..3be8cf70f91c71190a6cb745f72195c1f48f1901
--- /dev/null
+++ b/third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzz_integration_test.py
@@ -0,0 +1,41 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Test that the fuzzer works the way ClusterFuzz invokes it."""
+
+import glob
+import os
+import shutil
+import sys
+import tempfile
+import unittest
+
+import fuzz_main_run
+import setup
+
+
+class WebBluetoothFuzzerTest(unittest.TestCase):
+
+ def setUp(self):
+ self._output_dir = tempfile.mkdtemp()
+ self._resources_path = setup.RetrieveResources()
+
+ def tearDown(self):
+ shutil.rmtree(self._output_dir)
+ shutil.rmtree(self._resources_path)
+
+ def testCanGenerate100Files(self):
+ sys.argv = ['fuzz_main_run.py', '--no_of_files=100',
+ '--input_dir={}'.format(self._output_dir),
+ '--output_dir={}'.format(self._output_dir)]
+
+ fuzz_main_run.main()
+
+ written_files = glob.glob(os.path.join(self._output_dir, '*.html'))
+
+ self.assertEquals(100, len(written_files), 'Should have written 100 '
+ 'test files.')
+
+if __name__ == '__main__':
+ unittest.main()

Powered by Google App Engine
This is Rietveld 408576698