| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include <iostream> | 5 #include <iostream> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 default: | 627 default: |
| 628 break; | 628 break; |
| 629 } | 629 } |
| 630 } | 630 } |
| 631 --g_depth; | 631 --g_depth; |
| 632 return true; | 632 return true; |
| 633 } | 633 } |
| 634 }; | 634 }; |
| 635 | 635 |
| 636 template <> | 636 template <> |
| 637 struct FuzzTraits<blink::WebGamepad> { | |
| 638 static bool Fuzz(blink::WebGamepad* p, Fuzzer* fuzzer) { | |
| 639 if (!FuzzParam(&p->connected, fuzzer)) | |
| 640 return false; | |
| 641 if (!FuzzParam(&p->timestamp, fuzzer)) | |
| 642 return false; | |
| 643 unsigned idLength = static_cast<unsigned>( | |
| 644 RandInRange(blink::WebGamepad::idLengthCap + 1)); | |
| 645 if (!FuzzParamArray(&p->id[0], idLength, fuzzer)) | |
| 646 return false; | |
| 647 p->axesLength = static_cast<unsigned>( | |
| 648 RandInRange(blink::WebGamepad::axesLengthCap + 1)); | |
| 649 if (!FuzzParamArray(&p->axes[0], p->axesLength, fuzzer)) | |
| 650 return false; | |
| 651 p->buttonsLength = static_cast<unsigned>( | |
| 652 RandInRange(blink::WebGamepad::buttonsLengthCap + 1)); | |
| 653 if (!FuzzParamArray(&p->buttons[0], p->buttonsLength, fuzzer)) | |
| 654 return false; | |
| 655 unsigned mappingsLength = static_cast<unsigned>( | |
| 656 RandInRange(blink::WebGamepad::mappingLengthCap + 1)); | |
| 657 if (!FuzzParamArray(&p->mapping[0], mappingsLength, fuzzer)) | |
| 658 return false; | |
| 659 return true; | |
| 660 } | |
| 661 }; | |
| 662 | |
| 663 template <> | |
| 664 struct FuzzTraits<blink::WebGamepadButton> { | |
| 665 static bool Fuzz(blink::WebGamepadButton* p, Fuzzer* fuzzer) { | |
| 666 if (!FuzzParam(&p->pressed, fuzzer)) | |
| 667 return false; | |
| 668 if (!FuzzParam(&p->value, fuzzer)) | |
| 669 return false; | |
| 670 return true; | |
| 671 } | |
| 672 }; | |
| 673 | |
| 674 template <> | |
| 675 struct FuzzTraits<cc::CompositorFrame> { | 637 struct FuzzTraits<cc::CompositorFrame> { |
| 676 static bool Fuzz(cc::CompositorFrame* p, Fuzzer* fuzzer) { | 638 static bool Fuzz(cc::CompositorFrame* p, Fuzzer* fuzzer) { |
| 677 // TODO(mbarbella): Support mutation. | 639 // TODO(mbarbella): Support mutation. |
| 678 if (!fuzzer->ShouldGenerate()) | 640 if (!fuzzer->ShouldGenerate()) |
| 679 return true; | 641 return true; |
| 680 | 642 |
| 681 if (!FuzzParam(&p->metadata, fuzzer)) | 643 if (!FuzzParam(&p->metadata, fuzzer)) |
| 682 return false; | 644 return false; |
| 683 | 645 |
| 684 switch (RandInRange(2)) { | 646 switch (RandInRange(2)) { |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1885 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" | 1847 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" |
| 1886 #undef IPC_MESSAGE_DECL | 1848 #undef IPC_MESSAGE_DECL |
| 1887 #define IPC_MESSAGE_DECL(name, ...) \ | 1849 #define IPC_MESSAGE_DECL(name, ...) \ |
| 1888 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; | 1850 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; |
| 1889 | 1851 |
| 1890 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { | 1852 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { |
| 1891 #include "tools/ipc_fuzzer/message_lib/all_messages.h" | 1853 #include "tools/ipc_fuzzer/message_lib/all_messages.h" |
| 1892 } | 1854 } |
| 1893 | 1855 |
| 1894 } // namespace ipc_fuzzer | 1856 } // namespace ipc_fuzzer |
| OLD | NEW |