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

Side by Side Diff: tools/ipc_fuzzer/fuzzer/fuzzer.cc

Issue 1865163002: Remove remoting messages from the IPC fuzzer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/ipc_fuzzer/message_lib/all_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 if (!FuzzParam(&dpi, fuzzer)) 1703 if (!FuzzParam(&dpi, fuzzer))
1704 return false; 1704 return false;
1705 if (!FuzzParam(&autorotate, fuzzer)) 1705 if (!FuzzParam(&autorotate, fuzzer))
1706 return false; 1706 return false;
1707 *p = printing::PdfRenderSettings(area, dpi, autorotate); 1707 *p = printing::PdfRenderSettings(area, dpi, autorotate);
1708 return true; 1708 return true;
1709 } 1709 }
1710 }; 1710 };
1711 1711
1712 template <> 1712 template <>
1713 struct FuzzTraits<remoting::ScreenResolution> {
1714 static bool Fuzz(remoting::ScreenResolution* p, Fuzzer* fuzzer) {
1715 webrtc::DesktopSize dimensions = p->dimensions();
1716 webrtc::DesktopVector dpi = p->dpi();
1717 if (!FuzzParam(&dimensions, fuzzer))
1718 return false;
1719 if (!FuzzParam(&dpi, fuzzer))
1720 return false;
1721 *p = remoting::ScreenResolution(dimensions, dpi);
1722 return true;
1723 }
1724 };
1725
1726 template <>
1727 struct FuzzTraits<SkBitmap> { 1713 struct FuzzTraits<SkBitmap> {
1728 static bool Fuzz(SkBitmap* p, Fuzzer* fuzzer) { 1714 static bool Fuzz(SkBitmap* p, Fuzzer* fuzzer) {
1729 // TODO(mbarbella): This should actually do something. 1715 // TODO(mbarbella): This should actually do something.
1730 return true; 1716 return true;
1731 } 1717 }
1732 }; 1718 };
1733 1719
1734 template <> 1720 template <>
1735 struct FuzzTraits<storage::DataElement> { 1721 struct FuzzTraits<storage::DataElement> {
1736 static bool Fuzz(storage::DataElement* p, Fuzzer* fuzzer) { 1722 static bool Fuzz(storage::DataElement* p, Fuzzer* fuzzer) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 if (!FuzzParam(&path, fuzzer)) 1867 if (!FuzzParam(&path, fuzzer))
1882 return false; 1868 return false;
1883 *p = URLPattern(valid_schemes); 1869 *p = URLPattern(valid_schemes);
1884 p->SetHost(host); 1870 p->SetHost(host);
1885 p->SetPort(port); 1871 p->SetPort(port);
1886 p->SetPath(path); 1872 p->SetPath(path);
1887 return true; 1873 return true;
1888 } 1874 }
1889 }; 1875 };
1890 1876
1891 template <>
1892 struct FuzzTraits<webrtc::DesktopSize> {
1893 static bool Fuzz(webrtc::DesktopSize* p, Fuzzer* fuzzer) {
1894 int32_t width = p->width();
1895 int32_t height = p->height();
1896 if (!FuzzParam(&width, fuzzer))
1897 return false;
1898 if (!FuzzParam(&height, fuzzer))
1899 return false;
1900 *p = webrtc::DesktopSize(width, height);
1901 return true;
1902 }
1903 };
1904
1905 template <>
1906 struct FuzzTraits<webrtc::DesktopVector> {
1907 static bool Fuzz(webrtc::DesktopVector* p, Fuzzer* fuzzer) {
1908 int32_t x = p->x();
1909 int32_t y = p->y();
1910 if (!FuzzParam(&x, fuzzer))
1911 return false;
1912 if (!FuzzParam(&y, fuzzer))
1913 return false;
1914 p->set(x, y);
1915 return true;
1916 }
1917 };
1918
1919 template <>
1920 struct FuzzTraits<webrtc::DesktopRect> {
1921 static bool Fuzz(webrtc::DesktopRect* p, Fuzzer* fuzzer) {
1922 int32_t left = p->left();
1923 int32_t top = p->top();
1924 int32_t right = p->right();
1925 int32_t bottom = p->bottom();
1926 if (!FuzzParam(&left, fuzzer))
1927 return false;
1928 if (!FuzzParam(&top, fuzzer))
1929 return false;
1930 if (!FuzzParam(&right, fuzzer))
1931 return false;
1932 if (!FuzzParam(&bottom, fuzzer))
1933 return false;
1934 *p = webrtc::DesktopRect::MakeLTRB(left, top, right, bottom);
1935 return true;
1936 }
1937 };
1938
1939 template <>
1940 struct FuzzTraits<webrtc::MouseCursor> {
1941 static bool Fuzz(webrtc::MouseCursor* p, Fuzzer* fuzzer) {
1942 webrtc::DesktopVector hotspot = p->hotspot();
1943 if (!FuzzParam(&hotspot, fuzzer))
1944 return false;
1945 p->set_hotspot(hotspot);
1946
1947 // TODO(mbarbella): Find a way to handle the size mutation properly.
1948 if (!fuzzer->ShouldGenerate())
1949 return false;
1950
1951 // Using a small size here to avoid OOM or overflow on image allocation.
1952 webrtc::DesktopSize size(RandInRange(100), RandInRange(100));
1953 p->set_image(new webrtc::BasicDesktopFrame(size));
1954 return true;
1955 }
1956 };
1957
1958 // Redefine macros to generate generating from traits declarations. 1877 // Redefine macros to generate generating from traits declarations.
1959 // STRUCT declarations cause corresponding STRUCT_TRAITS declarations to occur. 1878 // STRUCT declarations cause corresponding STRUCT_TRAITS declarations to occur.
1960 #undef IPC_STRUCT_BEGIN 1879 #undef IPC_STRUCT_BEGIN
1961 #undef IPC_STRUCT_BEGIN_WITH_PARENT 1880 #undef IPC_STRUCT_BEGIN_WITH_PARENT
1962 #undef IPC_STRUCT_MEMBER 1881 #undef IPC_STRUCT_MEMBER
1963 #undef IPC_STRUCT_END 1882 #undef IPC_STRUCT_END
1964 #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \ 1883 #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \
1965 IPC_STRUCT_BEGIN(struct_name) 1884 IPC_STRUCT_BEGIN(struct_name)
1966 #define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name) 1885 #define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name)
1967 #define IPC_STRUCT_MEMBER(type, name, ...) IPC_STRUCT_TRAITS_MEMBER(name) 1886 #define IPC_STRUCT_MEMBER(type, name, ...) IPC_STRUCT_TRAITS_MEMBER(name)
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" 2042 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h"
2124 #undef IPC_MESSAGE_DECL 2043 #undef IPC_MESSAGE_DECL
2125 #define IPC_MESSAGE_DECL(name, ...) \ 2044 #define IPC_MESSAGE_DECL(name, ...) \
2126 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; 2045 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz;
2127 2046
2128 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { 2047 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) {
2129 #include "tools/ipc_fuzzer/message_lib/all_messages.h" 2048 #include "tools/ipc_fuzzer/message_lib/all_messages.h"
2130 } 2049 }
2131 2050
2132 } // namespace ipc_fuzzer 2051 } // namespace ipc_fuzzer
OLDNEW
« no previous file with comments | « no previous file | tools/ipc_fuzzer/message_lib/all_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698