diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-09 14:22:11 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-05-09 15:11:45 +0000 |
commit | 2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c (patch) | |
tree | e75f511546c5fd1a173e87c1f9fb11d7ac8d1af3 /chromium/testing | |
parent | a4f3d46271c57e8155ba912df46a05559d14726e (diff) | |
download | qtwebengine-chromium-2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c.tar.gz |
BASELINE: Update Chromium to 51.0.2704.41
Also adds in all smaller components by reversing logic for exclusion.
Change-Id: Ibf90b506e7da088ea2f65dcf23f2b0992c504422
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'chromium/testing')
110 files changed, 3454 insertions, 8444 deletions
diff --git a/chromium/testing/android/junit/junit_test.gyp b/chromium/testing/android/junit/junit_test.gyp index 16e00488d10..6b9ab7a6eb7 100644 --- a/chromium/testing/android/junit/junit_test.gyp +++ b/chromium/testing/android/junit/junit_test.gyp @@ -34,6 +34,7 @@ 'src_paths': [ 'javatests/src', ], + 'wrapper_script_name': 'helper/<(_target_name)', }, 'includes': [ '../../../build/host_jar.gypi', diff --git a/chromium/testing/chromoting/app_remoting_integration_tests.isolate b/chromium/testing/chromoting/app_remoting_integration_tests.isolate deleted file mode 100644 index aa079ee4750..00000000000 --- a/chromium/testing/chromoting/app_remoting_integration_tests.isolate +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2015 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. -{ - 'conditions': [ - ['OS=="linux"', { - 'variables': { - 'command': [ - '../xvfb.py', - '<(PRODUCT_DIR)', - '<(PRODUCT_DIR)/ar_test_driver', - '--username=appremotingtestdriver_chromium_01@lgtestuser.com', - '--refresh-token-file=../../remoting/tools/internal/refresh_tokens.json', - '--show-host-availability', - '--release-hosts-after-tests', - '--verbosity=2', - '--v=2', - ], - 'files': [ - '../xvfb.py', - '../test_env.py', - '<(PRODUCT_DIR)/ar_test_driver', - '../../remoting/tools/internal/refresh_tokens.json', - ], - }, - }], - ['OS=="linux" and use_ozone==0', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/xdisplaycheck<(EXECUTABLE_SUFFIX)', - ], - }, - }], - ], - 'includes': [ - '../../base/base.isolate', - ], -} diff --git a/chromium/testing/chromoting/browser_test_commands_linux.txt b/chromium/testing/chromoting/browser_test_commands_linux.txt index 5754d03e775..6e7b487810f 100644 --- a/chromium/testing/chromoting/browser_test_commands_linux.txt +++ b/chromium/testing/chromoting/browser_test_commands_linux.txt @@ -1,4 +1,3 @@ /usr/bin/python ../xvfb.py #PROD_DIR# #PROD_DIR#/browser_tests --gtest_filter=RemoteDesktopBrowserTest.MANUAL_Launch:RemoteDesktopBrowserTest.MANUAL_Auth --run-manual --ui-test-action-timeout=100000 --webapp-unpacked=#PROD_DIR#/remoting/remoting.webapp.v2 --extension-name=Chromoting --accounts-file=../../remoting/tools/internal/test_accounts.json --account-type=gmail /usr/bin/python ../xvfb.py #PROD_DIR# #PROD_DIR#/browser_tests --gtest_filter=Me2MeBrowserTest.MANUAL_Me2Me_Connect_Remote_Host --run-manual --ui-test-action-timeout=100000 --webapp-unpacked=#PROD_DIR#/remoting/remoting.webapp.v2 --extension-name=Chromoting --accounts-file=../../remoting/tools/internal/test_accounts.json --account-type=gmail --me2me-pin=123456 --override-user-data-dir=/tmp/chromoting_test_profile --remote-host-name=crd-precise.kir.corp.google.com /usr/bin/python ../xvfb.py #PROD_DIR# #PROD_DIR#/browser_tests --gtest_filter=It2MeBrowserTest.MANUAL_CancelShare --run-manual --ui-test-action-timeout=100000 --webapp-unpacked=#PROD_DIR#/remoting/remoting.webapp.v2 --extension-name=Chromoting --accounts-file=../../remoting/tools/internal/test_accounts.json --account-type=gmail --override-user-data-dir=/tmp/chromoting_test_profile -cd ../../remoting/internal/config && /usr/bin/python ./is_valid_json.py
\ No newline at end of file diff --git a/chromium/testing/chromoting/browser_tests_launcher.py b/chromium/testing/chromoting/browser_tests_launcher.py index 0b549f33486..566b3344c37 100644 --- a/chromium/testing/chromoting/browser_tests_launcher.py +++ b/chromium/testing/chromoting/browser_tests_launcher.py @@ -11,6 +11,7 @@ from chromoting_test_utilities import CleanupUserProfileDir from chromoting_test_utilities import GetJidFromHostLog from chromoting_test_utilities import GetJidListFromTestResults from chromoting_test_utilities import InitialiseTestMachineForLinux +from chromoting_test_utilities import MAX_RETRIES from chromoting_test_utilities import PrintHostLogContents from chromoting_test_utilities import PROD_DIR_ID from chromoting_test_utilities import RunCommandInSubProcess @@ -23,7 +24,6 @@ FAILING_TESTS = '' BROWSER_NOT_STARTED_ERROR = ( 'Still waiting for the following processes to finish') TIME_OUT_INDICATOR = '(TIMED OUT)' -MAX_RETRIES = 1 def LaunchBTCommand(args, command): @@ -101,10 +101,11 @@ def LaunchBTCommand(args, command): # A line saying "Still waiting for the following processes to finish", # and, because sometimes that line gets logged even if the test # eventually passes, we'll also look for "(TIMED OUT)", before retrying. - if not ( - BROWSER_NOT_STARTED_ERROR in results and TIME_OUT_INDICATOR in results): - # Test failed for some other reason. Let's not retry. - break + if BROWSER_NOT_STARTED_ERROR in results and TIME_OUT_INDICATOR in results: + print 'Browser-instance not started (http://crbug/480025). Retrying.' + else: + print 'Test failed for unknown reason. Retrying.' + retries += 1 # Check that the test passed. diff --git a/chromium/testing/chromoting/chromoting_browser_tests.isolate b/chromium/testing/chromoting/chromoting_browser_tests.isolate index 1c81b5adcdc..2263b089da5 100644 --- a/chromium/testing/chromoting/chromoting_browser_tests.isolate +++ b/chromium/testing/chromoting/chromoting_browser_tests.isolate @@ -80,7 +80,6 @@ 'variables': { 'files': [ '<(PRODUCT_DIR)/<(mac_product_name).app/', - '<(PRODUCT_DIR)/exif.so', ], }, }], diff --git a/chromium/testing/chromoting/chromoting_test_driver_launcher.py b/chromium/testing/chromoting/chromoting_test_driver_launcher.py index 186adb9341d..73373441f55 100644 --- a/chromium/testing/chromoting/chromoting_test_driver_launcher.py +++ b/chromium/testing/chromoting/chromoting_test_driver_launcher.py @@ -8,6 +8,7 @@ import argparse from chromoting_test_utilities import GetJidFromHostLog from chromoting_test_utilities import InitialiseTestMachineForLinux +from chromoting_test_utilities import MAX_RETRIES from chromoting_test_utilities import PrintHostLogContents from chromoting_test_utilities import PROD_DIR_ID from chromoting_test_utilities import RunCommandInSubProcess @@ -40,22 +41,34 @@ def LaunchCTDCommand(args, command): print 'Host-JID not found in log %s.' % host_log_file_names[-1] return '[Command failed]: %s, %s' % (command, host_log_file_names) - # In order to ensure the host is online with the expected JID, pass in the - # jid obtained from the host-log as a command-line parameter. - command = command.replace('\n', '') + ' --hostjid=%s' % host_jid - - results = RunCommandInSubProcess(command) - - tear_down_index = results.find(TEST_ENVIRONMENT_TEAR_DOWN_INDICATOR) - if tear_down_index == -1: - # The test environment did not tear down. Something went horribly wrong. - return '[Command failed]: ' + command, host_log_file_names - - end_results_list = results[tear_down_index:].split('\n') + retries = 0 failed_tests_list = [] - for result in end_results_list: - if result.startswith(FAILED_INDICATOR): - failed_tests_list.append(result) + # TODO(anandc): Remove this retry-logic once http://crbug/570840 is fixed. + while retries <= MAX_RETRIES: + # In order to ensure the host is online with the expected JID, pass in the + # jid obtained from the host-log as a command-line parameter. + command = command.replace('\n', '') + ' --hostjid=%s' % host_jid + + results = RunCommandInSubProcess(command) + + tear_down_index = results.find(TEST_ENVIRONMENT_TEAR_DOWN_INDICATOR) + if tear_down_index == -1: + # The test environment did not tear down. Something went horribly wrong. + return '[Command failed]: ' + command, host_log_file_names + + end_results_list = results[tear_down_index:].split('\n') + test_failed = False + for result in end_results_list: + if result.startswith(FAILED_INDICATOR): + test_failed = True + if retries == MAX_RETRIES: + # Test failed and we have no more retries left. + failed_tests_list.append(result) + + if test_failed: + retries += 1 + else: + break if failed_tests_list: test_result = '[Command]: ' + command diff --git a/chromium/testing/chromoting/chromoting_test_utilities.py b/chromium/testing/chromoting/chromoting_test_utilities.py index 9d2d7a29ff1..0b25056117a 100644 --- a/chromium/testing/chromoting/chromoting_test_utilities.py +++ b/chromium/testing/chromoting/chromoting_test_utilities.py @@ -29,6 +29,7 @@ ISOLATE_CHROMOTING_HOST_PATH = 'remoting/host/linux/linux_me2me_host.py' ISOLATE_TEMP_FOLDER = os.path.abspath(os.path.join(os.getcwd(), '../..')) CHROMOTING_HOST_PATH = os.path.join(ISOLATE_TEMP_FOLDER, ISOLATE_CHROMOTING_HOST_PATH) +MAX_RETRIES = 1 class HostOperationFailedException(Exception): diff --git a/chromium/testing/chromoting/dependencies.gypi b/chromium/testing/chromoting/dependencies.gypi index 7a0b9b27be1..e0180b83cbd 100644 --- a/chromium/testing/chromoting/dependencies.gypi +++ b/chromium/testing/chromoting/dependencies.gypi @@ -18,7 +18,6 @@ 'dependencies': [ '../../remoting/remoting.gyp:chromoting_test_driver', '../../remoting/remoting.gyp:remoting_me2me_host_archive', - '../../remoting/internal/app_remoting_all.gyp:ar_test_driver', ], }], # OS=="linux" ], diff --git a/chromium/testing/chromoting/integration_tests.gyp b/chromium/testing/chromoting/integration_tests.gyp index 38d4609646f..3a9ad533167 100644 --- a/chromium/testing/chromoting/integration_tests.gyp +++ b/chromium/testing/chromoting/integration_tests.gyp @@ -13,15 +13,6 @@ ['OS=="linux"', { 'targets': [ { - 'target_name': 'app_remoting_integration_tests_run', - 'includes': [ - './dependencies.gypi', - ], - 'sources': [ - 'app_remoting_integration_tests.isolate', - ], - }, # target_name: 'app_remoting_integration_tests_run' - { 'target_name': 'chromoting_integration_tests_run', 'includes': [ './dependencies.gypi', diff --git a/chromium/testing/generate_gmock_mutant.py b/chromium/testing/generate_gmock_mutant.py deleted file mode 100755 index b881cd99c95..00000000000 --- a/chromium/testing/generate_gmock_mutant.py +++ /dev/null @@ -1,451 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2012 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. - -import string -import sys - -HEADER = """\ -// Copyright (c) 2013 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. - -// This file automatically generated by testing/generate_gmock_mutant.py. -// DO NOT EDIT. - -#ifndef TESTING_GMOCK_MUTANT_H_ -#define TESTING_GMOCK_MUTANT_H_ - -// The intention of this file is to make possible using GMock actions in -// all of its syntactic beauty. Classes and helper functions can be used as -// more generic variants of Task and Callback classes (see base/task.h) -// Mutant supports both pre-bound arguments (like Task) and call-time -// arguments (like Callback) - hence the name. :-) -// -// DispatchToMethod/Function supports two sets of arguments: pre-bound (P) and -// call-time (C). The arguments as well as the return type are templatized. -// DispatchToMethod/Function will also try to call the selected method or -// function even if provided pre-bound arguments does not match exactly with -// the function signature hence the X1, X2 ... XN parameters in CreateFunctor. -// DispatchToMethod will try to invoke method that may not belong to the -// object's class itself but to the object's class base class. -// -// Additionally you can bind the object at calltime by binding a pointer to -// pointer to the object at creation time - before including this file you -// have to #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING. -// -// TODO(stoyan): It's yet not clear to me should we use T& and T&* instead -// of T* and T** when we invoke CreateFunctor to match the EXPECT_CALL style. -// -// -// Sample usage with gMock: -// -// struct Mock : public ObjectDelegate { -// MOCK_METHOD2(string, OnRequest(int n, const string& request)); -// MOCK_METHOD1(void, OnQuit(int exit_code)); -// MOCK_METHOD2(void, LogMessage(int level, const string& message)); -// -// string HandleFlowers(const string& reply, int n, const string& request) { -// string result = SStringPrintf("In request of %d %s ", n, request); -// for (int i = 0; i < n; ++i) result.append(reply) -// return result; -// } -// -// void DoLogMessage(int level, const string& message) { -// } -// -// void QuitMessageLoop(int seconds) { -// base::MessageLoop* loop = base::MessageLoop::current(); -// loop->PostDelayedTask(FROM_HERE, -// base::MessageLoop::QuitWhenIdleClosure(), -// 1000 * seconds); -// } -// }; -// -// Mock mock; -// // Will invoke mock.HandleFlowers("orchids", n, request) -// // "orchids" is a pre-bound argument, and <n> and <request> are call-time -// // arguments - they are not known until the OnRequest mock is invoked. -// EXPECT_CALL(mock, OnRequest(Ge(5), base::StartsWith("flower")) -// .Times(1) -// .WillOnce(Invoke(CreateFunctor(&mock, &Mock::HandleFlowers, -// string("orchids")))); -// -// -// // No pre-bound arguments, two call-time arguments passed -// // directly to DoLogMessage -// EXPECT_CALL(mock, OnLogMessage(_, _)) -// .Times(AnyNumber()) -// .WillAlways(Invoke(CreateFunctor, &mock, &Mock::DoLogMessage)); -// -// -// // In this case we have a single pre-bound argument - 3. We ignore -// // all of the arguments of OnQuit. -// EXCEPT_CALL(mock, OnQuit(_)) -// .Times(1) -// .WillOnce(InvokeWithoutArgs(CreateFunctor( -// &mock, &Mock::QuitMessageLoop, 3))); -// -// MessageLoop loop; -// loop.Run(); -// -// -// // Here is another example of how we can set an action that invokes -// // method of an object that is not yet created. -// struct Mock : public ObjectDelegate { -// MOCK_METHOD1(void, DemiurgeCreated(Demiurge*)); -// MOCK_METHOD2(void, OnRequest(int count, const string&)); -// -// void StoreDemiurge(Demiurge* w) { -// demiurge_ = w; -// } -// -// Demiurge* demiurge; -// } -// -// EXPECT_CALL(mock, DemiurgeCreated(_)).Times(1) -// .WillOnce(Invoke(CreateFunctor(&mock, &Mock::StoreDemiurge))); -// -// EXPECT_CALL(mock, OnRequest(_, StrEq("Moby Dick"))) -// .Times(AnyNumber()) -// .WillAlways(WithArgs<0>(Invoke( -// CreateFunctor(&mock->demiurge_, &Demiurge::DecreaseMonsters)))); -// - -#include "base/memory/linked_ptr.h" -#include "base/tuple.h" - -namespace testing {""" - -MUTANT = """\ - -// Interface that is exposed to the consumer, that does the actual calling -// of the method. -template <typename R, typename Params> -class MutantRunner { - public: - virtual R RunWithParams(const Params& params) = 0; - virtual ~MutantRunner() {} -}; - -// Mutant holds pre-bound arguments (like Task). Like Callback -// allows call-time arguments. You bind a pointer to the object -// at creation time. -template <typename R, typename T, typename Method, - typename PreBound, typename Params> -class Mutant : public MutantRunner<R, Params> { - public: - Mutant(T* obj, Method method, const PreBound& pb) - : obj_(obj), method_(method), pb_(pb) { - } - - // MutantRunner implementation - virtual R RunWithParams(const Params& params) { - return DispatchToMethod<R>(this->obj_, this->method_, pb_, params); - } - - T* obj_; - Method method_; - PreBound pb_; -}; - -template <typename R, typename Function, typename PreBound, typename Params> -class MutantFunction : public MutantRunner<R, Params> { - public: - MutantFunction(Function function, const PreBound& pb) - : function_(function), pb_(pb) { - } - - // MutantRunner implementation - virtual R RunWithParams(const Params& params) { - return DispatchToFunction<R>(function_, pb_, params); - } - - Function function_; - PreBound pb_; -}; - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -// MutantLateBind is like Mutant, but you bind a pointer to a pointer -// to the object. This way you can create actions for an object -// that is not yet created (has only storage for a pointer to it). -template <typename R, typename T, typename Method, - typename PreBound, typename Params> -class MutantLateObjectBind : public MutantRunner<R, Params> { - public: - MutantLateObjectBind(T** obj, Method method, const PreBound& pb) - : obj_(obj), method_(method), pb_(pb) { - } - - // MutantRunner implementation. - virtual R RunWithParams(const Params& params) { - EXPECT_THAT(*this->obj_, testing::NotNull()); - if (NULL == *this->obj_) - return R(); - return DispatchToMethod<R>( *this->obj_, this->method_, pb_, params); - } - - T** obj_; - Method method_; - PreBound pb_; -}; -#endif - -// Simple MutantRunner<> wrapper acting as a functor. -// Redirects operator() to MutantRunner<Params>::Run() -template <typename R, typename Params> -struct MutantFunctor { - explicit MutantFunctor(MutantRunner<R, Params>* cb) : impl_(cb) { - } - - ~MutantFunctor() { - } - - inline R operator()() { - return impl_->RunWithParams(base::Tuple<>()); - } - - template <typename Arg1> - inline R operator()(const Arg1& a) { - return impl_->RunWithParams(Params(a)); - } - - template <typename Arg1, typename Arg2> - inline R operator()(const Arg1& a, const Arg2& b) { - return impl_->RunWithParams(Params(a, b)); - } - - template <typename Arg1, typename Arg2, typename Arg3> - inline R operator()(const Arg1& a, const Arg2& b, const Arg3& c) { - return impl_->RunWithParams(Params(a, b, c)); - } - - template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> - inline R operator()(const Arg1& a, const Arg2& b, const Arg3& c, - const Arg4& d) { - return impl_->RunWithParams(Params(a, b, c, d)); - } - - private: - // We need copy constructor since MutantFunctor is copied few times - // inside GMock machinery, hence no DISALLOW_EVIL_CONTRUCTORS - MutantFunctor(); - linked_ptr<MutantRunner<R, Params> > impl_; -}; -""" - -FOOTER = """\ -} // namespace testing - -#endif // TESTING_GMOCK_MUTANT_H_""" - -# Templates for DispatchToMethod/DispatchToFunction functions. -# template_params - typename P1, typename P2.. typename C1.. -# prebound - Tuple<P1, .. PN> -# calltime - Tuple<C1, .. CN> -# args - p.a, p.b.., c.a, c.b.. -DISPATCH_TO_METHOD_TEMPLATE = """\ -template <typename R, typename T, typename Method, %(template_params)s> -inline R DispatchToMethod(T* obj, Method method, - const %(prebound)s& p, - const %(calltime)s& c) { - return (obj->*method)(%(args)s); -} -""" - -DISPATCH_TO_FUNCTION_TEMPLATE = """\ -template <typename R, typename Function, %(template_params)s> -inline R DispatchToFunction(Function function, - const %(prebound)s& p, - const %(calltime)s& c) { - return (*function)(%(args)s); -} -""" - -# Templates for CreateFunctor functions. -# template_params - typename P1, typename P2.. typename C1.. typename X1.. -# prebound - Tuple<P1, .. PN> -# calltime - Tuple<A1, .. AN> -# params - X1,.. , A1, .. -# args - const P1& p1 .. -# call_args - p1, p2, p3.. -CREATE_METHOD_FUNCTOR_TEMPLATE = """\ -template <typename R, typename T, typename U, %(template_params)s> -inline MutantFunctor<R, %(calltime)s> -CreateFunctor(T* obj, R (U::*method)(%(params)s), %(args)s) { - MutantRunner<R, %(calltime)s>* t = - new Mutant<R, T, R (U::*)(%(params)s), - %(prebound)s, %(calltime)s> - (obj, method, base::MakeTuple(%(call_args)s)); - return MutantFunctor<R, %(calltime)s>(t); -} -""" - -CREATE_FUNCTION_FUNCTOR_TEMPLATE = """\ -template <typename R, %(template_params)s> -inline MutantFunctor<R, %(calltime)s> -CreateFunctor(R (*function)(%(params)s), %(args)s) { - MutantRunner<R, %(calltime)s>* t = - new MutantFunction<R, R (*)(%(params)s), - %(prebound)s, %(calltime)s> - (function, base::MakeTuple(%(call_args)s)); - return MutantFunctor<R, %(calltime)s>(t); -} -""" - -def SplitLine(line, width): - """Splits a single line at comma, at most |width| characters long.""" - if len(line) <= width: - return (line, None) - n = 1 + line[:width].rfind(",") - if n == 0: # If comma cannot be found give up and return the entire line. - return (line, None) - # Assume there is a space after the comma - assert line[n] == " " - return (line[:n], line[n + 1:]) - - -def Wrap(s, width, subsequent_offset): - """Wraps a single line |s| at commas so every line is at most |width| - characters long. - """ - w = [] - spaces = " " * subsequent_offset - while s: - (f, s) = SplitLine(s, width) - w.append(f) - if s: - s = spaces + s - return "\n".join(w) - - -def Clean(s): - """Cleans artifacts from generated C++ code. - - Our simple string formatting/concatenation may introduce extra commas. - """ - s = s.replace(", >", ">") - s = s.replace(", )", ")") - return s - - -def ExpandPattern(pattern, it): - """Return list of expanded pattern strings. - - Each string is created by replacing all '%' in |pattern| with element of |it|. - """ - return [pattern.replace("%", x) for x in it] - - -def Gen(pattern, n, start): - """Expands pattern replacing '%' with sequential integers starting with start. - - Expanded patterns will be joined with comma separator. - Gen("X%", 3, 1) will return "X1, X2, X3". - """ - it = string.hexdigits[start:n + start] - return ", ".join(ExpandPattern(pattern, it)) - - -def Merge(a): - return ", ".join(filter(len, a)) - - -def GenTuple(pattern, n): - return Clean("base::Tuple<%s>" % (Gen(pattern, n, 1))) - - -def FixCode(s): - lines = Clean(s).splitlines() - # Wrap sometimes very long 1st line to be inside the "template <" - lines[0] = Wrap(lines[0], 80, 10) - - # Wrap all subsequent lines to 6 spaces arbitrarily. This is a 2-space line - # indent, plus a 4 space continuation indent. - for line in xrange(1, len(lines)): - lines[line] = Wrap(lines[line], 80, 6) - return "\n".join(lines) - - -def GenerateDispatch(prebound, calltime): - print "\n// %d - %d" % (prebound, calltime) - args = { - "template_params": Merge([Gen("typename P%", prebound, 1), - Gen("typename C%", calltime, 1)]), - "prebound": GenTuple("P%", prebound), - "calltime": GenTuple("C%", calltime), - "args": Merge([Gen("base::get<%>(p)", prebound, 0), - Gen("base::get<%>(c)", calltime, 0)]), - } - - print FixCode(DISPATCH_TO_METHOD_TEMPLATE % args) - print FixCode(DISPATCH_TO_FUNCTION_TEMPLATE % args) - - -def GenerateCreateFunctor(prebound, calltime): - print "// %d - %d" % (prebound, calltime) - args = { - "calltime": GenTuple("A%", calltime), - "prebound": GenTuple("P%", prebound), - "params": Merge([Gen("X%", prebound, 1), Gen("A%", calltime, 1)]), - "args": Gen("const P%& p%", prebound, 1), - "call_args": Gen("p%", prebound, 1), - "template_params": Merge([Gen("typename P%", prebound, 1), - Gen("typename A%", calltime, 1), - Gen("typename X%", prebound, 1)]) - } - - mutant = FixCode(CREATE_METHOD_FUNCTOR_TEMPLATE % args) - print mutant - - # Slightly different version for free function call. - print "\n", FixCode(CREATE_FUNCTION_FUNCTOR_TEMPLATE % args) - - # Functor with pointer to a pointer of the object. - print "\n#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" - mutant2 = mutant.replace("CreateFunctor(T* obj,", "CreateFunctor(T** obj,") - mutant2 = mutant2.replace("new Mutant", "new MutantLateObjectBind") - mutant2 = mutant2.replace(" " * 17 + "Tuple", " " * 31 + "Tuple") - print mutant2 - print "#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING\n" - - # OS_WIN specific. Same functors but with stdcall calling conventions. - # These are not for WIN64 (x86_64) because there is only one calling - # convention in WIN64. - # Functor for method with __stdcall calling conventions. - print "#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64)" - stdcall_method = CREATE_METHOD_FUNCTOR_TEMPLATE - stdcall_method = stdcall_method.replace("U::", "__stdcall U::") - stdcall_method = FixCode(stdcall_method % args) - print stdcall_method - # Functor for free function with __stdcall calling conventions. - stdcall_function = CREATE_FUNCTION_FUNCTOR_TEMPLATE - stdcall_function = stdcall_function.replace("R (*", "R (__stdcall *") - print "\n", FixCode(stdcall_function % args) - - print "#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" - stdcall2 = stdcall_method - stdcall2 = stdcall2.replace("CreateFunctor(T* obj,", "CreateFunctor(T** obj,") - stdcall2 = stdcall2.replace("new Mutant", "new MutantLateObjectBind") - stdcall2 = stdcall2.replace(" " * 17 + "Tuple", " " * 31 + "Tuple") - print stdcall2 - print "#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" - print "#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64)\n" - - -def main(): - print HEADER - for prebound in xrange(0, 6 + 1): - for args in xrange(0, 6 + 1): - GenerateDispatch(prebound, args) - print MUTANT - for prebound in xrange(0, 6 + 1): - for args in xrange(0, 6 + 1): - GenerateCreateFunctor(prebound, args) - print FOOTER - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/chromium/testing/gmock_mutant.h b/chromium/testing/gmock_mutant.h index f8491192cc7..961673fa110 100644 --- a/chromium/testing/gmock_mutant.h +++ b/chromium/testing/gmock_mutant.h @@ -2,32 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This file automatically generated by testing/generate_gmock_mutant.py. -// DO NOT EDIT. - #ifndef TESTING_GMOCK_MUTANT_H_ #define TESTING_GMOCK_MUTANT_H_ // The intention of this file is to make possible using GMock actions in -// all of its syntactic beauty. Classes and helper functions can be used as -// more generic variants of Task and Callback classes (see base/task.h) -// Mutant supports both pre-bound arguments (like Task) and call-time -// arguments (like Callback) - hence the name. :-) -// -// DispatchToMethod/Function supports two sets of arguments: pre-bound (P) and -// call-time (C). The arguments as well as the return type are templatized. -// DispatchToMethod/Function will also try to call the selected method or -// function even if provided pre-bound arguments does not match exactly with -// the function signature hence the X1, X2 ... XN parameters in CreateFunctor. -// DispatchToMethod will try to invoke method that may not belong to the -// object's class itself but to the object's class base class. -// -// Additionally you can bind the object at calltime by binding a pointer to -// pointer to the object at creation time - before including this file you -// have to #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING. -// -// TODO(stoyan): It's yet not clear to me should we use T& and T&* instead -// of T* and T** when we invoke CreateFunctor to match the EXPECT_CALL style. +// all of its syntactic beauty. // // // Sample usage with gMock: @@ -60,15 +39,16 @@ // // arguments - they are not known until the OnRequest mock is invoked. // EXPECT_CALL(mock, OnRequest(Ge(5), base::StartsWith("flower")) // .Times(1) -// .WillOnce(Invoke(CreateFunctor(&mock, &Mock::HandleFlowers, -// string("orchids")))); +// .WillOnce(Invoke(CreateFunctor( +// &Mock::HandleFlowers, base::Unretained(&mock), string("orchids")))); // // // // No pre-bound arguments, two call-time arguments passed // // directly to DoLogMessage // EXPECT_CALL(mock, OnLogMessage(_, _)) // .Times(AnyNumber()) -// .WillAlways(Invoke(CreateFunctor, &mock, &Mock::DoLogMessage)); +// .WillAlways(Invoke(CreateFunctor( +// &Mock::DoLogMessage, base::Unretained(&mock)))); // // // // In this case we have a single pre-bound argument - 3. We ignore @@ -76,7 +56,7 @@ // EXCEPT_CALL(mock, OnQuit(_)) // .Times(1) // .WillOnce(InvokeWithoutArgs(CreateFunctor( -// &mock, &Mock::QuitMessageLoop, 3))); +// &Mock::QuitMessageLoop, base::Unretained(&mock), 3))); // // MessageLoop loop; // loop.Run(); @@ -96,5082 +76,48 @@ // } // // EXPECT_CALL(mock, DemiurgeCreated(_)).Times(1) -// .WillOnce(Invoke(CreateFunctor(&mock, &Mock::StoreDemiurge))); +// .WillOnce(Invoke(CreateFunctor( +// &Mock::StoreDemiurge, base::Unretained(&mock)))); // // EXPECT_CALL(mock, OnRequest(_, StrEq("Moby Dick"))) // .Times(AnyNumber()) -// .WillAlways(WithArgs<0>(Invoke( -// CreateFunctor(&mock->demiurge_, &Demiurge::DecreaseMonsters)))); +// .WillAlways(WithArgs<0>(Invoke(CreateFunctor( +// &Demiurge::DecreaseMonsters, base::Unretained(&mock->demiurge_))))); // -#include "base/memory/linked_ptr.h" -#include "base/tuple.h" +#include "base/bind.h" namespace testing { -// 0 - 0 -template <typename R, typename T, typename Method> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<>& c) { - return (obj->*method)(); -} -template <typename R, typename Function> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<>& c) { - return (*function)(); -} - -// 0 - 1 -template <typename R, typename T, typename Method, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(c)); -} -template <typename R, typename Function, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(c)); -} - -// 0 - 2 -template <typename R, typename T, typename Method, typename C1, typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(c), base::get<1>(c)); -} -template <typename R, typename Function, typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(c), base::get<1>(c)); -} - -// 0 - 3 -template <typename R, typename T, typename Method, typename C1, typename C2, - typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} -template <typename R, typename Function, typename C1, typename C2, typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} - -// 0 - 4 -template <typename R, typename T, typename Method, typename C1, typename C2, - typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c)); -} -template <typename R, typename Function, typename C1, typename C2, typename C3, - typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c)); -} - -// 0 - 5 -template <typename R, typename T, typename Method, typename C1, typename C2, - typename C3, typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename C1, typename C2, typename C3, - typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c)); -} - -// 0 - 6 -template <typename R, typename T, typename Method, typename C1, typename C2, - typename C3, typename C4, typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} -template <typename R, typename Function, typename C1, typename C2, typename C3, - typename C4, typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} - -// 1 - 0 -template <typename R, typename T, typename Method, typename P1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p)); -} -template <typename R, typename Function, typename P1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p)); -} - -// 1 - 1 -template <typename R, typename T, typename Method, typename P1, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<0>(c)); -} - -// 1 - 2 -template <typename R, typename T, typename Method, typename P1, typename C1, - typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c), base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<0>(c), base::get<1>(c)); -} - -// 1 - 3 -template <typename R, typename T, typename Method, typename P1, typename C1, - typename C2, typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename C1, typename C2, - typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c)); -} - -// 1 - 4 -template <typename R, typename T, typename Method, typename P1, typename C1, - typename C2, typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename C1, typename C2, - typename C3, typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c)); -} - -// 1 - 5 -template <typename R, typename T, typename Method, typename P1, typename C1, - typename C2, typename C3, typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename C1, typename C2, - typename C3, typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} - -// 1 - 6 -template <typename R, typename T, typename Method, typename P1, typename C1, - typename C2, typename C3, typename C4, typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename C1, typename C2, - typename C3, typename C4, typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} - -// 2 - 0 -template <typename R, typename T, typename Method, typename P1, typename P2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p)); -} -template <typename R, typename Function, typename P1, typename P2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p), base::get<1>(p)); -} - -// 2 - 1 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c)); -} - -// 2 - 2 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1, typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1, - typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c)); -} - -// 2 - 3 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1, typename C2, typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1, - typename C2, typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c)); -} - -// 2 - 4 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1, typename C2, typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1, - typename C2, typename C3, typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} - -// 2 - 5 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1, typename C2, typename C3, typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1, - typename C2, typename C3, typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} - -// 2 - 6 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename C1, typename C2, typename C3, typename C4, typename C5, - typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c), - base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename C1, - typename C2, typename C3, typename C4, typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c), - base::get<5>(c)); -} - -// 3 - 0 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p)); -} - -// 3 - 1 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c)); -} - -// 3 - 2 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1, typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c)); -} - -// 3 - 3 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1, typename C2, typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1, typename C2, typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} - -// 3 - 4 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1, typename C2, typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1, typename C2, typename C3, typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} - -// 3 - 5 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1, typename C2, typename C3, typename C4, - typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c), - base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1, typename C2, typename C3, typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c), - base::get<4>(c)); -} - -// 3 - 6 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename C1, typename C2, typename C3, typename C4, - typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c), - base::get<4>(c), base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename C1, typename C2, typename C3, typename C4, typename C5, - typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<0>(c), base::get<1>(c), base::get<2>(c), base::get<3>(c), - base::get<4>(c), base::get<5>(c)); -} - -// 4 - 0 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p)); -} - -// 4 - 1 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c)); -} - -// 4 - 2 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1, typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c)); -} - -// 4 - 3 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1, typename C2, typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1, typename C2, typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c)); -} - -// 4 - 4 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1, typename C2, typename C3, - typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1, typename C2, typename C3, typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c)); -} - -// 4 - 5 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1, typename C2, typename C3, - typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1, typename C2, typename C3, typename C4, - typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c)); -} - -// 4 - 6 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename C1, typename C2, typename C3, - typename C4, typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename C1, typename C2, typename C3, typename C4, - typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<0>(c), base::get<1>(c), base::get<2>(c), - base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} - -// 5 - 0 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p)); -} - -// 5 - 1 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c)); -} - -// 5 - 2 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1, typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c)); -} - -// 5 - 3 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1, typename C2, - typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1, typename C2, typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c)); -} - -// 5 - 4 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1, typename C2, - typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1, typename C2, typename C3, - typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c)); -} - -// 5 - 5 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1, typename C2, - typename C3, typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1, typename C2, typename C3, - typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} - -// 5 - 6 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename C1, typename C2, - typename C3, typename C4, typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename C1, typename C2, typename C3, - typename C4, typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<0>(c), base::get<1>(c), - base::get<2>(c), base::get<3>(c), base::get<4>(c), base::get<5>(c)); -} - -// 6 - 0 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p)); -} - -// 6 - 1 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c)); -} - -// 6 - 2 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1, - typename C2> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1, typename C2> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c)); -} - -// 6 - 3 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1, - typename C2, typename C3> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1, typename C2, - typename C3> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c)); -} - -// 6 - 4 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1, - typename C2, typename C3, typename C4> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1, typename C2, - typename C3, typename C4> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c)); -} - -// 6 - 5 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1, - typename C2, typename C3, typename C4, typename C5> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1, typename C2, - typename C3, typename C4, typename C5> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4, C5>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c)); -} +template <typename Signature> +class CallbackToFunctorHelper; -// 6 - 6 -template <typename R, typename T, typename Method, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename C1, - typename C2, typename C3, typename C4, typename C5, typename C6> -inline R DispatchToMethod(T* obj, Method method, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (obj->*method)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c), - base::get<5>(c)); -} -template <typename R, typename Function, typename P1, typename P2, typename P3, - typename P4, typename P5, typename P6, typename C1, typename C2, - typename C3, typename C4, typename C5, typename C6> -inline R DispatchToFunction(Function function, - const base::Tuple<P1, P2, P3, P4, P5, P6>& p, - const base::Tuple<C1, C2, C3, C4, C5, C6>& c) { - return (*function)(base::get<0>(p), base::get<1>(p), base::get<2>(p), - base::get<3>(p), base::get<4>(p), base::get<5>(p), base::get<0>(c), - base::get<1>(c), base::get<2>(c), base::get<3>(c), base::get<4>(c), - base::get<5>(c)); -} - -// Interface that is exposed to the consumer, that does the actual calling -// of the method. -template <typename R, typename Params> -class MutantRunner { - public: - virtual R RunWithParams(const Params& params) = 0; - virtual ~MutantRunner() {} -}; - -// Mutant holds pre-bound arguments (like Task). Like Callback -// allows call-time arguments. You bind a pointer to the object -// at creation time. -template <typename R, typename T, typename Method, - typename PreBound, typename Params> -class Mutant : public MutantRunner<R, Params> { +template <typename R, typename... Args> +class CallbackToFunctorHelper<R(Args...)> { public: - Mutant(T* obj, Method method, const PreBound& pb) - : obj_(obj), method_(method), pb_(pb) { - } - - // MutantRunner implementation - virtual R RunWithParams(const Params& params) { - return DispatchToMethod<R>(this->obj_, this->method_, pb_, params); - } - - T* obj_; - Method method_; - PreBound pb_; -}; - -template <typename R, typename Function, typename PreBound, typename Params> -class MutantFunction : public MutantRunner<R, Params> { - public: - MutantFunction(Function function, const PreBound& pb) - : function_(function), pb_(pb) { - } - - // MutantRunner implementation - virtual R RunWithParams(const Params& params) { - return DispatchToFunction<R>(function_, pb_, params); - } - - Function function_; - PreBound pb_; -}; - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -// MutantLateBind is like Mutant, but you bind a pointer to a pointer -// to the object. This way you can create actions for an object -// that is not yet created (has only storage for a pointer to it). -template <typename R, typename T, typename Method, - typename PreBound, typename Params> -class MutantLateObjectBind : public MutantRunner<R, Params> { - public: - MutantLateObjectBind(T** obj, Method method, const PreBound& pb) - : obj_(obj), method_(method), pb_(pb) { - } - - // MutantRunner implementation. - virtual R RunWithParams(const Params& params) { - EXPECT_THAT(*this->obj_, testing::NotNull()); - if (NULL == *this->obj_) - return R(); - return DispatchToMethod<R>( *this->obj_, this->method_, pb_, params); - } - - T** obj_; - Method method_; - PreBound pb_; -}; -#endif - -// Simple MutantRunner<> wrapper acting as a functor. -// Redirects operator() to MutantRunner<Params>::Run() -template <typename R, typename Params> -struct MutantFunctor { - explicit MutantFunctor(MutantRunner<R, Params>* cb) : impl_(cb) { - } - - ~MutantFunctor() { - } - - inline R operator()() { - return impl_->RunWithParams(base::Tuple<>()); - } - - template <typename Arg1> - inline R operator()(const Arg1& a) { - return impl_->RunWithParams(Params(a)); - } + explicit CallbackToFunctorHelper(const base::Callback<R(Args...)>& cb) + : cb_(cb) {} - template <typename Arg1, typename Arg2> - inline R operator()(const Arg1& a, const Arg2& b) { - return impl_->RunWithParams(Params(a, b)); - } - - template <typename Arg1, typename Arg2, typename Arg3> - inline R operator()(const Arg1& a, const Arg2& b, const Arg3& c) { - return impl_->RunWithParams(Params(a, b, c)); - } - - template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> - inline R operator()(const Arg1& a, const Arg2& b, const Arg3& c, - const Arg4& d) { - return impl_->RunWithParams(Params(a, b, c, d)); + template <typename... RunArgs> + R operator()(RunArgs&&... args) { + return cb_.Run(std::forward<RunArgs>(args)...); } private: - // We need copy constructor since MutantFunctor is copied few times - // inside GMock machinery, hence no DISALLOW_EVIL_CONTRUCTORS - MutantFunctor(); - linked_ptr<MutantRunner<R, Params> > impl_; + base::Callback<R(Args...)> cb_; }; -// 0 - 0 -template <typename R, typename T, typename U> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)()) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(), - base::Tuple<>, base::Tuple<>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)()) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(), - base::Tuple<>, base::Tuple<>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)()) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(), - base::Tuple<>, base::Tuple<>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)()) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(), - base::Tuple<>, base::Tuple<>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)()) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(), - base::Tuple<>, base::Tuple<>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)()) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(), - base::Tuple<>, base::Tuple<>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 1 -template <typename R, typename T, typename U, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(A1), - base::Tuple<>, base::Tuple<A1>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(A1), - base::Tuple<>, base::Tuple<A1>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1), - base::Tuple<>, base::Tuple<A1>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1), - base::Tuple<>, base::Tuple<A1>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(A1), - base::Tuple<>, base::Tuple<A1>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1)) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1), - base::Tuple<>, base::Tuple<A1>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 2 -template <typename R, typename T, typename U, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1, A2)) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1, A2), - base::Tuple<>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 3 -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename A1, typename A2, typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename A1, typename A2, typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1, A2, A3)) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1, A2, A3), - base::Tuple<>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 4 -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1, A2, A3, A4)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1, A2, A3, A4), - base::Tuple<>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 5 -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4, - typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4, - typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1, A2, A3, A4, A5)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1, A2, A3, A4, A5), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 0 - 6 -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (function, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(A1, A2, A3, A4, A5, A6)) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(A1, A2, A3, A4, A5, A6), - base::Tuple<>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple()); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 0 -template <typename R, typename T, typename U, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1), - base::Tuple<P1>, base::Tuple<>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1), - base::Tuple<P1>, base::Tuple<>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1), - base::Tuple<P1>, base::Tuple<>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1), - base::Tuple<P1>, base::Tuple<>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1), - base::Tuple<P1>, base::Tuple<>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename X1> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1), const P1& p1) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1), - base::Tuple<P1>, base::Tuple<>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 1 -template <typename R, typename T, typename U, typename P1, typename A1, - typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename A1, typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename A1, typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename X1> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1), const P1& p1) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1), - base::Tuple<P1>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 2 -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1, A2), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1, A2), - base::Tuple<P1>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 3 -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1, A2, A3), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1, A2, A3), - base::Tuple<P1>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 4 -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, A1, A2, A3, A4), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, A1, A2, A3, A4), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, A1, A2, A3, A4), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, A1, A2, A3, A4), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 5 -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, A1, A2, A3, A4, A5), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, A1, A2, A3, A4, A5), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, A1, A2, A3, A4, A5), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4, A5), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, A1, A2, A3, A4, A5), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4, A5), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4, A5), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 1 - 6 -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, A1, A2, A3, A4, A5, A6), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, A1, A2, A3, A4, A5, A6), const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, A1, A2, A3, A4, A5, A6), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4, A5, A6), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, A1, A2, A3, A4, A5, A6), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (function, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, A1, A2, A3, A4, A5, A6), - const P1& p1) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, A1, A2, A3, A4, A5, A6), - base::Tuple<P1>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 0 -template <typename R, typename T, typename U, typename P1, typename P2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1, X2), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1, X2), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1, X2), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1, X2), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2), - base::Tuple<P1, P2>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 1 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, X2, A1), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1), - base::Tuple<P1, P2>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 2 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); +template <typename Signature> +CallbackToFunctorHelper<Signature> +CallbackToFunctor(const base::Callback<Signature>& cb) { + return CallbackToFunctorHelper<Signature>(cb); } -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, X2, A1, A2), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1, A2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1, A2), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1, A2), - base::Tuple<P1, P2>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 3 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2, A3), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, X2, A1, A2, A3), const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2, A3), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1, A2, A3), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 4 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2, A3, A4), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, X2, A1, A2, A3, A4), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2, A3, A4), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1, A2, A3, A4), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 5 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, X2, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4, A5), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 2 - 6 -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, X2, A1, A2, A3, A4, A5, A6), const P1& p1, - const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, X2, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (function, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 0 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1, X2, X3), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3), - base::Tuple<P1, P2, P3>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 1 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, X2, X3, A1), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1), - base::Tuple<P1, P2, P3>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 2 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, X2, X3, A1, A2), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1, A2), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 3 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, X2, X3, A1, A2, A3), const P1& p1, const P2& p2, - const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 4 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 5 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, X2, X3, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, - A5>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, - A5>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 3 - 6 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, X2, X3, A1, A2, A3, A4, A5, A6), const P1& p1, - const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (function, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3>, base::Tuple<A1, A2, A3, A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 0 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1, X2, X3, X4), const P1& p1, const P2& p2, - const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 1 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1), const P1& p1, const P2& p2, - const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 2 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2), const P1& p1, const P2& p2, - const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 3 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 4 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename X1, - typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 5 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2, A3, A4, A5), const P1& p1, - const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, - A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, - A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 4 - 6 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, - A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5, - A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename X1, typename X2, typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, A1, A2, A3, A4, A5, - A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, A1, A2, A3, A4, - A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, A1, A2, A3, A4, A5, - A6), - base::Tuple<P1, P2, P3, P4>, base::Tuple<A1, A2, A3, A4, A5, - A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 0 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5), const P1& p1, const P2& p2, - const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 1 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1), const P1& p1, const P2& p2, - const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 2 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 3 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 4 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1, A2, A3, A4), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename X1, typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 5 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4, A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename A5, typename X1, typename X2, typename X3, typename X4, - typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename X1, typename X2, - typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4, A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 5 - 6 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4, A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename X1, typename X2, typename X3, - typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, - A3, A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename A1, typename A2, - typename A3, typename A4, typename A5, typename A6, typename X1, - typename X2, typename X3, typename X4, typename X5> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, A1, A2, A3, - A4, A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, A1, A2, A3, A4, - A5, A6), - base::Tuple<P1, P2, P3, P4, P5>, base::Tuple<A1, A2, A3, A4, - A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 0 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6), const P1& p1, const P2& p2, - const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 1 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 2 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1, A2), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 3 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1, A2, A3), const P1& p1, - const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 4 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename X1, typename X2, typename X3, typename X4, - typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 5 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, - A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, - A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4, A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename A5, typename X1, typename X2, typename X3, - typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, - A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4, A5>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename X1, - typename X2, typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4, A5), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) - -// 6 - 6 -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (*function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, A6), - const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, - A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, - A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, - const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING - -#if defined (OS_WIN) && !defined (ARCH_CPU_X86_64) -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T* obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4, A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new Mutant<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} - -template <typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename X1, typename X2, - typename X3, typename X4, typename X5, typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(R (__stdcall *function)(X1, X2, X3, X4, X5, X6, A1, A2, A3, A4, - A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantFunction<R, R (__stdcall *)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, - A2, A3, A4, A5, A6>> - (function, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); -} -#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -template <typename R, typename T, typename U, typename P1, typename P2, - typename P3, typename P4, typename P5, typename P6, typename A1, - typename A2, typename A3, typename A4, typename A5, typename A6, - typename X1, typename X2, typename X3, typename X4, typename X5, - typename X6> -inline MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>> -CreateFunctor(T** obj, R (__stdcall U::*method)(X1, X2, X3, X4, X5, X6, A1, A2, - A3, A4, A5, A6), const P1& p1, const P2& p2, const P3& p3, const P4& p4, - const P5& p5, const P6& p6) { - MutantRunner<R, base::Tuple<A1, A2, A3, A4, A5, A6>>* t = - new MutantLateObjectBind<R, T, R (__stdcall U::*)(X1, X2, X3, X4, X5, X6, A1, A2, A3, - A4, A5, A6), - base::Tuple<P1, P2, P3, P4, P5, P6>, base::Tuple<A1, A2, A3, - A4, A5, A6>> - (obj, method, base::MakeTuple(p1, p2, p3, p4, p5, p6)); - return MutantFunctor<R, base::Tuple<A1, A2, A3, A4, A5, A6>>(t); +template <typename Functor, typename... BoundArgs> +CallbackToFunctorHelper<base::MakeUnboundRunType<Functor, BoundArgs...>> +CreateFunctor(Functor functor, const BoundArgs&... args) { + return CallbackToFunctor(base::Bind(functor, args...)); } -#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING -#endif // defined (OS_WIN) && !defined (ARCH_CPU_X86_64) } // namespace testing diff --git a/chromium/testing/iossim/BUILD.gn b/chromium/testing/iossim/BUILD.gn new file mode 100644 index 00000000000..a31fdcbfae0 --- /dev/null +++ b/chromium/testing/iossim/BUILD.gn @@ -0,0 +1,56 @@ +# 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. + +import("//build/config/mac/mac_sdk.gni") +import("//third_party/class-dump/class-dump.gni") + +config("config") { + visibility = [ ":iossim" ] + + include_dirs = [ "$root_gen_dir/iossim" ] + + # TODO(crbug.com/595295): Building class-dump tools requires OS X SDK + # version 10.9 or higher. Remove this override once the global version + # of the SDK is raised. + common_flags = [ "-mmacosx-version-min=10.9" ] + ldflags = common_flags + cflags_objcc = common_flags +} + +executable("iossim") { + sources = [ + "iossim.mm", + ] + libs = [ "Foundation.framework" ] + deps = [ + ":generate_dvt_core_simulator", + ":generate_dvt_foundation_header", + ":generate_dvt_iphone_sim_header", + ] + configs += [ ":config" ] + + # TODO(crbug.com/595295): Building class-dump tools requires OS X SDK + # version 10.9 or higher. To prevent mixing code using different value + # of minimum SDK supported, forbids dependencies on any Chromium target. + assert_no_deps = [ "//base/*" ] +} + +class_dump("generate_dvt_core_simulator") { + framework_name = "CoreSimulator" + framework_path = "$mac_sdk_path/../../../../../Library/PrivateFrameworks" + class_dump_filter = "Sim" +} + +class_dump("generate_dvt_foundation_header") { + framework_name = "DVTFoundation" + framework_path = "$mac_sdk_path/../../../../../../SharedFrameworks" + class_dump_filter = "DVTStackBacktrace|DVTInvalidation|DVTMixIn" +} + +class_dump("generate_dvt_iphone_sim_header") { + topological_sort = true + framework_name = "DVTiPhoneSimulatorRemoteClient" + framework_path = "$mac_sdk_path/../../../../../../SharedFrameworks" + class_dump_filter = "iPhoneSimulator" +} diff --git a/chromium/testing/iossim/OWNERS b/chromium/testing/iossim/OWNERS index 1b3348e7911..40a68c74b17 100644 --- a/chromium/testing/iossim/OWNERS +++ b/chromium/testing/iossim/OWNERS @@ -1,2 +1 @@ rohitrao@chromium.org -stuartmorgan@chromium.org diff --git a/chromium/testing/iossim/iossim.gyp b/chromium/testing/iossim/iossim.gyp index c4a45b62a97..88069b6d0de 100644 --- a/chromium/testing/iossim/iossim.gyp +++ b/chromium/testing/iossim/iossim.gyp @@ -6,79 +6,21 @@ 'variables': { 'mac_deployment_target': '10.9', 'mac_sdk_min': '10.9', + 'class_dump_bin': '<(PRODUCT_DIR)/class-dump', + 'class_dump_py': '<(DEPTH)/third_party/class-dump/class-dump.py', }, 'conditions': [ ['OS!="ios" or "<(GENERATOR)"!="xcode" or "<(GENERATOR_FLAVOR)"=="ninja"', { 'targets': [ { + # GN version //testing/iossim(//build/toolchain/mac:clang_x64) 'target_name': 'iossim', 'toolsets': ['host'], 'type': 'executable', 'variables': { 'developer_dir': '<!(xcode-select -print-path)', - # TODO(lliabraa): Once all builders are on Xcode 6 this variable can - # be removed and the actions gated by this variable can be run by - # default (crbug.com/385030). - 'xcode_version': '<!(xcodebuild -version | grep Xcode | awk \'{print $2}\')', + 'iphone_sim_path': '<(developer_dir)/../SharedFrameworks', }, - 'conditions': [ - ['xcode_version>="6.0"', { - 'variables': { - 'iphone_sim_path': '<(developer_dir)/../SharedFrameworks', - }, - 'defines': [ - 'IOSSIM_USE_XCODE_6', - ], - 'actions': [ - { - 'action_name': 'generate_dvt_foundation_header', - 'inputs': [ - '<(iphone_sim_path)/DVTFoundation.framework/Versions/Current/DVTFoundation', - '<(PRODUCT_DIR)/class-dump', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/iossim/DVTFoundation.h' - ], - 'action': [ - # Actions don't provide a way to redirect stdout, so a custom - # script is invoked that will execute the first argument and - # write the output to the file specified as the second argument. - # -I sorts classes, categories, and protocols by inheritance. - # -C <regex> only displays classes matching regular expression. - './redirect-stdout.sh', - '<(PRODUCT_DIR)/class-dump -CDVTStackBacktrace|DVTInvalidation|DVTMixIn <(iphone_sim_path)/DVTFoundation.framework', - '<(INTERMEDIATE_DIR)/iossim/DVTFoundation.h', - ], - 'message': 'Generating DVTFoundation.h', - }, - { - 'action_name': 'generate_dvt_core_simulator', - 'inputs': [ - '<(developer_dir)/Library/PrivateFrameworks/CoreSimulator.framework/Versions/Current/CoreSimulator', - '<(PRODUCT_DIR)/class-dump', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/iossim/CoreSimulator.h' - ], - 'action': [ - # Actions don't provide a way to redirect stdout, so a custom - # script is invoked that will execute the first argument and - # write the output to the file specified as the second argument. - # -I sorts classes, categories, and protocols by inheritance. - # -C <regex> only displays classes matching regular expression. - './redirect-stdout.sh', - '<(PRODUCT_DIR)/class-dump -CSim <(developer_dir)/Library/PrivateFrameworks/CoreSimulator.framework', - '<(INTERMEDIATE_DIR)/iossim/CoreSimulator.h', - ], - 'message': 'Generating CoreSimulator.h', - }, - ], # actions - }, { # else: xcode_version<"6.0" - 'variables': { - 'iphone_sim_path': '<(developer_dir)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks', - }, - }], # xcode_version - ], # conditions 'dependencies': [ '<(DEPTH)/third_party/class-dump/class-dump.gyp:class-dump#host', ], @@ -94,23 +36,66 @@ ], 'actions': [ { + 'action_name': 'generate_dvt_core_simulator', + 'inputs': [ + '<(class_dump_bin)', + '<(class_dump_py)', + '<(developer_dir)/Library/PrivateFrameworks/CoreSimulator.framework/Versions/Current/CoreSimulator', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/iossim/CoreSimulator.h' + ], + 'action': [ + 'python', + '<(class_dump_py)', + '-t', '<(class_dump_bin)', + '-o', '<(INTERMEDIATE_DIR)/iossim/CoreSimulator.h', + '--', + '-CSim', + '<(developer_dir)/Library/PrivateFrameworks/CoreSimulator.framework', + ], + 'message': 'Generating CoreSimulator.h', + }, + { + 'action_name': 'generate_dvt_foundation_header', + 'inputs': [ + '<(class_dump_bin)', + '<(class_dump_py)', + '<(iphone_sim_path)/DVTFoundation.framework/Versions/Current/DVTFoundation', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/iossim/DVTFoundation.h' + ], + 'action': [ + 'python', + '<(class_dump_py)', + '-t', '<(class_dump_bin)', + '-o', '<(INTERMEDIATE_DIR)/iossim/DVTFoundation.h', + '--', + '-CDVTStackBacktrace|DVTInvalidation|DVTMixIn', + '<(iphone_sim_path)/DVTFoundation.framework', + ], + 'message': 'Generating DVTFoundation.h', + }, + { 'action_name': 'generate_dvt_iphone_sim_header', 'inputs': [ + '<(class_dump_bin)', + '<(class_dump_py)', '<(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework/Versions/Current/DVTiPhoneSimulatorRemoteClient', - '<(PRODUCT_DIR)/class-dump', ], 'outputs': [ '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h' ], 'action': [ - # Actions don't provide a way to redirect stdout, so a custom - # script is invoked that will execute the first argument and - # write the output to the file specified as the second argument. - # -I sorts classes, categories, and protocols by inheritance. - # -C <regex> only displays classes matching regular expression. - './redirect-stdout.sh', - '<(PRODUCT_DIR)/class-dump -I -CiPhoneSimulator <(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework', - '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h', + 'python', + '<(class_dump_py)', + '-t', '<(class_dump_bin)', + '-o', '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h', + '--', + '-I', + '-CiPhoneSimulator', + '<(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework', ], 'message': 'Generating DVTiPhoneSimulatorRemoteClient.h', }, diff --git a/chromium/testing/iossim/iossim.mm b/chromium/testing/iossim/iossim.mm index d66296f0a3e..b0d691632c8 100644 --- a/chromium/testing/iossim/iossim.mm +++ b/chromium/testing/iossim/iossim.mm @@ -21,16 +21,9 @@ // However, there are some forward declarations required to get things to // compile. -// TODO(lliabraa): Once all builders are on Xcode 6 this ifdef can be removed -// (crbug.com/385030). -#if defined(IOSSIM_USE_XCODE_6) @class DVTStackBacktrace; #import "DVTFoundation.h" -#endif // IOSSIM_USE_XCODE_6 -// TODO(lliabraa): Once all builders are on Xcode 6 this ifdef can be removed -// (crbug.com/385030). -#if defined(IOSSIM_USE_XCODE_6) @protocol SimBridge; @class DVTSimulatorApplication; @class SimDeviceSet; @@ -39,7 +32,6 @@ @class SimRuntime; @class SimServiceConnectionManager; #import "CoreSimulator.h" -#endif // IOSSIM_USE_XCODE_6 @interface DVTPlatform : NSObject + (BOOL)loadAllPlatformsReturningError:(id*)arg1; @@ -77,10 +69,6 @@ namespace { const char* const kUserHomeEnvVariable = "CFFIXED_USER_HOME"; const char* const kHomeEnvVariable = "HOME"; -// Device family codes for iPhone and iPad. -const int kIPhoneFamily = 1; -const int kIPadFamily = 2; - // Max number of seconds to wait for the simulator session to start. // This timeout must allow time to start up iOS Simulator, install the app // and perform any other black magic that is encoded in the @@ -118,7 +106,6 @@ const int kExitInvalidArguments = 2; const int kExitInitializationFailure = 3; const int kExitAppFailedToStart = 4; const int kExitAppCrashed = 5; -const int kExitUnsupportedXcodeVersion = 6; void LogError(NSString* format, ...) { va_list list; @@ -185,74 +172,17 @@ NSString* GetOutputFromTask(NSString* toolPath, NSArray* args) { encoding:NSUTF8StringEncoding] autorelease]; } -// Finds the Xcode version via xcodebuild -version. Output from xcodebuild is -// expected to look like: -// Xcode <version> -// Build version 5B130a -// where <version> is the string returned by this function (e.g. 6.0). -NSString* FindXcodeVersion() { - NSString* output = GetOutputFromTask(@"/usr/bin/xcodebuild", - @[ @"-version" ]); - // Scan past the "Xcode ", then scan the rest of the line into |version|. - NSScanner* scanner = [NSScanner scannerWithString:output]; - BOOL valid = [scanner scanString:@"Xcode " intoString:NULL]; - NSString* version; - valid = - [scanner scanUpToCharactersFromSet:[NSCharacterSet newlineCharacterSet] - intoString:&version]; - if (!valid) { - LogError(@"Unable to find Xcode version. 'xcodebuild -version' " - @"returned \n%@", output); - return nil; - } - return version; -} - -// Returns true if iossim is running with Xcode 6 or later installed on the -// host. -BOOL IsRunningWithXcode6OrLater() { - static NSString* xcodeVersion = FindXcodeVersion(); - if (!xcodeVersion) { - return false; - } - NSArray* components = [xcodeVersion componentsSeparatedByString:@"."]; - if ([components count] < 1) { - return false; - } - NSInteger majorVersion = [[components objectAtIndex:0] integerValue]; - return majorVersion >= 6; -} - // Prints supported devices and SDKs. void PrintSupportedDevices() { - if (IsRunningWithXcode6OrLater()) { -#if defined(IOSSIM_USE_XCODE_6) - printf("Supported device/SDK combinations:\n"); - Class simDeviceSetClass = FindClassByName(@"SimDeviceSet"); - id deviceSet = - [simDeviceSetClass setForSetPath:[simDeviceSetClass defaultSetPath]]; - for (id simDevice in [deviceSet availableDevices]) { - NSString* deviceInfo = - [NSString stringWithFormat:@" -d '%@' -s '%@'\n", - [simDevice name], [[simDevice runtime] versionString]]; - printf("%s", [deviceInfo UTF8String]); - } -#endif // IOSSIM_USE_XCODE_6 - } else { - printf("Supported SDK versions:\n"); - Class rootClass = FindClassByName(@"DTiPhoneSimulatorSystemRoot"); - for (id root in [rootClass knownRoots]) { - printf(" '%s'\n", [[root sdkVersion] UTF8String]); - } - // This is the list of devices supported on Xcode 5.1.x. - printf("Supported devices:\n"); - printf(" 'iPhone'\n"); - printf(" 'iPhone Retina (3.5-inch)'\n"); - printf(" 'iPhone Retina (4-inch)'\n"); - printf(" 'iPhone Retina (4-inch 64-bit)'\n"); - printf(" 'iPad'\n"); - printf(" 'iPad Retina'\n"); - printf(" 'iPad Retina (64-bit)'\n"); + printf("Supported device/SDK combinations:\n"); + Class simDeviceSetClass = FindClassByName(@"SimDeviceSet"); + id deviceSet = + [simDeviceSetClass setForSetPath:[simDeviceSetClass defaultSetPath]]; + for (id simDevice in [deviceSet availableDevices]) { + NSString* deviceInfo = + [NSString stringWithFormat:@" -d '%@' -s '%@'\n", + [simDevice name], [[simDevice runtime] versionString]]; + printf("%s", [deviceInfo UTF8String]); } } } // namespace @@ -312,21 +242,15 @@ void PrintSupportedDevices() { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSFileHandle* simio = [NSFileHandle fileHandleForReadingAtPath:stdioPath_]; - if (IsRunningWithXcode6OrLater()) { -#if defined(IOSSIM_USE_XCODE_6) - // With iOS 8 simulators on Xcode 6, the app output is relative to the - // simulator's data directory. - NSString* versionString = - [[[session sessionConfig] simulatedSystemRoot] sdkVersion]; - NSInteger majorVersion = [[[versionString componentsSeparatedByString:@"."] - objectAtIndex:0] intValue]; - if (majorVersion >= 8) { - NSString* dataPath = session.sessionConfig.device.dataPath; - NSString* appOutput = - [dataPath stringByAppendingPathComponent:stdioPath_]; - simio = [NSFileHandle fileHandleForReadingAtPath:appOutput]; - } -#endif // IOSSIM_USE_XCODE_6 + NSString* versionString = + [[[session sessionConfig] simulatedSystemRoot] sdkVersion]; + NSInteger majorVersion = [[[versionString componentsSeparatedByString:@"."] + objectAtIndex:0] intValue]; + if (majorVersion >= 8) { + NSString* dataPath = session.sessionConfig.device.dataPath; + NSString* appOutput = + [dataPath stringByAppendingPathComponent:stdioPath_]; + simio = [NSFileHandle fileHandleForReadingAtPath:appOutput]; } NSFileHandle* standardOutput = [NSFileHandle fileHandleWithStandardOutput]; // Copy data to stdout/stderr while the app is running. @@ -440,90 +364,46 @@ void PrintSupportedDevices() { // status code. iOS Simluator handles things a bit differently depending on // the version, so first determine the iOS version being used. BOOL badEntryFound = NO; - NSString* versionString = - [[[session sessionConfig] simulatedSystemRoot] sdkVersion]; - NSInteger majorVersion = [[[versionString componentsSeparatedByString:@"."] - objectAtIndex:0] intValue]; - if (majorVersion <= 6) { - // In iOS 6 and before, logging from the simulated apps went to the main - // system logs, so use ASL to check if the simulated app exited abnormally - // by looking for system log messages from launchd that refer to the - // simulated app's PID. Limit query to messages in the last minute since - // PIDs are cyclical. - aslmsg query = asl_new(ASL_TYPE_QUERY); - asl_set_query(query, ASL_KEY_SENDER, "launchd", - ASL_QUERY_OP_EQUAL | ASL_QUERY_OP_SUBSTRING); - char session_id[20]; - if (snprintf(session_id, 20, "%d", [session simulatedApplicationPID]) < 0) { - LogError(@"Failed to get [session simulatedApplicationPID]"); - exit(kExitFailure); - } - asl_set_query(query, ASL_KEY_REF_PID, session_id, ASL_QUERY_OP_EQUAL); - asl_set_query(query, ASL_KEY_TIME, "-1m", ASL_QUERY_OP_GREATER_EQUAL); - - // Log any messages found, and take note of any messages that may indicate - // the app crashed or did not exit cleanly. - aslresponse response = asl_search(NULL, query); - aslmsg entry; - while ((entry = aslresponse_next(response)) != NULL) { - const char* message = asl_get(entry, ASL_KEY_MSG); - LogWarning(@"Console message: %s", message); - // Some messages are harmless, so don't trigger a failure for them. - if (strstr(message, "The following job tried to hijack the service")) - continue; - badEntryFound = YES; - } - } else { - // Otherwise, the iOS Simulator's system logging is sandboxed, so parse the - // sandboxed system.log file for known errors. - NSString* path; - if (IsRunningWithXcode6OrLater()) { -#if defined(IOSSIM_USE_XCODE_6) - NSString* dataPath = session.sessionConfig.device.dataPath; - path = - [dataPath stringByAppendingPathComponent:@"Library/Logs/system.log"]; -#endif // IOSSIM_USE_XCODE_6 - } else { - NSString* relativePathToSystemLog = - [NSString stringWithFormat: - @"Library/Logs/iOS Simulator/%@/system.log", versionString]; - path = [simulatorHome_ - stringByAppendingPathComponent:relativePathToSystemLog]; - } - NSFileManager* fileManager = [NSFileManager defaultManager]; - if ([fileManager fileExistsAtPath:path]) { - NSString* content = - [NSString stringWithContentsOfFile:path - encoding:NSUTF8StringEncoding - error:NULL]; - NSArray* lines = [content componentsSeparatedByCharactersInSet: - [NSCharacterSet newlineCharacterSet]]; - NSString* simulatedAppPID = - [NSString stringWithFormat:@"%d", session.simulatedApplicationPID]; - NSArray* kErrorStrings = @[ - @"Service exited with abnormal code:", - @"Service exited due to signal:", - ]; - for (NSString* line in lines) { - if ([line rangeOfString:simulatedAppPID].location != NSNotFound) { - for (NSString* errorString in kErrorStrings) { - if ([line rangeOfString:errorString].location != NSNotFound) { - LogWarning(@"Console message: %@", line); - badEntryFound = YES; - break; - } - } - if (badEntryFound) { + + // The iOS Simulator's system logging is sandboxed, so parse the sandboxed + // system.log file for known errors. + NSString* path; + NSString* dataPath = session.sessionConfig.device.dataPath; + path = + [dataPath stringByAppendingPathComponent:@"Library/Logs/system.log"]; + NSFileManager* fileManager = [NSFileManager defaultManager]; + if ([fileManager fileExistsAtPath:path]) { + NSString* content = + [NSString stringWithContentsOfFile:path + encoding:NSUTF8StringEncoding + error:NULL]; + NSArray* lines = [content componentsSeparatedByCharactersInSet: + [NSCharacterSet newlineCharacterSet]]; + NSString* simulatedAppPID = + [NSString stringWithFormat:@"%d", session.simulatedApplicationPID]; + NSArray* kErrorStrings = @[ + @"Service exited with abnormal code:", + @"Service exited due to signal:", + ]; + for (NSString* line in lines) { + if ([line rangeOfString:simulatedAppPID].location != NSNotFound) { + for (NSString* errorString in kErrorStrings) { + if ([line rangeOfString:errorString].location != NSNotFound) { + LogWarning(@"Console message: %@", line); + badEntryFound = YES; break; } } + if (badEntryFound) { + break; + } } - // Remove the log file so subsequent invocations of iossim won't be - // looking at stale logs. - remove([path fileSystemRepresentation]); - } else { - LogWarning(@"Unable to find system log at '%@'.", path); } + // Remove the log file so subsequent invocations of iossim won't be + // looking at stale logs. + remove([path fileSystemRepresentation]); + } else { + LogWarning(@"Unable to find system log at '%@'.", path); } // If the query returned any nasty-looking results, iossim should exit with @@ -586,22 +466,16 @@ NSBundle* LoadSimulatorFramework(NSString* developerDir) { // The path within the developer dir of the private Simulator frameworks. NSString* simulatorFrameworkRelativePath; - if (IsRunningWithXcode6OrLater()) { - simulatorFrameworkRelativePath = - @"../SharedFrameworks/DVTiPhoneSimulatorRemoteClient.framework"; - NSString* const kCoreSimulatorRelativePath = - @"Library/PrivateFrameworks/CoreSimulator.framework"; - NSString* coreSimulatorPath = [developerDir - stringByAppendingPathComponent:kCoreSimulatorRelativePath]; - NSBundle* coreSimulatorBundle = - [NSBundle bundleWithPath:coreSimulatorPath]; - if (![coreSimulatorBundle load]) - return nil; - } else { - simulatorFrameworkRelativePath = - @"Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/" - @"DVTiPhoneSimulatorRemoteClient.framework"; - } + simulatorFrameworkRelativePath = + @"../SharedFrameworks/DVTiPhoneSimulatorRemoteClient.framework"; + NSString* const kCoreSimulatorRelativePath = + @"Library/PrivateFrameworks/CoreSimulator.framework"; + NSString* coreSimulatorPath = [developerDir + stringByAppendingPathComponent:kCoreSimulatorRelativePath]; + NSBundle* coreSimulatorBundle = + [NSBundle bundleWithPath:coreSimulatorPath]; + if (![coreSimulatorBundle load]) + return nil; NSString* simBundlePath = [developerDir stringByAppendingPathComponent:simulatorFrameworkRelativePath]; NSBundle* simBundle = [NSBundle bundleWithPath:simBundlePath]; @@ -633,7 +507,6 @@ DTiPhoneSimulatorApplicationSpecifier* BuildAppSpec(NSString* appPath) { // valid. DTiPhoneSimulatorSystemRoot* BuildSystemRoot(NSString* sdkVersion) { Class systemRootClass = FindClassByName(@"DTiPhoneSimulatorSystemRoot"); -#if defined(IOSSIM_USE_XCODE_6) Class simRuntimeClass = FindClassByName(@"SimRuntime"); NSArray* sorted = [[simRuntimeClass supportedRuntimes] sortedArrayUsingDescriptors:@[ @@ -642,9 +515,6 @@ DTiPhoneSimulatorSystemRoot* BuildSystemRoot(NSString* sdkVersion) { NSString* versionString = [[sorted lastObject] versionString]; DTiPhoneSimulatorSystemRoot* systemRoot = [systemRootClass rootWithSDKVersion:versionString]; -#else - DTiPhoneSimulatorSystemRoot* systemRoot = [systemRootClass defaultRoot]; -#endif if (sdkVersion) systemRoot = [systemRootClass rootWithSDKVersion:sdkVersion]; @@ -674,47 +544,43 @@ DTiPhoneSimulatorSessionConfig* BuildSessionConfig( sessionConfig.simulatedDeviceInfoName = deviceName; sessionConfig.simulatedDeviceFamily = deviceFamily; - if (IsRunningWithXcode6OrLater()) { -#if defined(IOSSIM_USE_XCODE_6) - Class simDeviceTypeClass = FindClassByName(@"SimDeviceType"); - id simDeviceType = - [simDeviceTypeClass supportedDeviceTypesByAlias][deviceName]; - Class simRuntimeClass = FindClassByName(@"SimRuntime"); - NSString* identifier = systemRoot.runtime.identifier; - id simRuntime = [simRuntimeClass supportedRuntimesByIdentifier][identifier]; - - // Attempt to use an existing device, but create one if a suitable match - // can't be found. For example, if the simulator is running with a - // non-default home directory (e.g. via iossim's -u command line arg) then - // there won't be any devices so one will have to be created. - Class simDeviceSetClass = FindClassByName(@"SimDeviceSet"); - id deviceSet = - [simDeviceSetClass setForSetPath:[simDeviceSetClass defaultSetPath]]; - id simDevice = nil; - for (id device in [deviceSet availableDevices]) { - if ([device runtime] == simRuntime && - [device deviceType] == simDeviceType) { - simDevice = device; - break; - } + Class simDeviceTypeClass = FindClassByName(@"SimDeviceType"); + id simDeviceType = + [simDeviceTypeClass supportedDeviceTypesByAlias][deviceName]; + Class simRuntimeClass = FindClassByName(@"SimRuntime"); + NSString* identifier = systemRoot.runtime.identifier; + id simRuntime = [simRuntimeClass supportedRuntimesByIdentifier][identifier]; + + // Attempt to use an existing device, but create one if a suitable match + // can't be found. For example, if the simulator is running with a + // non-default home directory (e.g. via iossim's -u command line arg) then + // there won't be any devices so one will have to be created. + Class simDeviceSetClass = FindClassByName(@"SimDeviceSet"); + id deviceSet = + [simDeviceSetClass setForSetPath:[simDeviceSetClass defaultSetPath]]; + id simDevice = nil; + for (id device in [deviceSet availableDevices]) { + if ([device runtime] == simRuntime && + [device deviceType] == simDeviceType) { + simDevice = device; + break; } - if (!simDevice) { - NSError* error = nil; - // n.b. only the device name is necessary because the iOS Simulator menu - // already splits devices by runtime version. - NSString* name = [NSString stringWithFormat:@"iossim - %@ ", deviceName]; - simDevice = [deviceSet createDeviceWithType:simDeviceType - runtime:simRuntime - name:name - error:&error]; - if (error) { - LogError(@"Failed to create device: %@", error); - exit(kExitInitializationFailure); - } + } + if (!simDevice) { + NSError* error = nil; + // n.b. only the device name is necessary because the iOS Simulator menu + // already splits devices by runtime version. + NSString* name = [NSString stringWithFormat:@"iossim - %@ ", deviceName]; + simDevice = [deviceSet createDeviceWithType:simDeviceType + runtime:simRuntime + name:name + error:&error]; + if (error) { + LogError(@"Failed to create device: %@", error); + exit(kExitInitializationFailure); } - sessionConfig.device = simDevice; -#endif // IOSSIM_USE_XCODE_6 } + sessionConfig.device = simDevice; return sessionConfig; } @@ -795,16 +661,6 @@ BOOL InitializeSimulatorUserHome(NSString* userHomePath) { return YES; } -// Performs a case-insensitive search to see if |stringToSearch| begins with -// |prefixToFind|. Returns true if a match is found. -BOOL CaseInsensitivePrefixSearch(NSString* stringToSearch, - NSString* prefixToFind) { - NSStringCompareOptions options = (NSAnchoredSearch | NSCaseInsensitiveSearch); - NSRange range = [stringToSearch rangeOfString:prefixToFind - options:options]; - return range.location != NSNotFound; -} - // Prints the usage information to stderr. void PrintUsage() { fprintf(stderr, "Usage: iossim [-d device] [-s sdkVersion] [-u homeDir] " @@ -828,20 +684,9 @@ void PrintUsage() { } } // namespace -void EnsureSupportForCurrentXcodeVersion() { - if (IsRunningWithXcode6OrLater()) { -#if !IOSSIM_USE_XCODE_6 - LogError(@"Running on Xcode 6, but Xcode 6 support was not compiled in."); - exit(kExitUnsupportedXcodeVersion); -#endif // IOSSIM_USE_XCODE_6 - } -} - int main(int argc, char* const argv[]) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - EnsureSupportForCurrentXcodeVersion(); - // basename() may modify the passed in string and it returns a pointer to an // internal buffer. Give it a copy to modify, and copy what it returns. char* worker = strdup(argv[0]); @@ -857,8 +702,7 @@ int main(int argc, char* const argv[]) { NSString* appPath = nil; NSString* appName = nil; NSString* sdkVersion = nil; - NSString* deviceName = - IsRunningWithXcode6OrLater() ? @"iPhone 5s" : @"iPhone"; + NSString* deviceName = @"iPhone 5s"; NSString* simHomePath = nil; NSMutableArray* appArgs = [NSMutableArray array]; NSMutableDictionary* appEnv = [NSMutableDictionary dictionary]; @@ -965,26 +809,11 @@ int main(int argc, char* const argv[]) { // Determine the deviceFamily based on the deviceName NSNumber* deviceFamily = nil; - if (IsRunningWithXcode6OrLater()) { -#if defined(IOSSIM_USE_XCODE_6) - Class simDeviceTypeClass = FindClassByName(@"SimDeviceType"); - if ([simDeviceTypeClass supportedDeviceTypesByAlias][deviceName] == nil) { - LogError(@"Invalid device name: %@.", deviceName); - PrintSupportedDevices(); - exit(kExitInvalidArguments); - } -#endif // IOSSIM_USE_XCODE_6 - } else { - if (!deviceName || CaseInsensitivePrefixSearch(deviceName, @"iPhone")) { - deviceFamily = [NSNumber numberWithInt:kIPhoneFamily]; - } else if (CaseInsensitivePrefixSearch(deviceName, @"iPad")) { - deviceFamily = [NSNumber numberWithInt:kIPadFamily]; - } - else { - LogError(@"Invalid device name: %@. Must begin with 'iPhone' or 'iPad'", - deviceName); - exit(kExitInvalidArguments); - } + Class simDeviceTypeClass = FindClassByName(@"SimDeviceType"); + if ([simDeviceTypeClass supportedDeviceTypesByAlias][deviceName] == nil) { + LogError(@"Invalid device name: %@.", deviceName); + PrintSupportedDevices(); + exit(kExitInvalidArguments); } // Set up the user home directory for the simulator only if a non-default diff --git a/chromium/testing/iossim/redirect-stdout.sh b/chromium/testing/iossim/redirect-stdout.sh deleted file mode 100755 index 446550368bc..00000000000 --- a/chromium/testing/iossim/redirect-stdout.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# Copyright (c) 2012 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. -# -# This script executes the command given as the first argument, strips -# cxx_destruct from stdout, and redirects the remaining stdout to the file given -# as the second argument. -# -# Example: Write the text 'foo' to a file called out.txt: -# RedirectStdout.sh "echo foo" out.txt -# -# This script is invoked from iossim.gyp in order to redirect the output of -# class-dump to a file (because gyp actions don't support redirecting output). -# This script also removes all lines with cxx_destruct. Perhaps newer versions -# of class-dump will fix this issue. As of 3.5, 'cxx_destruct' still exists. - -if [ ${#} -ne 2 ] ; then - echo "usage: ${0} <command> <output file>" - exit 2 -fi - -echo "// Treat class-dump output as a system header." > $2 -echo "#pragma clang system_header" >> $2 -$1 | sed /cxx_destruct/d >> $2 diff --git a/chromium/testing/legion/examples/comm_server/controller.isolate b/chromium/testing/legion/examples/comm_server/controller.isolate new file mode 100644 index 00000000000..331058c71fb --- /dev/null +++ b/chromium/testing/legion/examples/comm_server/controller.isolate @@ -0,0 +1,18 @@ +# Copyright 2015 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. + +{ + 'includes': [ + '../../../legion/legion.isolate' + ], + 'variables': { + 'command': [ + 'python', + 'controller.py', + ], + 'files': [ + 'controller.py', + ], + }, +} diff --git a/chromium/testing/legion/examples/comm_server/controller.py b/chromium/testing/legion/examples/comm_server/controller.py new file mode 100755 index 00000000000..f15fb397f11 --- /dev/null +++ b/chromium/testing/legion/examples/comm_server/controller.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# 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. + +"""Legion-based comm server test.""" + +import argparse +import logging +import os +import sys + +# Map the testing directory so we can import legion.legion_test_case. +TESTING_DIR = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + '..', '..', '..', '..', 'testing') +sys.path.append(TESTING_DIR) + +from legion import legion_test_case +from legion.lib import common_lib + + +class CommServerTestController(legion_test_case.TestCase): + """A simple example controller for a test.""" + + @classmethod + def CreateTestTask(cls): + """Create a new task.""" + parser = argparse.ArgumentParser() + parser.add_argument('--task-hash') + parser.add_argument('--os', default='Ubuntu-14.04') + args, _ = parser.parse_known_args() + + task = cls.CreateTask( + isolated_hash=args.task_hash, + dimensions={'os': args.os, 'pool': 'default'}, + idle_timeout_secs=90, + connection_timeout_secs=90, + verbosity=logging.DEBUG) + task.Create() + return task + + @classmethod + def setUpClass(cls): + """Creates the task machines and waits until they connect.""" + cls.task = cls.CreateTestTask() + cls.task.WaitForConnection() + + def testCommServerTest(self): + cmd = [ + 'python', + 'task.py', + '--address', str(common_lib.MY_IP), + '--port', str(self.comm_server.port) + ] + process = self.task.Process(cmd) + process.Wait() + retcode = process.GetReturncode() + if retcode != 0: + logging.info('STDOUT:\n%s', process.ReadStdout()) + logging.info('STDERR:\n%s', process.ReadStderr()) + self.assertEqual(retcode, 0) + # Add a success logging statement to make the logs a little easier to read. + logging.info('Success') + + +if __name__ == '__main__': + legion_test_case.main() diff --git a/chromium/testing/legion/examples/comm_server/task.isolate b/chromium/testing/legion/examples/comm_server/task.isolate new file mode 100644 index 00000000000..ce205e3efee --- /dev/null +++ b/chromium/testing/legion/examples/comm_server/task.isolate @@ -0,0 +1,18 @@ +# Copyright 2015 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. + +{ + 'includes': [ + '../../../legion/legion.isolate' + ], + 'variables': { + 'command': [ + 'python', + '../../../legion/run_task.py', + ], + 'files': [ + 'task.py', + ], + }, +} diff --git a/chromium/testing/legion/examples/comm_server/task.py b/chromium/testing/legion/examples/comm_server/task.py new file mode 100644 index 00000000000..5b87f04b5e5 --- /dev/null +++ b/chromium/testing/legion/examples/comm_server/task.py @@ -0,0 +1,67 @@ +# 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. + +"""Task-based unittest for the Legion event server.""" + +import argparse +import httplib +import sys +import unittest + + +class CommServerTest(unittest.TestCase): + + def __init__(self, *args, **kwargs): + super(CommServerTest, self).__init__(*args, **kwargs) + + parser = argparse.ArgumentParser() + parser.add_argument('--address') + parser.add_argument('--port', type=int) + self.args, _ = parser.parse_known_args() + + def Connect(self, verb, path, message=''): + conn = httplib.HTTPConnection(self.args.address, self.args.port) + conn.request(verb, path, body=message) + return conn.getresponse() + + def testMessagesUsedAsSignals(self): + self.assertEquals( + self.Connect('GET', '/messages/message1').status, 404) + self.assertEquals( + self.Connect('PUT', '/messages/message1').status, 200) + self.assertEquals( + self.Connect('GET', '/messages/message1').status, 200) + self.assertEquals( + self.Connect('DELETE', '/messages/message1').status, 200) + self.assertEquals( + self.Connect('DELETE', '/messages/message1').status, 404) + self.assertEquals( + self.Connect('GET', '/messages/message1').status, 404) + + def testErrors(self): + for verb in ['GET', 'PUT', 'DELETE']: + self.assertEquals( + self.Connect(verb, '/').status, 403) + self.assertEquals( + self.Connect(verb, '/foobar').status, 403) + self.assertEquals( + self.Connect(verb, '/foobar/').status, 405) + + def testMessagePassing(self): + self.assertEquals( + self.Connect('GET', '/messages/message2').status, 404) + self.assertEquals( + self.Connect('PUT', '/messages/message2', 'foo').status, 200) + self.assertEquals( + self.Connect('GET', '/messages/message2').read(), 'foo') + self.assertEquals( + self.Connect('DELETE', '/messages/message2').status, 200) + self.assertEquals( + self.Connect('DELETE', '/messages/message2').status, 404) + self.assertEquals( + self.Connect('GET', '/messages/message2').status, 404) + + +if __name__ == '__main__': + unittest.main(argv=sys.argv[:1]) diff --git a/chromium/testing/legion/legion_test_case.py b/chromium/testing/legion/legion_test_case.py index 43f2ad1973b..74b705fee65 100644 --- a/chromium/testing/legion/legion_test_case.py +++ b/chromium/testing/legion/legion_test_case.py @@ -16,6 +16,7 @@ common_lib.SetupEnvironment() from legion.lib import task_controller from legion.lib import task_registration_server +from legion.lib.comm_server import comm_server BANNER_WIDTH = 80 @@ -98,10 +99,17 @@ class TestCase(unittest.TestCase): @classmethod def _SetUpFramework(cls): """Perform the framework-specific setup operations.""" + # Setup the registration server cls._registration_server = ( task_registration_server.TaskRegistrationServer()) + common_lib.OnShutdown += cls._registration_server.Shutdown cls._registration_server.Start() + # Setup the event server + cls.comm_server = comm_server.CommServer() + common_lib.OnShutdown += cls.comm_server.shutdown + cls.comm_server.start() + @classmethod def _TearDownFramework(cls): """Perform the framework-specific teardown operations.""" @@ -140,4 +148,4 @@ class TestCase(unittest.TestCase): def main(): - unittest.main(verbosity=0, argv=sys.argv[:1]) + unittest.main(argv=sys.argv[:1]) diff --git a/chromium/testing/legion/lib/comm_server/__init__.py b/chromium/testing/legion/lib/comm_server/__init__.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/chromium/testing/legion/lib/comm_server/__init__.py diff --git a/chromium/testing/legion/lib/comm_server/base_handler.py b/chromium/testing/legion/lib/comm_server/base_handler.py new file mode 100644 index 00000000000..28ca4f68e53 --- /dev/null +++ b/chromium/testing/legion/lib/comm_server/base_handler.py @@ -0,0 +1,21 @@ +# 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. + +"""Base handler class for all category handlers.""" + + +class BaseHandler(object): + """Sets up default verb handlers for the child class.""" + + def do_PUT(self, request): + request.send_response(501) + + def do_POST(self, request): + request.send_response(501) + + def do_GET(self, request): + request.send_response(501) + + def do_DELETE(self, request): + request.send_response(501) diff --git a/chromium/testing/legion/lib/comm_server/comm_server.py b/chromium/testing/legion/lib/comm_server/comm_server.py new file mode 100644 index 00000000000..70d1c85247c --- /dev/null +++ b/chromium/testing/legion/lib/comm_server/comm_server.py @@ -0,0 +1,49 @@ +# 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. + +"""Communications server. + +This is the HTTP server class. The server is run in a separate thread allowing +the calling code to proceed normally after calling start(). shutdown() must +be called to tear the server down. Failure to do this will most likely end up +hanging the program. +""" + +import BaseHTTPServer +import SocketServer +import threading + +from legion.lib import common_lib +from legion.lib.comm_server import server_handler + + +class CommServer(SocketServer.ThreadingMixIn, + BaseHTTPServer.HTTPServer): + """An extension of the HTTPServer class which handles requests in threads.""" + + def __init__(self, address='', port=None): + self._port = port or common_lib.GetUnusedPort() + self._address = address + BaseHTTPServer.HTTPServer.__init__(self, + (self._address, self._port), + server_handler.ServerHandler) + + @property + def port(self): + return self._port + + @property + def address(self): + return self._address + + def start(self): + """Starts the server in another thread. + + The thread will stay active until shutdown() is called. There is no reason + to hold a reference to the thread object. + + The naming convention used here (lowercase) is used to match the base + server's naming convention. + """ + threading.Thread(target=self.serve_forever).start() diff --git a/chromium/testing/legion/lib/comm_server/message_handler.py b/chromium/testing/legion/lib/comm_server/message_handler.py new file mode 100644 index 00000000000..04413283e8b --- /dev/null +++ b/chromium/testing/legion/lib/comm_server/message_handler.py @@ -0,0 +1,76 @@ +# 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. + +"""Defines the handler for /messages/<NAME> paths. + +The name of the message is expected to follow the /messages/ portion of the +path. The body of the request will contain the message, both when uploading +the message as well as retrieving it. The message will remain on the server +until the calling code does an explicit DELETE call to remove it. + +The message is optional. This allows the caller to use this as a simple signal +server. The return code can always be used to tell if a message with that name +exists on the server (200 exists, 404 doesn't exist). + +When uploading a body ensure the content-length header is passed correctly. +If the content-length isn't passed no data is read from the body. If its set +too low only part of the message will be read. If its set too high the server +will block waiting for more data to be uploaded. +""" + +import re +import threading + +from legion.lib.comm_server import base_handler + + +class MessageHandler(base_handler.BaseHandler): + """Handles /messages/<NAME> requests.""" + + _REGEX = '/messages/(?P<name>[a-zA-Z0-9_.-~]+)' + _messages = {} + _message_lock = threading.Lock() + + def _GetName(self, request): + """Gets the message name from the URL.""" + match = re.match(self._REGEX, request.path) + if not match: + return None + return match.group('name') + + def do_PUT(self, request): + """Handles PUT requests.""" + name = self._GetName(request) + if not name: + return request.send_error(405, 'Key name required') + with self._message_lock: + self._messages[name] = request.rfile.read( + int(request.headers.getheader('content-length', 0))) + return request.send_response(200) + + def do_GET(self, request): + """Handles GET requests.""" + name = self._GetName(request) + if not name: + return request.send_error(405, 'Key name required') + elif name not in self._messages: + return request.send_error(404, 'Key not found') + with self._message_lock: + request.send_response(200) + request.send_header('Content-type', 'text/plain') + request.send_header('Content-Length', str(len(self._messages[name]))) + request.end_headers() + request.wfile.write(self._messages[name]) + + def do_DELETE(self, request): + """Handles DELETE requests.""" + name = self._GetName(request) + if not name: + return request.send_error(405, 'Key name required') + with self._message_lock: + if name in self._messages: + del self._messages[name] + return request.send_response(200) + else: + return request.send_error(404, 'Key not found') diff --git a/chromium/testing/legion/lib/comm_server/server_handler.py b/chromium/testing/legion/lib/comm_server/server_handler.py new file mode 100644 index 00000000000..feaa08bf5e7 --- /dev/null +++ b/chromium/testing/legion/lib/comm_server/server_handler.py @@ -0,0 +1,76 @@ +# 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. + +"""Handler used directly by the server. + +This handler routes the request to the correct subhandler based on the first +value in the URL path. For example, the MessageHandler has been added to the +class's _HANDLERS object and handles all requests destined for URL/messages/... + +To extend this functionality implement a handler and add it to the _HANDLERS +object with the correct category. The category is defined as the first part of +the URL path (i.e. URL/<CATEGORY>). The handler will then be called any time a +request comes in with that category. +""" + +import re +import SimpleHTTPServer + +# Import all communications handlers +from legion.lib.comm_server import message_handler + + +class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): + """Server handler class.""" + + _HANDLERS = { + 'messages': message_handler.MessageHandler, + } + _REGEX = '/(?P<category>[a-zA-Z0-9_.-~]+)/' + + def log_message(self, *args, **kwargs): + """Silence those pesky server-side print statements.""" + pass + + def _GetCategoryName(self): + """Extracts and returns the category name.""" + match = re.match(self._REGEX, self.path) + if not match: + return + return match.group('category') + + def _GetHandler(self): + """Returns the category handler object if it exists.""" + category = self._GetCategoryName() + if not category: + return self.send_error(403, 'Category must be supplied in the form of ' + '/category_name/...') + handler = self._HANDLERS.get(category) + if not handler: + return self.send_error(405, 'No handler found for /%s/' % category) + return handler() + + def do_GET(self): + """Dispatches GET requests.""" + handler = self._GetHandler() + if handler: + handler.do_GET(self) + + def do_POST(self): + """Dispatches POST requests.""" + handler = self._GetHandler() + if handler: + handler.do_POST(self) + + def do_PUT(self): + """Dispatches PUT requests.""" + handler = self._GetHandler() + if handler: + handler.do_PUT(self) + + def do_DELETE(self): + """Dispatches DELETE requests.""" + handler = self._GetHandler() + if handler: + handler.do_DELETE(self) diff --git a/chromium/testing/legion/lib/task_controller.py b/chromium/testing/legion/lib/task_controller.py index 31dcf0fc505..a68354f8805 100644 --- a/chromium/testing/legion/lib/task_controller.py +++ b/chromium/testing/legion/lib/task_controller.py @@ -11,7 +11,6 @@ import os import socket import subprocess import sys -import tempfile import threading from legion.lib import common_lib diff --git a/chromium/testing/legion/lib/task_registration_server.py b/chromium/testing/legion/lib/task_registration_server.py index 5c070ea78ea..4c84c098912 100644 --- a/chromium/testing/legion/lib/task_registration_server.py +++ b/chromium/testing/legion/lib/task_registration_server.py @@ -24,8 +24,6 @@ class TaskRegistrationServer(object): self._rpc_server = None self._thread = None self._port = common_lib.GetUnusedPort() - # Register for the shutdown event - common_lib.OnShutdown += self.Shutdown @property def port(self): diff --git a/chromium/testing/legion/tools/legion.py b/chromium/testing/legion/tools/legion.py index 7170f2c6f85..85073a913c9 100755 --- a/chromium/testing/legion/tools/legion.py +++ b/chromium/testing/legion/tools/legion.py @@ -52,7 +52,7 @@ class ArgumentError(Error): pass -def GetArgs(): +def GetArgs(cmd_args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('action', choices=['run', 'trigger'], help='The swarming action to perform.') @@ -82,7 +82,7 @@ def GetArgs(): 'are in the form of --controller-var name value and are ' 'passed to the controller as --name value.') parser.add_argument('-v', '--verbosity', default=0, action='count') - return parser.parse_args() + return parser.parse_args(cmd_args) def RunCommand(cmd, stream_stdout=False): @@ -116,7 +116,7 @@ def Archive(isolated, isolate_server): return RunCommand(cmd).split()[0] # The isolated hash -def GetSwarmingCommandLine(args): +def GetSwarmingCommandLine(args, extra_args): """Builds and returns the command line for swarming.py run|trigger.""" cmd = [ sys.executable, @@ -133,14 +133,17 @@ def GetSwarmingCommandLine(args): cmd.extend(['--dimension', name, value]) cmd.append('--') - + cmd.extend(extra_args) cmd.extend(['--swarming-server', args.swarming_server]) cmd.extend(['--isolate-server', args.isolate_server]) # Specify the output dir cmd.extend(['--output-dir', '${ISOLATED_OUTDIR}']) # Task name/hash values for name, isolated in args.tasks: - cmd.extend(['--' + name, Archive(isolated, args.isolate_server)]) + if args.format_only: + cmd.extend(['--' + name, isolated + '_test_only']) + else: + cmd.extend(['--' + name, Archive(isolated, args.isolate_server)]) # Test controller args for name, value in args.controller_vars: cmd.extend(['--' + name, value]) @@ -149,7 +152,14 @@ def GetSwarmingCommandLine(args): def main(): - args = GetArgs() + if '--' not in sys.argv: + cmd_args = sys.argv[1:] + extra_args = [] + else: + index = sys.argv.index('--') + cmd_args = sys.argv[1:index] + extra_args = sys.argv[index+1:] + args = GetArgs(cmd_args) if not args.swarming_server: raise ArgumentError('Missing required argument: --swarming-server') if not args.isolate_server: @@ -158,7 +168,7 @@ def main(): format='%(asctime)s %(filename)s:%(lineno)s %(levelname)s] %(message)s', datefmt='%H:%M:%S', level=LOGGING_LEVELS[len(LOGGING_LEVELS)-args.verbosity-1]) - cmd = GetSwarmingCommandLine(args) + cmd = GetSwarmingCommandLine(args, extra_args) if not args.format_only: RunCommand(cmd, True) return 0 diff --git a/chromium/testing/legion/unittests/__init__.py b/chromium/testing/legion/unittests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/chromium/testing/legion/unittests/__init__.py diff --git a/chromium/testing/legion/unittests/comm_server_test.py b/chromium/testing/legion/unittests/comm_server_test.py new file mode 100644 index 00000000000..62575095a6b --- /dev/null +++ b/chromium/testing/legion/unittests/comm_server_test.py @@ -0,0 +1,72 @@ +# 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. + +"""Local unittest for legion.lib.comm_server.""" + +import httplib + +# pylint: disable=relative-import +import legion_unittest + +from legion.lib.comm_server import comm_server + + +class CommServerTest(legion_unittest.TestCase): + + def setUp(self): + super(CommServerTest, self).setUp() + self.server = comm_server.CommServer() + self.server.start() + + def tearDown(self): + try: + self.server.shutdown() + finally: + super(CommServerTest, self).tearDown() + + def Connect(self, verb, path, message=''): + conn = httplib.HTTPConnection('localhost', self.server.port) + conn.request(verb, path, body=message) + return conn.getresponse() + + def testMessagesUsedAsSignals(self): + self.assertEquals( + self.Connect('GET', '/messages/message1').status, 404) + self.assertEquals( + self.Connect('PUT', '/messages/message1').status, 200) + self.assertEquals( + self.Connect('GET', '/messages/message1').status, 200) + self.assertEquals( + self.Connect('DELETE', '/messages/message1').status, 200) + self.assertEquals( + self.Connect('DELETE', '/messages/message1').status, 404) + self.assertEquals( + self.Connect('GET', '/messages/message1').status, 404) + + def testErrors(self): + for verb in ['GET', 'PUT', 'DELETE']: + self.assertEquals( + self.Connect(verb, '/').status, 403) + self.assertEquals( + self.Connect(verb, '/foobar').status, 403) + self.assertEquals( + self.Connect(verb, '/foobar/').status, 405) + + def testMessagePassing(self): + self.assertEquals( + self.Connect('GET', '/messages/message2').status, 404) + self.assertEquals( + self.Connect('PUT', '/messages/message2', 'foo').status, 200) + self.assertEquals( + self.Connect('GET', '/messages/message2').read(), 'foo') + self.assertEquals( + self.Connect('DELETE', '/messages/message2').status, 200) + self.assertEquals( + self.Connect('DELETE', '/messages/message2').status, 404) + self.assertEquals( + self.Connect('GET', '/messages/message2').status, 404) + + +if __name__ == '__main__': + legion_unittest.main() diff --git a/chromium/testing/legion/unittests/legion_unittest.py b/chromium/testing/legion/unittests/legion_unittest.py new file mode 100644 index 00000000000..2d9eb9e315a --- /dev/null +++ b/chromium/testing/legion/unittests/legion_unittest.py @@ -0,0 +1,31 @@ +# Copyright 2015 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. + +"""Base test class for Legion-specific unittests. + +Currently this module is only needed to setup the import paths for the +unittests. This will allow unittests to use the import format: + +from legion.foo import bar + +Using this base class for all unittests allows for easier extensibility in +the future. +""" + +import os +import sys +import unittest + +# Setup import paths +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) +LEGION_IMPORT_FIX = os.path.join(THIS_DIR, '..', '..') +sys.path.append(LEGION_IMPORT_FIX) + + +class TestCase(unittest.TestCase): + pass + + +def main(): + unittest.main(verbosity=0, argv=sys.argv[:1]) diff --git a/chromium/testing/libfuzzer/BUILD.gn b/chromium/testing/libfuzzer/BUILD.gn index d5ec6326041..863d98c73ae 100644 --- a/chromium/testing/libfuzzer/BUILD.gn +++ b/chromium/testing/libfuzzer/BUILD.gn @@ -11,27 +11,14 @@ import("//build/config/features.gni") import("//build/config/sanitizers/sanitizers.gni") static_library("libfuzzer_main") { - # libfuzzer should be compiled without coverage (infinite loop in trace_cmp). - configs -= [ "//build/config/sanitizers:default_sanitizer_coverage_flags" ] - + deps = [] sources = [] if (use_libfuzzer) { - sources += [ - "../../third_party/llvm/lib/Fuzzer/FuzzerCrossOver.cpp", - "../../third_party/llvm/lib/Fuzzer/FuzzerDriver.cpp", - "../../third_party/llvm/lib/Fuzzer/FuzzerFlags.def", - "../../third_party/llvm/lib/Fuzzer/FuzzerIO.cpp", - "../../third_party/llvm/lib/Fuzzer/FuzzerInterface.cpp", - "../../third_party/llvm/lib/Fuzzer/FuzzerLoop.cpp", - "../../third_party/llvm/lib/Fuzzer/FuzzerMain.cpp", - "../../third_party/llvm/lib/Fuzzer/FuzzerMutate.cpp", - "../../third_party/llvm/lib/Fuzzer/FuzzerSHA1.cpp", - "../../third_party/llvm/lib/Fuzzer/FuzzerSanitizerOptions.cpp", - "../../third_party/llvm/lib/Fuzzer/FuzzerTraceState.cpp", - "../../third_party/llvm/lib/Fuzzer/FuzzerUtil.cpp", - ] + deps += [ "//third_party/libFuzzer:libfuzzer" ] } else if (use_drfuzz) { sources += [ "drfuzz_main.cc" ] + } else { + sources += [ "unittest_main.cc" ] } } @@ -40,3 +27,7 @@ static_library("libfuzzer_main") { # building an archive for clusterfuzz. config("no_clusterfuzz") { } + +# noop to tag seed corpus rules. +source_set("seed_corpus") { +} diff --git a/chromium/testing/libfuzzer/OWNERS b/chromium/testing/libfuzzer/OWNERS index a6b651abb1a..626428112df 100644 --- a/chromium/testing/libfuzzer/OWNERS +++ b/chromium/testing/libfuzzer/OWNERS @@ -1,3 +1,5 @@ aizatsky@chromium.org -krasin@chromium.org +inferno@chromium.org kcc@chromium.org +krasin@chromium.org +mmoroz@chromium.org diff --git a/chromium/testing/libfuzzer/README b/chromium/testing/libfuzzer/README deleted file mode 100644 index e3e033e4360..00000000000 --- a/chromium/testing/libfuzzer/README +++ /dev/null @@ -1,10 +0,0 @@ -LibFuzzer - a library for coverage-guided fuzz testing. - -================================= - -This directory contains LibFuzzer, and a set of fuzzers for -various parts of Chromium. - -For more details, see -http://llvm.org/docs/LibFuzzer.html -https://www.chromium.org/developers/testing/libfuzzer diff --git a/chromium/testing/libfuzzer/README.md b/chromium/testing/libfuzzer/README.md new file mode 100644 index 00000000000..5c08a778f02 --- /dev/null +++ b/chromium/testing/libfuzzer/README.md @@ -0,0 +1,52 @@ +# libFuzzer in Chrome + +[go/libfuzzer-chrome](https://goto.google.com/libfuzzer-chrome) + +*** aside +[Getting Started](getting_started.md) +| [Buildbot](https://goto.google.com/libfuzzer-clusterfuzz-buildbot) +| [ClusterFuzz Status](https://goto.google.com/libfuzzer-clusterfuzz-status) +| [Cover Bug] +*** + +This directory contains integration between [libFuzzer] and Chrome. +libFuzzer is an in-process coverage-driven evolutionary fuzzer. It helps +engineers to uncover potential security & stability problems earlier. + +*** note +**Requirements:** libFuzzer in Chrome is supported with GN on Linux only. +*** + +## Integration Status + +Fuzzer tests are well-integrated with Chrome build system & distributed +ClusterFuzz fuzzing system. Cover bug: [crbug.com/539572]. + +## Documentation + +* [Getting Started Guide] walks you through all the steps necessary to create +your fuzzer and submit it to ClusterFuzz. +* [Efficient Fuzzer Guide] explains how to measure fuzzer effectiveness and +ways to improve it. +* [ClusterFuzz Integration] describes integration between ClusterFuzz and +libFuzzer. +* [Reference] contains detailed references for different integration parts. + + +## Trophies +* [ClusterFuzz Bugs] - issues found and automatically filed by ClusterFuzz. +* [Manual Bugs] - issues that were filed manually after running fuzzers. +* [Pdfium Bugs] - bugs found in pdfium by manual fuzzing. +* [OSS Trophies] - bugs found with libFuzzer in open-source projects. + +[libFuzzer]: http://llvm.org/docs/LibFuzzer.html +[crbug.com/539572]: https://bugs.chromium.org/p/chromium/issues/detail?id=539572 +[Cover Bug]: https://bugs.chromium.org/p/chromium/issues/detail?id=539572 +[Getting Started Guide]: getting_started.md +[Efficient Fuzzer Guide]: efficient_fuzzer.md +[ClusterFuzz Integration]: clusterfuzz.md +[Reference]: reference.md +[ClusterFuzz Bugs]: https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label:Stability-LibFuzzer%20label:ClusterFuzz&sort=-modified&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified +[Pdfium Bugs]: https://bugs.chromium.org/p/pdfium/issues/list?can=1&q=libfuzzer&colspec=ID+Type+Status+Priority+Milestone+Owner+Summary&cells=tiles +[Manual Bugs]: https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3AStability-LibFuzzer+-label%3AClusterFuzz&sort=-modified&colspec=ID+Pri+M+Stars+ReleaseBlock+Component+Status+Owner+Summary+OS+Modified&x=m&y=releaseblock&cells=ids +[OSS Trophies]: http://llvm.org/docs/LibFuzzer.html#trophies diff --git a/chromium/testing/libfuzzer/archive_corpus.py b/chromium/testing/libfuzzer/archive_corpus.py new file mode 100755 index 00000000000..fa90a5a10bb --- /dev/null +++ b/chromium/testing/libfuzzer/archive_corpus.py @@ -0,0 +1,46 @@ +#!/usr/bin/python2 +# +# 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. + +"""Archive corpus file into zip and generate .d depfile. + +Invoked by GN from fuzzer_test.gni. +""" + +from __future__ import print_function +import argparse +import os +import sys +import zipfile + + +def main(): + parser = argparse.ArgumentParser(description="Generate fuzzer config.") + parser.add_argument('--depfile', required=True) + parser.add_argument('--corpus', required=True) + parser.add_argument('--output', required=True) + parser.add_argument('--fuzzer', required=True) + args = parser.parse_args() + + corpus_files = [] + # Generate .d file with dependency from corpus archive to individual files. + with open(args.depfile, 'w') as depfile: + print(os.path.basename(args.output), ":", end="", file=depfile) + for (dirpath, _, filenames) in os.walk(args.corpus): + for filename in filenames: + full_filename = os.path.join(dirpath, filename) + print(" ", full_filename, end="", file=depfile) + corpus_files.append(full_filename) + # chrome bots complain about this one: + # print(" ", args.fuzzer, end="", file=depfile) + + with zipfile.ZipFile(args.output, 'w') as z: + for corpus_file in corpus_files: + z.write(corpus_file, os.path.basename(corpus_file)) + + +if __name__ == '__main__': + main() + diff --git a/chromium/testing/libfuzzer/clusterfuzz.md b/chromium/testing/libfuzzer/clusterfuzz.md new file mode 100644 index 00000000000..b8e785e87d0 --- /dev/null +++ b/chromium/testing/libfuzzer/clusterfuzz.md @@ -0,0 +1,40 @@ +# libFuzzer and ClusterFuzz Integration + +*** note +Most links on this page are private. +*** + +ClusterFuzz is a distributed fuzzing infrastructure +([go/clusterfuzz](https://goto.google.com/clusterfuzz)) that automatically +executes libFuzzer tests on scale. + +## Status Links + +* [Buildbot] - status of all libFuzzer builds. +* [ClusterFuzz Fuzzer Status] - fuzzing metrics, links to crashes and coverage +reports. +* [Corpus GCS Bucket] - current corpus for each fuzzer. Can be used to upload +bootstrapped corpus. + +## Integration Details + +The integration between libFuzzer and ClusterFuzz consists of: + +* Build rules definition in [fuzzer_test.gni]. +* [Buildbot] that automatically discovers fuzzers using `gn refs` facility, +builds fuzzers with multiple sanitizers and uploads binaries to a special +GCS bucket. Build bot recipe is defined in [chromium_libfuzzer.py]. +* ClusterFuzz downloads new binaries once a day and runs fuzzers continuously. +* Fuzzing corpus is maintained for each fuzzer in [Corpus GCS Bucket]. Once a day +corpus is minimized to reduce number of duplicates and/or reduce effect of +parasitic coverage. +* [ClusterFuzz Fuzzer Status] displays fuzzer runtime +metrics as well as provides links to crashes and coverage reports. The information +is collected every 30 minutes. + + +[Buildbot]: https://goto.google.com/libfuzzer-clusterfuzz-buildbot +[fuzzer_test.gni]: https://code.google.com/p/chromium/codesearch#chromium/src/testing/libfuzzer/fuzzer_test.gni +[chromium_libfuzzer.py]: https://code.google.com/p/chromium/codesearch#chromium/build/scripts/slave/recipes/chromium_libfuzzer.py +[ClusterFuzz Fuzzer Status]: https://goto.google.com/libfuzzer-clusterfuzz-status +[Corpus GCS Bucket]: https://goto.google.com/libfuzzer-clusterfuzz-corpus diff --git a/chromium/testing/libfuzzer/drfuzz_main.cc b/chromium/testing/libfuzzer/drfuzz_main.cc index c8aab47988c..5a8ba4c30aa 100644 --- a/chromium/testing/libfuzzer/drfuzz_main.cc +++ b/chromium/testing/libfuzzer/drfuzz_main.cc @@ -9,7 +9,7 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size); // Provide main for running fuzzer tests with Dr. Fuzz. int main(int argc, char **argv) { - static const size_t kFuzzInputMaxSize = 1024; + static const size_t kFuzzInputMaxSize = 8; unsigned char* fuzz_input = new unsigned char[kFuzzInputMaxSize](); // The buffer and size arguments can be changed by Dr. Fuzz. int result = LLVMFuzzerTestOneInput(fuzz_input, kFuzzInputMaxSize); diff --git a/chromium/testing/libfuzzer/efficient_fuzzer.md b/chromium/testing/libfuzzer/efficient_fuzzer.md new file mode 100644 index 00000000000..5eb0b6ed2bd --- /dev/null +++ b/chromium/testing/libfuzzer/efficient_fuzzer.md @@ -0,0 +1,172 @@ +# Efficient Fuzzer + +This document describes ways to determine your fuzzer efficiency and ways +to improve it. + +## Overview + +Being a coverage-driven fuzzer, libFuzzer considers a certain input *interesting* +if it results in new coverage. The set of all interesting inputs is called +*corpus*. +Items in corpus are constantly mutated in search of new interesting input. +Corpus is usually maintained between multiple fuzzer runs. + +There are several metrics you should look at to determine your fuzzer effectiveness: + +* [fuzzer speed](#Fuzzer-Speed) (exec/s) +* [corpus size](#Corpus-Size) +* [coverage](#Coverage) + +You can collect these metrics manually or take them from [ClusterFuzz status] +pages. + +## Fuzzer Speed + +Fuzzer speed is printed while fuzzer runs: + +``` +#19346 NEW cov: 2815 bits: 1082 indir: 43 units: 150 exec/s: 19346 L: 62 +``` + +Because libFuzzer performs randomized search, it is critical to have it as fast +as possible. You should try to get to at least 1,000 exec/s. Profile the fuzzer +using any standard tool to see where it spends its time. + + +### Initialization/Cleanup + +Try to keep your fuzzing function as simple as possible. Prefer to use static +initialization and shared resources rather than bringing environment up and down +every single run. + +Fuzzers don't have to shutdown gracefully (we either kill them or they crash +because sanitizer has found a problem). You can skip freeing static resource. + +Of course all resources allocated within `LLVMFuzzerTestOneInput` function +should be deallocated since this function is called millions of times during +one fuzzing session. + + +### Memory Usage + +Avoid allocation of dynamic memory wherever possible. Instrumentation works +faster for stack-based and static objects than for heap allocated ones. + +It is always a good idea to play with different versions of a fuzzer to find the +fastest implementation. + + +### Maximum Testcase Length + +Experiment with different values of `-max_len` parameter. This parameter often +significantly affects execution speed, but not always. + +1) Define which `-max_len` value is reasonable for your target. For example, it +may be useless to fuzz an image decoder with too small value of testcase length. + +2) Increase the value defined on previous step. Check its influence on execution +speed of fuzzer. If speed doesn't drop significantly for long inputs, it is fine +to have some bigger value for `-max_len`. + +In general, bigger `-max_len` value gives better coverage. Coverage is main +priority for fuzzing. However, low execution speed may result in waste of +resources used for fuzzing. If large inputs make fuzzer too slow you have to +adjust value of `-max_len` and find a trade-off between coverage and execution +speed. + + +## Corpus Size + +After running for a while the fuzzer would reach a plateau and won't discover +new interesting input. Corpus for a reasonably complex functionality +should contain hundreds (if not thousands) of items. + +Too small corpus size indicates some code barrier that +libFuzzer is having problems penetrating. Common cases include: checksums, +magic numbers etc. The easiest way to diagnose this problem is to generate a +[coverage report](#Coverage). To fix the issue you can: + +* change the code (e.g. disable crc checks while fuzzing) +* prepare [corpus seed](#Corpus-Seed) +* prepare [fuzzer dictionary](#Fuzzer-Dictionary) + +## Coverage + +You can easily generate source-level coverage report for a given corpus: + +``` +ASAN_OPTIONS=html_cov_report=1:sancov_path=./third_party/llvm-build/Release+Asserts/bin/sancov \ + ./out/libfuzzer/my_fuzzer -runs=0 ~/tmp/my_fuzzer_corpus +``` + +This will produce an .html file with colored source-code. It can be used to +determine where your fuzzer is "stuck". Replace `ASAN_OPTIONS` by corresponding +option variable if your are using another sanitizer (e.g. `MSAN_OPTIONS`). +`sancov_path` can be omitted by adding llvm bin directory to `PATH` environment +variable. + +### Corpus Seed + +You can pass a corpus directory to a fuzzer that you run manually: + +``` +./out/libfuzzer/my_fuzzer ~/tmp/my_fuzzer_corpus +``` + +The directory can initially be empty. The fuzzer would store all the interesting +items it finds in the directory. You can help the fuzzer by "seeding" the corpus: +simply copy interesting inputs for your function to the corpus directory before +running. This works especially well for strictly defined file formats or data +transmission protocols. +* For file-parsing functionality just use some valid files from your test suite. +* For protocol processing targets put raw streams from test suite into separate +files. + +After discovering new and interesting items, [upload corpus to ClusterFuzz]. + +### Fuzzer Dictionary + +It is very useful to provide fuzzer a set of common words/values that you expect +to find in the input. This greatly improves efficiency of finding new units and +works especially well while fuzzing file format decoders. + +To add a dictionary, first create a dictionary file. +Dictionary syntax is similar to that used by [AFL] for its -x option: + +``` +# Lines starting with '#' and empty lines are ignored. + +# Adds "blah" (w/o quotes) to the dictionary. +kw1="blah" +# Use \\ for backslash and \" for quotes. +kw2="\"ac\\dc\"" +# Use \xAB for hex values +kw3="\xF7\xF8" +# the name of the keyword followed by '=' may be omitted: +"foo\x0Abar" +``` + +Test your dictionary by running your fuzzer locally: + +```bash +./out/libfuzzer/my_protocol_fuzzer -dict=<path_to_dict> <path_to_corpus> +``` + +You should see lots of new units discovered. + +Add `dict` attribute to fuzzer target: + +``` +fuzzer_test("my_protocol_fuzzer") { + ... + dict = "protocol.dict" +} +``` + +Make sure to submit dictionary file to git. The dictionary will be used +automatically by ClusterFuzz once it picks up new fuzzer version (once a day). + + +[ClusterFuzz status]: ./clusterfuzz.md#Status-Links +[upload corpus to ClusterFuzz]: ./clusterfuzz.md#Upload-Corpus +[AFL]: http://lcamtuf.coredump.cx/afl/ diff --git a/chromium/testing/libfuzzer/fuzzer_test.gni b/chromium/testing/libfuzzer/fuzzer_test.gni index 4fc5b26bc08..266016ce4f9 100644 --- a/chromium/testing/libfuzzer/fuzzer_test.gni +++ b/chromium/testing/libfuzzer/fuzzer_test.gni @@ -4,97 +4,152 @@ # Defines fuzzer_test. # +import("//build/config/features.gni") +import("//build/config/sanitizers/sanitizers.gni") import("//testing/test.gni") -# visible for testing only. -template("fuzzer_test_launcher") { - assert(defined(invoker.fuzzer_name), "need fuzzer_name in $target_name.") - assert(defined(invoker.dict), "need dict in $target_name.") - - generated_script = "$root_build_dir/$target_name" - - action(target_name) { - script = "//testing/libfuzzer/gen_fuzzer_runner.py" - args = [ - "--fuzzer", - invoker.fuzzer_name, - "--launcher", - rebase_path(generated_script, root_build_dir), - "--dict", - rebase_path("$target_out_dir/" + invoker.dict, root_build_dir), - ] - outputs = [ - generated_script, - ] - } -} - # fuzzer_test is used to define individual libfuzzer tests. # # Supported attributes: # - (required) sources - fuzzer test source files -# - data - test data files. # - deps - test dependencies # - additional_configs - additional configs to be used for compilation # - dict - a dictionary file for the fuzzer. +# - libfuzzer_options - options for the fuzzer (e.g. -max_len or -timeout). +# - seed_corpus - a directory with seed corpus. +# +# If use_libfuzzer gn flag is defined, then proper fuzzer would be build. +# Without use_libfuzzer a unit-test style binary would be built on linux +# and the whole target is a no-op otherwise. # # The template wraps test() target with appropriate dependencies. -# If any test run-time options are present (dict), then a launcher -# file would be generated with <fuzzer_name>.sh name in root output +# If any test run-time options are present (dict or libfuzzer_options), then a +# config (.options file) file would be generated or modified in root output # dir (next to test). template("fuzzer_test") { - assert(defined(invoker.sources), "Need sources in $target_name.") + if (!disable_libfuzzer && (use_libfuzzer || use_drfuzz || is_linux)) { + assert(defined(invoker.sources), "Need sources in $target_name.") - test_deps = [ "//testing/libfuzzer:libfuzzer_main" ] + test_deps = [ "//testing/libfuzzer:libfuzzer_main" ] - if (defined(invoker.deps)) { - test_deps += invoker.deps - } + if (defined(invoker.deps)) { + test_deps += invoker.deps + } - test_data = [] - if (defined(invoker.data)) { - test_data += invoker.data - } + if (defined(invoker.libfuzzer_options) && !defined(invoker.dict)) { + # Copy libfuzzer_options to output if dict is not provided. + copy(target_name + "_libfuzzer_options_copy") { + sources = [ + invoker.libfuzzer_options, + ] + outputs = [ + "$root_build_dir/" + target_name + ".options", + ] + } - if (defined(invoker.dict)) { - fuzzer_name = target_name - launcher_name = target_name + ".sh" - - # Copy dictionary to output - copy(target_name + "_dict_copy") { - sources = [ - invoker.dict, - ] - outputs = [ - "$target_out_dir/{{source_file_part}}", - ] + test_deps += [ ":" + target_name + "_libfuzzer_options_copy" ] } - fuzzer_test_launcher(launcher_name) { - dict = invoker.dict + if (defined(invoker.seed_corpus)) { + depfile = "$root_build_dir/$target_name" + ".seed_corpus.d" + out = "$root_build_dir/$target_name" + "_seed_corpus.zip" + + action(target_name + "_seed_corpus") { + script = "//testing/libfuzzer/archive_corpus.py" + args = [ + "--depfile", + rebase_path(depfile), + "--corpus", + rebase_path(invoker.seed_corpus), + "--output", + rebase_path(out), + "--fuzzer", + rebase_path("$root_build_dir/$target_name"), + ] + + depfile = depfile + outputs = [ + out, + ] + deps = [ + "//testing/libfuzzer:seed_corpus", + ] + } + + test_deps += [ ":" + target_name + "_seed_corpus" ] } - test_deps += [ - ":$launcher_name", - ":" + fuzzer_name + "_dict_copy", - ] - test_data += [ - invoker.dict, - ":$launcher_name", - ] - } + if (defined(invoker.dict)) { + # Copy dictionary to output. + copy(target_name + "_dict_copy") { + sources = [ + invoker.dict, + ] + outputs = [ + "$root_build_dir/" + target_name + ".dict", + ] + } - test(target_name) { - forward_variables_from(invoker, - [ - "sources", - "include_dirs", - ]) - deps = test_deps - data = test_data + test_deps += [ ":" + target_name + "_dict_copy" ] + # Generate new .options file or update an existing one. + config_name = target_name + ".options" + action(config_name) { + script = "//testing/libfuzzer/gen_fuzzer_config.py" + args = [ + "--config", + rebase_path("$root_build_dir/" + config_name), + "--dict", + rebase_path("$root_build_dir/" + invoker.target_name + ".dict"), + ] + + if (defined(invoker.libfuzzer_options)) { + args += [ + "--libfuzzer_options", + rebase_path(invoker.libfuzzer_options), + ] + } + outputs = [ + "$root_build_dir/$config_name", + ] + } + test_deps += [ ":" + config_name ] + } + + test(target_name) { + forward_variables_from(invoker, + [ + "sources", + "include_dirs", + ]) + deps = test_deps + + if (defined(invoker.additional_configs)) { + configs += invoker.additional_configs + } + } + } else { + # noop on unsupported platforms. + # mark attributes as used. + assert(invoker.sources == [] || invoker.sources != []) if (defined(invoker.additional_configs)) { - configs += invoker.additional_configs + assert( + invoker.additional_configs == [] || invoker.additional_configs != []) + } + if (defined(invoker.deps)) { + assert(invoker.deps == [] || invoker.deps != []) + } + if (defined(invoker.dict)) { + assert(invoker.dict == [] || invoker.dict != []) + } + if (defined(invoker.libfuzzer_options)) { + assert(invoker.libfuzzer_options == [] || invoker.libfuzzer_options != []) + } + if (defined(invoker.seed_corpus)) { + assert(invoker.seed_corpus == [] || invoker.seed_corpus != []) + } + + group(target_name) { } } } diff --git a/chromium/testing/libfuzzer/fuzzers/BUILD.gn b/chromium/testing/libfuzzer/fuzzers/BUILD.gn index 8fa3e88cc42..bab853b854a 100644 --- a/chromium/testing/libfuzzer/fuzzers/BUILD.gn +++ b/chromium/testing/libfuzzer/fuzzers/BUILD.gn @@ -8,6 +8,10 @@ import("//build/config/features.gni") import("//media/media_options.gni") import("//testing/libfuzzer/fuzzer_test.gni") +# root BUILD depenends on this target. Needed for package discovery +group("fuzzers") { +} + fuzzer_test("empty_fuzzer") { sources = [ "empty_fuzzer.cc", @@ -35,37 +39,6 @@ fuzzer_test("courgette_fuzzer") { additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] } -fuzzer_test("dns_record_fuzzer") { - sources = [ - "dns_record_fuzzer.cc", - ] - deps = [ - "//base", - "//net", - ] -} - -fuzzer_test("ftp_ctrl_response_fuzzer") { - sources = [ - "ftp_ctrl_response_fuzzer.cc", - ] - deps = [ - "//base", - "//net", - ] -} - -fuzzer_test("ftp_directory_listing_fuzzer") { - sources = [ - "ftp_directory_listing_fuzzer.cc", - ] - deps = [ - "//base", - "//base:i18n", - "//net", - ] -} - fuzzer_test("language_detection_fuzzer") { sources = [ "language_detection_fuzzer.cc", @@ -85,6 +58,8 @@ if (proprietary_codecs) { "//base", "//media", ] + libfuzzer_options = "mp4_box_reader_fuzzer.options" + dict = "dicts/mp4.dict" } } @@ -147,16 +122,6 @@ fuzzer_test("string_to_int_fuzzer") { ] } -fuzzer_test("unescape_url_component_fuzzer") { - sources = [ - "unescape_url_component_fuzzer.cc", - ] - deps = [ - "//base", - "//net", - ] -} - fuzzer_test("url_parse_fuzzer") { sources = [ "url_parse_fuzzer.cc", @@ -194,6 +159,7 @@ fuzzer_test("gfx_png_image_fuzzer") { "//base", "//ui/gfx", ] + dict = "dicts/png.dict" } fuzzer_test("zlib_uncompress_fuzzer") { @@ -205,94 +171,115 @@ fuzzer_test("zlib_uncompress_fuzzer") { ] } -fuzzer_test("pdfium_fuzzer") { +fuzzer_test("sqlite3_prepare_v2_fuzzer") { sources = [ - "pdfium_fuzzer.cc", + "sqlite3_prepare_v2_fuzzer.cc", ] deps = [ - "//third_party/pdfium", - "//third_party/pdfium:test_support", - "//v8", - "//v8:v8_libplatform", - ] - additional_configs = [ - "//third_party/pdfium:pdfium_config", - "//v8:external_startup_data", + "//third_party/sqlite", ] - dict = "dicts/pdf.dict" + dict = "dicts/sql.dict" } -fuzzer_test("websocket_frame_parser_fuzzer") { +fuzzer_test("libxml_xml_read_memory_fuzzer") { sources = [ - "websocket_frame_parser_fuzzer.cc", + "libxml_xml_read_memory_fuzzer.cc", ] deps = [ - "//net", + "//third_party/libxml:libxml", ] + dict = "dicts/xml.dict" } -fuzzer_test("http_chunked_decoder_fuzzer") { +fuzzer_test("unicode_string_codepage_create_fuzzer") { sources = [ - "http_chunked_decoder_fuzzer.cc", + "unicode_string_codepage_create_fuzzer.cc", ] deps = [ - "//net", + "//third_party/icu", ] } -fuzzer_test("quic_crypto_framer_parse_message_fuzzer") { +fuzzer_test("libpng_read_fuzzer") { sources = [ - "quic_crypto_framer_parse_message_fuzzer.cc", + "libpng_read_fuzzer.cc", ] deps = [ "//base", - "//net", + "//third_party/libpng", ] + dict = "dicts/png.dict" } -fuzzer_test("sqlite3_prepare_v2_fuzzer") { +fuzzer_test("icu_uregex_open_fuzzer") { sources = [ - "sqlite3_prepare_v2_fuzzer.cc", + "icu_uregex_open_fuzzer.cc", ] deps = [ - "//third_party/sqlite", + "//third_party/icu", ] - dict = "dicts/sql.dict" + dict = "dicts/icu_regex.dict" + libfuzzer_options = "icu_uregex_open_fuzzer.options" } -fuzzer_test("libxml_xml_read_memory_fuzzer") { - sources = [ - "libxml_xml_read_memory_fuzzer.cc", +fuzzer_test("v8_script_parser_fuzzer") { + sources = [] + deps = [ + "//v8:parser_fuzzer", + ] + dict = "dicts/js.dict" +} + +fuzzer_test("v8_json_parser_fuzzer") { + sources = [] + deps = [ + "//v8:json_fuzzer", ] + dict = "dicts/json.dict" +} + +fuzzer_test("v8_regexp_parser_fuzzer") { + sources = [] deps = [ - "//third_party/libxml:libxml", + "//v8:regexp_fuzzer", ] + dict = "dicts/regexp.dict" + libfuzzer_options = "v8_regexp_parser_fuzzer.options" } -fuzzer_test("unicode_string_codepage_create_fuzzer") { - sources = [ - "unicode_string_codepage_create_fuzzer.cc", +fuzzer_test("v8_wasm_fuzzer") { + sources = [] + deps = [ + "//v8:wasm_fuzzer", ] + dict = "dicts/v8_wasm.dict" + libfuzzer_options = "v8_wasm_fuzzer.options" +} + +fuzzer_test("v8_wasm_asmjs_fuzzer") { + sources = [] deps = [ - "//third_party/icu", + "//v8:wasm_asmjs_fuzzer", ] } -fuzzer_test("libexif_parser_fuzzer") { +fuzzer_test("third_party_re2_fuzzer") { sources = [ - "libexif_parser_fuzzer.cc", + "re2_fuzzer.cc", ] deps = [ - "//third_party/libexif:libexif_fuzzers", + "//third_party/re2:re2", ] + libfuzzer_options = "re2_fuzzer.options" } -fuzzer_test("libpng_read_fuzzer") { +fuzzer_test("libxml_xml_regexp_compile_fuzzer") { sources = [ - "libpng_read_fuzzer.cc", + "libxml_xml_regexp_compile_fuzzer.cc", ] deps = [ - "//base", - "//third_party/libpng", + "//third_party/libxml", ] + libfuzzer_options = "libxml_xml_regexp_compile_fuzzer.options" + additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] } diff --git a/chromium/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc index d275654b94a..fd9d2835dd2 100644 --- a/chromium/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc @@ -1,17 +1,18 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> +#include <stdint.h> + #include <string> #include "base/json/json_reader.h" #include "base/values.h" // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, - unsigned long size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { base::JSONReader reader; reader.Read(std::string(reinterpret_cast<const char*>(data), size)); return 0; } - diff --git a/chromium/testing/libfuzzer/fuzzers/brotli_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/brotli_fuzzer.cc index 9c45db4d607..c3048ec50f1 100644 --- a/chromium/testing/libfuzzer/fuzzers/brotli_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/brotli_fuzzer.cc @@ -1,27 +1,43 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> #include <stdint.h> #include "third_party/brotli/dec/decode.h" // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { - int kBufferSize = 1024; +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + size_t addend = 0; + if (size > 0) + addend = data[size - 1] & 7; + const uint8_t* next_in = data; + + const int kBufferSize = 1024; uint8_t* buffer = new uint8_t[kBufferSize]; BrotliState* state = new BrotliState(); BrotliStateInit(state); - size_t avail_in = size; - const uint8_t* next_in = data; - BrotliResult result = BROTLI_RESULT_NEEDS_MORE_OUTPUT; - while (result == BROTLI_RESULT_NEEDS_MORE_OUTPUT) { - size_t avail_out = kBufferSize; - uint8_t* next_out = buffer; - size_t total_out; - result = BrotliDecompressStream( - &avail_in, &next_in, &avail_out, &next_out, &total_out, state); + if (addend == 0) + addend = size; + /* Test both fast (addend == size) and slow (addend <= 7) decoding paths. */ + for (size_t i = 0; i < size;) { + size_t next_i = i + addend; + if (next_i > size) + next_i = size; + size_t avail_in = next_i - i; + i = next_i; + BrotliResult result = BROTLI_RESULT_NEEDS_MORE_OUTPUT; + while (result == BROTLI_RESULT_NEEDS_MORE_OUTPUT) { + size_t avail_out = kBufferSize; + uint8_t* next_out = buffer; + size_t total_out; + result = BrotliDecompressStream( + &avail_in, &next_in, &avail_out, &next_out, &total_out, state); + } + if (result != BROTLI_RESULT_NEEDS_MORE_INPUT) + break; } BrotliStateCleanup(state); diff --git a/chromium/testing/libfuzzer/fuzzers/courgette_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/courgette_fuzzer.cc index 601e84bc84c..fffb5b7d148 100644 --- a/chromium/testing/libfuzzer/fuzzers/courgette_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/courgette_fuzzer.cc @@ -1,21 +1,25 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. -#include "base/memory/scoped_ptr.h" +#include <stddef.h> +#include <stdint.h> + +#include <memory> + #include "courgette/assembly_program.h" #include "courgette/courgette.h" #include "courgette/encoded_program.h" +#include "courgette/program_detector.h" // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { - courgette::AssemblyProgram* prog; +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + std::unique_ptr<courgette::AssemblyProgram> prog; courgette::Status status = courgette::ParseDetectedExecutable(data, size, &prog); if (status != courgette::C_OK) { return 0; } - scoped_ptr<courgette::EncodedProgram> enc_prog(prog->Encode()); - courgette::DeleteAssemblyProgram(prog); + std::unique_ptr<courgette::EncodedProgram> enc_prog(prog->Encode()); return 0; } diff --git a/chromium/testing/libfuzzer/fuzzers/dicts/icu_regex.dict b/chromium/testing/libfuzzer/fuzzers/dicts/icu_regex.dict new file mode 100644 index 00000000000..b0456e6d3e3 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/dicts/icu_regex.dict @@ -0,0 +1,103 @@ +# 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. + +"\\a" +"\\A" +"\\b" +"\\B" +"\\cX" +"\\cC" +"\\cZ" +"\\d" +"\\D" +"\\e" +"\\u001B" +"\\E" +"\\f" +"\\u000C" +"\\G" +"\\h" +"\\u0009" +"\\H" +"\\k" +"\\n" +"\\N" +"\\p" +"\\P" +"{" +"}" +"\\Q" +"\\r" +"\\u000D" +"\\R" +"\\u000a" +"\\u000b" +"\\u000c" +"\\u000d" +"\\u0085" +"\\u2028" +"\\u2029" +"\\s" +"[\\t\\n\\f\\r\\p{Z}]" +"\\S" +"\\t" +"\\u0009" +"\\u" +"\\uf0ff" +"\\U" +"\\U0010ffff." +"\\v" +"\\V" +"\\w" +"\\W" +"\\x" +"\\xhh" +"\\X" +"\\Z" +"\\z" +"\\n" +"\\0" +"\\0ooo" +"." +"^" +"$" +"\\" +"|" +"*" +"+" +"?" +"," +"*?" +"+?" +"??" +"*+" +"++" +"?+" +"(" +"(?:" +"(?>" +"(?#" +"(?=" +"(?!" +"(?<=" +"(?<!" +"(?" +"-" +")" +":" +"(?ismwx-ismwx:" +"(?ismwx-ismwx)" +"(?i)" +"[" +"]" +"[\\u0000-\\U0010ffff]" +"[:script=Greek:]" +"{script=Greek}" +"gC" +"sc" +"scx" +"WB" +"Nd" +"d" +"MN" diff --git a/chromium/testing/libfuzzer/fuzzers/dicts/js.dict b/chromium/testing/libfuzzer/fuzzers/dicts/js.dict new file mode 100644 index 00000000000..f3a0f6c52b9 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/dicts/js.dict @@ -0,0 +1,115 @@ +# +# AFL dictionary for JavaScript +# ----------------------------- +# +# Contains basic reserved keywords and syntax building blocks. +# +# Created by Michal Zalewski <lcamtuf@google.com> +# + +keyword_arguments="arguments" +keyword_break="break" +keyword_case="case" +keyword_catch="catch" +keyword_const="const" +keyword_continue="continue" +keyword_debugger="debugger" +keyword_decodeURI="decodeURI" +keyword_default="default" +keyword_delete="delete" +keyword_do="do" +keyword_else="else" +keyword_escape="escape" +keyword_eval="eval" +keyword_export="export" +keyword_finally="finally" +keyword_for="for (a=0;a<2;a++)" +keyword_function="function" +keyword_if="if" +keyword_in="in" +keyword_instanceof="instanceof" +keyword_isNaN="isNaN" +keyword_let="let" +keyword_new="new" +keyword_parseInt="parseInt" +keyword_return="return" +keyword_super="super" +keyword_switch="switch" +keyword_this="this" +keyword_throw="throw" +keyword_try="try" +keyword_typeof="typeof" +keyword_var="var" +keyword_void="void" +keyword_while="while" +keyword_with="with" + +misc_1=" 1" +misc_a="a" +misc_array=" [1]" +misc_assign=" a=1" +misc_code_block=" {1}" +misc_colon_num=" 1:" +misc_colon_string=" 'a':" +misc_comma=" ," +misc_comment_block=" /* */" +misc_comment_line=" //" +misc_cond=" 1?2:3" +misc_dec=" --" +misc_div=" /" +misc_equals=" =" +misc_fn=" a()" +misc_identical=" ===" +misc_inc=" ++" +misc_minus=" -" +misc_modulo=" %" +misc_parentheses=" ()" +misc_parentheses_1=" (1)" +misc_parentheses_1x4=" (1,1,1,1)" +misc_parentheses_a=" (a)" +misc_period="." +misc_plus=" +" +misc_plus_assign=" +=" +misc_regex=" /a/g" +misc_rol=" <<<" +misc_semicolon=" ;" +misc_serialized_object=" {'a': 1}" +misc_string=" 'a'" +misc_unicode=" '\\u0001'" +misc_shl=" <<" +misc_shr=" >>" +misc_sae=" >>>" +misc_bit_or=" |" +misc_bit_and=" &" +misc_bit_xor=" ^" +misc_bit_not=" ~" + +object_Array=" Array" +object_Boolean=" Boolean" +object_Date=" Date" +object_Function=" Function" +object_Infinity=" Infinity" +object_Int8Array=" Int8Array" +object_Math=" Math" +object_NaN=" NaN" +object_Number=" Number" +object_Object=" Object" +object_RegExp=" RegExp" +object_String=" String" +object_Symbol=" Symbol" +object_false=" false" +object_null=" null" +object_true=" true" + +prop_charAt=".charAt" +prop_concat=".concat" +prop_constructor=".constructor" +prop_destructor=".destructor" +prop_length=".length" +prop_match=".match" +prop_proto=".__proto__" +prop_prototype=".prototype" +prop_slice=".slice" +prop_toCode=".toCode" +prop_toString=".toString" +prop_valueOf=".valueOf" diff --git a/chromium/testing/libfuzzer/fuzzers/dicts/json.dict b/chromium/testing/libfuzzer/fuzzers/dicts/json.dict new file mode 100644 index 00000000000..18a83f4fa5f --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/dicts/json.dict @@ -0,0 +1,33 @@ +# 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. + +"{" +"}" +"[" +"]" +"\"" +"'" +"\\" +"//" +":" +"," +" " +"\\n" +"\\r" +"/*" +"*/" +"true" +"false" +"null" +"\\u" +"\\b" +"\\f" +"\\t" +"." +"e" +"e+" +"e-" +"E" +"E+" +"E-" diff --git a/chromium/testing/libfuzzer/fuzzers/dicts/mp4.dict b/chromium/testing/libfuzzer/fuzzers/dicts/mp4.dict new file mode 100644 index 00000000000..d6c29e63b30 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/dicts/mp4.dict @@ -0,0 +1,80 @@ +FOURCC_NULL="\x00\x00\x00\x00" +FOURCC_AC3 ="\x61\x63\x2d\x33" +FOURCC_EAC3="\x65\x63\x2d\x33" +FOURCC_AVC1="\x61\x76\x63\x31" +FOURCC_AVC3="\x61\x76\x63\x33" +FOURCC_AVCC="\x61\x76\x63\x43" +FOURCC_BLOC="\x62\x6C\x6F\x63" +FOURCC_CENC="\x63\x65\x6e\x63" +FOURCC_CO64="\x63\x6f\x36\x34" +FOURCC_CTTS="\x63\x74\x74\x73" +FOURCC_DINF="\x64\x69\x6e\x66" +FOURCC_EDTS="\x65\x64\x74\x73" +FOURCC_EMSG="\x65\x6d\x73\x67" +FOURCC_ELST="\x65\x6c\x73\x74" +FOURCC_ENCA="\x65\x6e\x63\x61" +FOURCC_ENCV="\x65\x6e\x63\x76" +FOURCC_ESDS="\x65\x73\x64\x73" +FOURCC_FREE="\x66\x72\x65\x65" +FOURCC_FRMA="\x66\x72\x6d\x61" +FOURCC_FTYP="\x66\x74\x79\x70" +FOURCC_HDLR="\x68\x64\x6c\x72" +FOURCC_HINT="\x68\x69\x6e\x74" +FOURCC_HVC1="\x68\x76\x63\x31" +FOURCC_HVCC="\x68\x76\x63\x43" +FOURCC_IODS="\x69\x6f\x64\x73" +FOURCC_MDAT="\x6d\x64\x61\x74" +FOURCC_MDHD="\x6d\x64\x68\x64" +FOURCC_MDIA="\x6d\x64\x69\x61" +FOURCC_MECO="\x6d\x65\x63\x6f" +FOURCC_MEHD="\x6d\x65\x68\x64" +FOURCC_META="\x6d\x65\x74\x61" +FOURCC_MFHD="\x6d\x66\x68\x64" +FOURCC_MFRA="\x6d\x66\x72\x61" +FOURCC_MINF="\x6d\x69\x6e\x66" +FOURCC_MOOF="\x6d\x6f\x6f\x66" +FOURCC_MOOV="\x6d\x6f\x6f\x76" +FOURCC_MP4A="\x6d\x70\x34\x61" +FOURCC_MP4V="\x6d\x70\x34\x76" +FOURCC_MVEX="\x6d\x76\x65\x78" +FOURCC_MVHD="\x6d\x76\x68\x64" +FOURCC_PASP="\x70\x61\x73\x70" +FOURCC_PDIN="\x70\x64\x69\x6e" +FOURCC_PRFT="\x70\x72\x66\x74" +FOURCC_PSSH="\x70\x73\x73\x68" +FOURCC_SAIO="\x73\x61\x69\x6f" +FOURCC_SAIZ="\x73\x61\x69\x7a" +FOURCC_SBGP="\x73\x62\x67\x70" +FOURCC_SCHI="\x73\x63\x68\x69" +FOURCC_SCHM="\x73\x63\x68\x6d" +FOURCC_SDTP="\x73\x64\x74\x70" +FOURCC_SEIG="\x73\x65\x69\x67" +FOURCC_SENC="\x73\x65\x6e\x63" +FOURCC_SGPD="\x73\x67\x70\x64" +FOURCC_SIDX="\x73\x69\x64\x78" +FOURCC_SINF="\x73\x69\x6e\x66" +FOURCC_SKIP="\x73\x6b\x69\x70" +FOURCC_SMHD="\x73\x6d\x68\x64" +FOURCC_SOUN="\x73\x6f\x75\x6e" +FOURCC_SSIX="\x73\x73\x69\x78" +FOURCC_STBL="\x73\x74\x62\x6c" +FOURCC_STCO="\x73\x74\x63\x6f" +FOURCC_STSC="\x73\x74\x73\x63" +FOURCC_STSD="\x73\x74\x73\x64" +FOURCC_STSS="\x73\x74\x73\x73" +FOURCC_STSZ="\x73\x74\x73\x7a" +FOURCC_STTS="\x73\x74\x74\x73" +FOURCC_STYP="\x73\x74\x79\x70" +FOURCC_TENC="\x74\x65\x6e\x63" +FOURCC_TFDT="\x74\x66\x64\x74" +FOURCC_TFHD="\x74\x66\x68\x64" +FOURCC_TKHD="\x74\x6b\x68\x64" +FOURCC_TRAF="\x74\x72\x61\x66" +FOURCC_TRAK="\x74\x72\x61\x6b" +FOURCC_TREX="\x74\x72\x65\x78" +FOURCC_TRUN="\x74\x72\x75\x6e" +FOURCC_UDTA="\x75\x64\x74\x61" +FOURCC_UUID="\x75\x75\x69\x64" +FOURCC_VIDE="\x76\x69\x64\x65" +FOURCC_VMHD="\x76\x6d\x68\x64" +FOURCC_WIDE="\x77\x69\x64\x65" diff --git a/chromium/testing/libfuzzer/fuzzers/dicts/pdf.dict b/chromium/testing/libfuzzer/fuzzers/dicts/pdf.dict deleted file mode 100644 index a6c48d59eaa..00000000000 --- a/chromium/testing/libfuzzer/fuzzers/dicts/pdf.dict +++ /dev/null @@ -1,1466 +0,0 @@ -# -# AFL dictionary for PDF -# ---------------------- -# -# This is a pretty big PDF dictionary constructed by Ben by manually reviewing -# the spec and combining that with the data pulled out of a corpus of sample -# PDFs. -# -# Contributed by Ben Nagy <ben@iagu.net> -# - -"#" -"%" -"%%" -"%%EOF" -"%FDF-1.7" -"%PDF-1.7" -"(" -"(/xdp:xdp)" -"(\\001)" -"(config)" -"(datasets)" -"(template)" -"(xdp:xdp)" -")" -"-1" -"-1.0" -".." -"/" -"/#23clipboard" -"/.notdef" -"/1" -"/1.0" -"/1.3" -"/3D" -"/3DA" -"/3DAnimationStyle" -"/3DB" -"/3DD" -"/3DI" -"/3DLightingScheme" -"/3DRenderMode" -"/3DV" -"/3DView" -"/90pv-RKSJ-H" -"/A" -"/A0" -"/A85" -"/AA" -"/AAIC" -"/AAPL" -"/ABCDEF+ACaslonPro-Regular" -"/ABCDEF+AJensonPro-LtIt" -"/ABCDEF+AdobeCorpID-MinionRg" -"/ABCDEF+Arial,Bold" -"/ABCDEF+BankGothicMdBT" -"/ABCDEF+Bauhaus-Heavy" -"/ABCDEF+BluesClues" -"/ABCDEF+BodegaSans" -"/ABCDEF+BodoniMTCondensed" -"/ABCDEF+BookAntiqua" -"/ABCDEF+CMBX10" -"/ABCDEF+CaflischScriptPro-Regular" -"/ABCDEF+CityBlueprint" -"/ABCDEF+CourierNewPSMT" -"/ABCDEF+FixedsysExcelsior2.00" -"/ABCDEF+MSTT31854bd45bo188067S00" -"/ABCDEF+MinionPro-BoldCnIt" -"/ABCDEF+MyriadMM-It_400_300_" -"/ABCDEF+Wingdings" -"/ABCDEF+ZapfDingbats" -"/AC" -"/ADBE" -"/ADB_DEVICE_DEFAULT_STYLE" -"/ADB_DefaultStyle" -"/ADB_NO_TRAP_STYLE" -"/AE" -"/AESV2" -"/AGaramond" -"/AH" -"/AI8DstIndex" -"/AI8SrcIndex" -"/AIMetaData" -"/AIPDFPrivateData1" -"/AIS" -"/AL" -"/AN" -"/AP" -"/AS" -"/ASCII85Decode" -"/ASCIIHexDecode" -"/ASomewhatLongerName" -"/AU" -"/Aacute" -"/Acc.#20Prod.#202501#20#2F2#20#20" -"/Accounts#20payable" -"/AccurateScreens" -"/Acircumflex" -"/AcroForm" -"/Action" -"/Actual" -"/Add" -"/Adieresis" -"/Adobe" -"/Adobe#20PDF#20Library" -"/Adobe.PPKLite" -"/AdobeCorpID-Acrobat" -"/AdobeCorpID-MinionRg" -"/AdobePhotoshop" -"/Agrave" -"/All" -"/AllKO" -"/AllOn" -"/Alt" -"/Alternate" -"/AlternatePresentations" -"/Alternates" -"/Amex" -"/And" -"/Angle" -"/Annot" -"/Annots" -"/AntiAlias" -"/AnyOn" -"/Apag_PDFX_Checkup" -"/App" -"/Architecture-Normal" -"/Arial" -"/Aring" -"/Art" -"/ArtBox" -"/Article" -"/Artifact" -"/Artwork" -"/Ascent" -"/Aspect" -"/Assistant" -"/Atilde" -"/AuthEvent" -"/Author" -"/Avenir-Heavy" -"/Avenir-MediumOblique" -"/AvgWidth" -"/BBox" -"/BC" -"/BCL" -"/BDC" -"/BDL" -"/BE" -"/BFSOL" -"/BG" -"/BG2" -"/BM" -"/BMC" -"/BS" -"/BW" -"/Bank" -"/BaseEncoding" -"/BaseFont" -"/BaseState" -"/BaseVersion" -"/Birch" -"/BitsPerComponent" -"/BitsPerCoordinate" -"/BitsPerFlag" -"/BitsPerSample" -"/Bl" -"/BlCDel" -"/BlMiNu" -"/Black" -"/BlackIs1" -"/BlackOP" -"/BlackPoint" -"/BleedBox" -"/Blend" -"/Block" -"/Blue" -"/BluesClues" -"/Bookshelf" -"/Border" -"/Bounds" -"/BoxColorInfo" -"/Btn" -"/BulmerMT-BoldDisplay" -"/ByteRange" -"/C" -"/C0" -"/C0_0" -"/C1" -"/C2W" -"/C3" -"/CALS_AIS" -"/CALS_BM" -"/CALS_HT" -"/CALS_SMASK" -"/CALS_ca" -"/CAM" -"/CB" -"/CC" -"/CCH" -"/CCITTFaxDecode" -"/CD" -"/CDL" -"/CEN" -"/CF" -"/CFM" -"/CI" -"/CIDFontType0" -"/CIDFontType0C" -"/CIDFontType2" -"/CIDInit" -"/CIDSet" -"/CIDSystemInfo" -"/CIDToGIDMap" -"/CMV_LabBar" -"/CMV_LabControl" -"/CMYK" -"/CMYK#20#2880,#208,#2034,#200#29" -"/CMap" -"/CMapName" -"/CMapType" -"/CMapVersion" -"/CO" -"/CP" -"/CS" -"/CS0" -"/CT" -"/CV" -"/CalGray" -"/CalRGB" -"/CapHeight" -"/Caption" -"/Caslon540BT-Roman" -"/CaslonBT-Bold" -"/CaslonBT-BoldItalic" -"/Catalog" -"/Category" -"/Ccedilla" -"/CenturySchoolbookBT-Roman" -"/Ch" -"/Chair" -"/Chap" -"/Chaparral-Display" -"/CharProcs" -"/CharSet" -"/CheckSum" -"/Circle" -"/ClarendonBT-Black" -"/ClassMap" -"/Clearface-Black" -"/Clip" -"/ClippedText" -"/Cn" -"/Collection" -"/CollectionItem" -"/CollectionSchema" -"/CollectionSubitem" -"/Color" -"/ColorBurn" -"/ColorDodge" -"/ColorMatch" -"/ColorSpace" -"/ColorTransform" -"/ColorType" -"/Colorants" -"/Colors" -"/Columns" -"/ComicSansMS,Bold" -"/Comment" -"/Comments" -"/Company" -"/Compatibility" -"/Compatible" -"/Components" -"/CompressArt" -"/Condensed" -"/Configs" -"/Consultant" -"/ContainerVersion" -"/Contents" -"/Coords" -"/Copy" -"/Copy#20center" -"/Cor" -"/Corner#20surface" -"/CosineDot" -"/Count" -"/Cour" -"/Courier" -"/Create" -"/CreationDate" -"/Creator" -"/CreatorInfo" -"/CreatorVersion" -"/CropBox" -"/CropFixed" -"/CropRect" -"/Crypt" -"/CryptFilter" -"/CryptFilterDecodeParms" -"/Cs12" -"/Cs3" -"/Cyan" -"/D" -"/DA" -"/DCTDecode" -"/DIC#202525p*" -"/DIS" -"/DL" -"/DOS" -"/DP" -"/DR" -"/DS" -"/DSz" -"/DV" -"/DW" -"/DamagedRowsBeforeError" -"/Darken" -"/Data" -"/Date" -"/Decode" -"/DecodeParms" -"/DefEmbeddedFile" -"/Default" -"/DefaultCryptFilter" -"/DefaultForPrinting" -"/DefaultRGB" -"/Delete" -"/Delta" -"/DescendantFonts" -"/Descent" -"/Description" -"/Design" -"/Dest" -"/DestOutputProfile" -"/DestOutputProfileRef" -"/Dests" -"/DeviceCMYK" -"/DeviceGray" -"/DeviceN" -"/DeviceRGB" -"/Difference" -"/Differences" -"/DigestLocation" -"/DigestMethod" -"/DigestValue" -"/Dimmed" -"/Direction" -"/DisplayDocTitle" -"/Dissolve" -"/Div" -"/Dm" -"/DocMDP" -"/DocOpen" -"/Document" -"/Documents" -"/Domain" -"/Door" -"/DotGain" -"/Draw" -"/Dt" -"/Dur" -"/Dynamic#20connector" -"/E" -"/EF" -"/EFF" -"/EMC" -"/Eacute" -"/EarlyChange" -"/Ecircumflex" -"/Edieresis" -"/Editable" -"/Egrave" -"/EmbedFonts" -"/EmbedICCProfile" -"/Embedded" -"/EmbeddedFile" -"/EmbeddedFiles" -"/Encode" -"/EncodedByteAlign" -"/Encoding" -"/Encrypt" -"/EncryptMetadata" -"/EndIndent" -"/EndOfBlock" -"/EndOfLine" -"/Euro" -"/Euro.037" -"/Event" -"/ExData" -"/Exchange-Pro" -"/Exclude" -"/Exclusion" -"/Executive" -"/Export" -"/ExportCrispy" -"/ExportState" -"/ExtGState" -"/Extend" -"/Extends" -"/ExtensionLevel" -"/Extensions" -"/F1" -"/F1.0" -"/F12" -"/F13" -"/F3" -"/F5" -"/F6" -"/F7" -"/F8" -"/FB" -"/FD" -"/FDecodeParms" -"/FFilter" -"/FICL" -"/FM" -"/FOV" -"/FRM" -"/FS" -"/FT" -"/Facilities" -"/Fade" -"/False" -"/Feature" -"/FedEx#20Orange" -"/FedEx#20Purple" -"/Field" -"/Fields" -"/Figure" -"/File" -"/Files" -"/Filespec" -"/FillIn" -"/Filter" -"/First" -"/FirstChar" -"/FirstPage" -"/Fit" -"/FitB" -"/FitBH" -"/FitBV" -"/FitH" -"/FitR" -"/FitV" -"/FitWindow" -"/FixedPrint" -"/Flags" -"/FlateDecode" -"/Fm0" -"/Fm4" -"/Fo" -"/Focoltone#201047" -"/Font" -"/FontBBox" -"/FontDescriptor" -"/FontFamily" -"/FontFile" -"/FontFile2" -"/FontMatrix" -"/FontName" -"/FontStretch" -"/FontWeight" -"/Form" -"/FormEx" -"/FormType" -"/FreeText" -"/FreeTextCallout" -"/Frequency" -"/FullSave" -"/FullScreen" -"/Function" -"/FunctionType" -"/Functions" -"/Futura-Bold" -"/Futura-CondensedExtraBold" -"/G" -"/G02" -"/GLGR" -"/GS0" -"/GS1" -"/GS2" -"/GTS" -"/GTS_PDFA1" -"/GTS_PDFX" -"/GTS_PDFXConformance" -"/GTS_PDFXVersion" -"/GWG#20Green" -"/Gamma" -"/Garamond" -"/Georgia,Bold" -"/GoTo" -"/GoTo3DView" -"/GoToE" -"/GoToR" -"/Gold" -"/Goudy" -"/Gray" -"/Green" -"/GreymantleMVB" -"/GrotesqueMT" -"/Group" -"/H" -"/HDAG_Tools" -"/HKana" -"/HT" -"/HT2" -"/Halftone" -"/HalftoneName" -"/HalftoneType" -"/HardLight" -"/HeBo" -"/Head1" -"/Headlamp" -"/Height" -"/HeiseiMin" -"/Helv" -"/Helvetica" -"/Helvetica-Bold" -"/Helvetica-BoldOblique" -"/Helvetica-Condensed" -"/HelveticaNeue-Black" -"/Hide" -"/HonMincho-M" -"/Horizontal" -"/Hue" -"/I" -"/I0" -"/IC" -"/ICCBased" -"/ICCVersion" -"/ID" -"/IDS" -"/IDTree" -"/IEC" -"/IF" -"/IN" -"/ISO32000Registry" -"/ISO_PDFE1" -"/ISO_PDFEVersion" -"/IT" -"/ITO" -"/ITP" -"/IV" -"/IX" -"/Icircumflex" -"/Icon" -"/Identity" -"/Identity-H" -"/IgnEP" -"/Illustrator" -"/Illustrator8.0" -"/Im0" -"/Im1" -"/Im2" -"/Im3" -"/Im4" -"/Image" -"/Image1" -"/ImageB" -"/ImageC" -"/ImageI" -"/ImageMask" -"/ImageResources" -"/ImageType" -"/Import" -"/ImportData" -"/ImpressBT-Regular" -"/Index" -"/Indexed" -"/Info" -"/Information#20services" -"/Ink" -"/InkList" -"/InsertPages" -"/Insignia" -"/IntegerItem" -"/Intent" -"/Interpolate" -"/ItalicAngle" -"/ItcKabel-Ultra" -"/Item1" -"/Item2" -"/JBIG2Decode" -"/JBIG2Globals" -"/JPXDecode" -"/JS" -"/JT" -"/JTC" -"/JTF" -"/JTFile" -"/JTM" -"/JavaScript" -"/JobTicketContents" -"/Justify" -"/Keywords" -"/Kids" -"/L" -"/L1" -"/L1a" -"/L1b" -"/L2R" -"/L50188" -"/LBody" -"/LI" -"/LL" -"/LLE" -"/LLO" -"/LS" -"/LSP" -"/LZW" -"/LZWDecode" -"/Lab" -"/Lang" -"/Last" -"/LastChar" -"/LastItem" -"/LastModified" -"/Lateral#20file" -"/Launch" -"/Layout" -"/Lbl" -"/Leading" -"/Legal" -"/Length" -"/Length1" -"/Length2" -"/Length3" -"/LetterspaceFlags" -"/Lighten" -"/Limits" -"/Line" -"/LineDimension" -"/LineHeight" -"/Linear" -"/Linearized" -"/Link" -"/Locked" -"/LogoGreen" -"/LrTb" -"/Lslash" -"/Luminosity" -"/M" -"/MB" -"/MC" -"/MC0" -"/MCD" -"/MCID" -"/MCR" -"/MD5" -"/MH" -"/MIT" -"/MK" -"/MMType1" -"/MP" -"/MR" -"/MS" -"/MUX#20#2F#20DEMUX" -"/Mac" -"/MacRomanEncoding" -"/Magenta" -"/Manager" -"/MarkInfo" -"/Marked" -"/MarkedPDF" -"/Marker#20board" -"/Markup3D" -"/Mask" -"/Mastercard" -"/Matrix" -"/Max" -"/MaxLen" -"/MaxWidth" -"/Me" -"/Measure" -"/MediaBox" -"/MetaData" -"/Min" -"/MinionMM" -"/MissingWidth" -"/MixedContainer" -"/MixingHints" -"/ModDate" -"/Mode" -"/Modify" -"/Movie" -"/Msg" -"/MurrayHillBT-Bold" -"/MxGeom" -"/MxLaNu" -"/MxPts" -"/MyriadPro-Black" -"/NA" -"/NChannel" -"/ND" -"/NL" -"/NM" -"/NR" -"/Name" -"/Name1" -"/Named" -"/Names" -"/NeedsRendering" -"/NewCenturySchlbk-Italic" -"/NewWindow" -"/Next" -"/NextPage" -"/No" -"/NonEFontNoWarn" -"/NonStruct" -"/None" -"/Normal" -"/Not" -"/NotDefSpecial" -"/NumBlock" -"/Nums" -"/OB" -"/OBJR" -"/OC" -"/OC2" -"/OC3" -"/OC4" -"/OCG" -"/OCGs" -"/OCL" -"/OCMD" -"/OCProperties" -"/OE" -"/OFF" -"/OLN" -"/ON" -"/OOL" -"/OPBG" -"/OPBS" -"/OPI" -"/OPM" -"/OS" -"/OT" -"/Oacute" -"/Obj" -"/ObjStm" -"/Ocircumflex" -"/Odieresis" -"/Ograve" -"/Omega" -"/OneColumn" -"/Online" -"/Open" -"/OpenAction" -"/Operation" -"/Opt" -"/OptionSet" -"/Options" -"/Or" -"/Orange" -"/Order" -"/Ordering" -"/OriginalLayerName" -"/Oslash" -"/Otilde" -"/Outlines" -"/OutputCondition" -"/OutputConditionIdentifier" -"/OutputIntent" -"/OutputIntents" -"/Overlay" -"/P0" -"/P1" -"/P2" -"/P2,#2300ff007900000000,PANTONE#20151#20C" -"/PANTONE" -"/PANTONE#20158-5#20CVS" -"/PANTONE#20221#20CVU" -"/PANTONE#203405#20C" -"/PANTONE#20399#20CVC" -"/PANTONE#20Blue#20072#20C" -"/PANTONE#20Orange#20021#20C" -"/PANTONE#20Orange#20021#20CVC" -"/PANTONE#20Yellow#20C" -"/PC" -"/PDFDocEncoding" -"/PIX" -"/PO" -"/PS" -"/PUBLISHER" -"/PZ" -"/Pa0" -"/Page" -"/PageElement" -"/PageLabels" -"/PageLayout" -"/PageMode" -"/PageRange" -"/Pages" -"/PaintType" -"/Palatino,Bold" -"/Pale#20Brown.c" -"/Panose" -"/Paper#20tray" -"/Para" -"/Params" -"/Parent" -"/ParentTree" -"/ParentTreeNextKey" -"/Part" -"/Pattern" -"/PatternType" -"/PcZ" -"/Perceptual" -"/Perms" -"/Pg" -"/Pgf" -"/PieceInfo" -"/PitStop" -"/Placement" -"/Play" -"/Polygon" -"/PolygonCloud" -"/Popup" -"/Position" -"/PowerUpPDF" -"/PrOut" -"/PrRGBGra" -"/PrRGBIma" -"/Predictor" -"/PresSteps" -"/PreserveRB" -"/Prev" -"/PrevPage" -"/Preview" -"/Print" -"/PrintRecord" -"/PrintScaling" -"/PrintState" -"/PrintStyle" -"/Printed" -"/PrintingOrder" -"/Private" -"/ProcSet" -"/Process" -"/ProcessBlue" -"/ProcessGreen" -"/ProcessRed" -"/Producer" -"/ProfileCS" -"/ProfileName" -"/Prop_Build" -"/Properties" -"/Proportional" -"/PubSec" -"/Q" -"/QuadPoints" -"/R1" -"/RBGroups" -"/RC" -"/RD" -"/REC" -"/REx" -"/RF" -"/RGB" -"/RI" -"/RICMYKGra" -"/RICMYKIma" -"/RICalGra" -"/RICalIma" -"/RIDefault" -"/RIDevNGra" -"/RIDevNIma" -"/RIRGBGra" -"/RIRGBIma" -"/RL" -"/RM" -"/RV" -"/Range" -"/Rect" -"/Red" -"/Redact" -"/Ref" -"/Reference" -"/Registry" -"/RegistryName" -"/RelativeColorimetric" -"/Rendition" -"/Renditions" -"/Requirements" -"/ResetForm" -"/Resolution" -"/Resources" -"/ReversedChars" -"/RoleMap" -"/Root" -"/Rotate" -"/Round" -"/RoundTrip" -"/RoundtripVersion" -"/Router" -"/Rows" -"/RunLengthDecode" -"/Ryumin" -"/SA" -"/SBDraft" -"/SC" -"/SE" -"/SFSSL" -"/SFTWS" -"/SI" -"/SL" -"/SLA" -"/SM" -"/SMask" -"/SMaskInData" -"/SP" -"/SPS" -"/STL" -"/SU" -"/SW" -"/Saturation" -"/SaveAs" -"/SaveContents" -"/SaveResource" -"/SavedBy" -"/Scaron" -"/Schema" -"/Screen" -"/Sect" -"/SemiCondensed" -"/SemiExpanded" -"/Separation" -"/SeparationInfo" -"/SetOCGState" -"/SettingsFileName" -"/Sh0" -"/Sh1" -"/Shading" -"/ShadingType" -"/Shape" -"/Sig" -"/SigFlags" -"/SigRef" -"/Signature" -"/Signed" -"/SinglePage" -"/Size" -"/SlideShow" -"/SoftLight" -"/Solid" -"/Solidities" -"/SomeName" -"/Sort" -"/Sound" -"/Space" -"/SpaceAfter" -"/SpaceBefore" -"/Span" -"/SpawnTemplate" -"/SpdrArt" -"/SpiderInfo" -"/Split" -"/Spot" -"/Spot1" -"/Spot2" -"/SpotFunction" -"/SpotMap" -"/St" -"/Stamp" -"/StandardImageFileData" -"/Star" -"/Start" -"/StartIndent" -"/StartResource" -"/State" -"/StdCF" -"/StemH" -"/StemV" -"/Stm" -"/StmF" -"/Stop" -"/Story" -"/StrF" -"/StrikeOut" -"/StringItem" -"/StructElem" -"/StructParent" -"/StructParents" -"/StructTreeRoot" -"/Style" -"/SubFilter" -"/SubType" -"/Subdictionary" -"/Subform" -"/Subj" -"/Subject" -"/SubmitForm" -"/SubmitStandalone" -"/SubsetFontsBelow" -"/SubsetFontsRatio" -"/Supplement" -"/Swiss721BT-Black" -"/Switch" -"/T" -"/T1" -"/T1_0" -"/TB" -"/TC" -"/TCS" -"/TF" -"/TID" -"/TK" -"/TM" -"/TO" -"/TOC" -"/TOCI" -"/TOYO#200004pc" -"/TP" -"/TR" -"/TR2" -"/TRUMATCH#206-e" -"/TS" -"/TSV" -"/TT" -"/TT0" -"/TTRefMan" -"/TU" -"/TV" -"/TW" -"/TWS" -"/TWY" -"/Tabs" -"/TagSuspect" -"/TargetCS" -"/Technical" -"/Template" -"/TemplateInstantiated" -"/Templates" -"/Text" -"/TextAlign" -"/TextBox" -"/TextIndent" -"/The" -"/This" -"/Thorn" -"/Thread" -"/Threads" -"/Thumb" -"/Thumbnail" -"/Thumbs" -"/Ti" -"/TiBI" -"/TilingType" -"/Times-BoldItalic" -"/Times-Roman" -"/Title" -"/ToUnicode" -"/Toggle" -"/Trans" -"/TransferFunction" -"/TransformMethod" -"/TransformParams" -"/Transparency" -"/TrapInfo" -"/TrapMagicNumber" -"/TrapRegions" -"/TrapSet" -"/Trapped" -"/Trapping" -"/TrappingDetails" -"/TrappingParameters" -"/TrimBox" -"/True" -"/TrueType" -"/TrustedMode" -"/TwoColumnLeft" -"/Tx" -"/Type" -"/Type0" -"/U3D" -"/UA" -"/UCR" -"/UCR2" -"/UIDOffset" -"/UR" -"/UR3" -"/URI" -"/URL" -"/URLs" -"/Uacute" -"/Ucircumflex" -"/Udieresis" -"/Ugrave" -"/Univers-BoldExt" -"/Unix" -"/Unknown" -"/Usage" -"/UseAttachments" -"/UseNone" -"/UseOC" -"/UseOutlines" -"/UseThumbs" -"/UsedCMYK" -"/UserProperties" -"/UserUnit" -"/V2" -"/VA" -"/VE" -"/VP" -"/Verdana,Bold" -"/Version" -"/Vertical" -"/VeryLastItem" -"/View" -"/ViewerPreferences" -"/Visa" -"/Visible" -"/Volume" -"/W2" -"/WAI" -"/WAN" -"/WMode" -"/WP" -"/WarnockPro-BoldIt" -"/Watermark" -"/WebCapture" -"/Which" -"/WhiteBG" -"/WhitePoint" -"/Widget" -"/Width" -"/Widths" -"/Win" -"/WinAnsiEncoding" -"/Window" -"/Windows" -"/Work#20surface" -"/Workbook" -"/Worksheet" -"/WritingMode" -"/X" -"/X1" -"/XFA" -"/XHeight" -"/XML" -"/XN" -"/XObject" -"/XRef" -"/XRefStm" -"/XStep" -"/XUID" -"/XYZ" -"/Y" -"/YStep" -"/Yacute" -"/Ydieresis" -"/Yellow" -"/Z" -"/Z7KNXbN" -"/ZaDb" -"/ZapfDingbats" -"/Zcaron" -"/Zoom" -"/_No_paragraph_style_" -"/a1" -"/acute" -"/adbe.pkcs7.detached" -"/ampersand" -"/apple" -"/approxequal" -"/asciicircum" -"/asciitilde" -"/asterisk" -"/at" -"/audio#2Fmpeg" -"/b" -"/backslash" -"/bar" -"/blank" -"/braceleft" -"/braceright" -"/bracketleft" -"/bracketright" -"/breve" -"/brokenbar" -"/bullet" -"/c108" -"/cCompKind" -"/cCompQuality" -"/cCompression" -"/cRes" -"/cResolution" -"/ca" -"/caron" -"/cedilla" -"/cent" -"/circumflex" -"/colon" -"/comma" -"/copyright" -"/currency" -"/dagger" -"/daggerdbl" -"/degree" -"/deviceNumber" -"/dieresis" -"/divide" -"/dollar" -"/dotaccent" -"/dotlessi" -"/dotlessj" -"/eight" -"/ellipsis" -"/emdash" -"/endash" -"/equal" -"/eth" -"/exclam" -"/exclamdown" -"/f" -"/ff" -"/ffi" -"/ffl" -"/fi" -"/five" -"/fl" -"/florin" -"/four" -"/fraction" -"/gCompKind" -"/gCompQuality" -"/gCompression" -"/gRes" -"/gResolution" -"/germandbls" -"/go1" -"/grave" -"/greater" -"/greaterequal" -"/guillemotleft" -"/guillemotright" -"/guilsinglleft" -"/guilsinglright" -"/hungarumlaut" -"/hyphen" -"/iacute" -"/idieresis" -"/igrave" -"/infinity" -"/integral" -"/j" -"/k" -"/less" -"/lessequal" -"/logicalnot" -"/lozenge" -"/lt#20blue" -"/mCompKind" -"/mCompression" -"/mRes" -"/mResolution" -"/macron" -"/minus" -"/mu" -"/multiply" -"/n" -"/n0" -"/nine" -"/notequal" -"/ntilde" -"/numbersign" -"/o" -"/ogonek" -"/one" -"/onehalf" -"/onequarter" -"/onesuperior" -"/op" -"/ordfeminine" -"/ordmasculine" -"/p" -"/pageH" -"/pageV" -"/paragraph" -"/parenleft" -"/parenright" -"/partialdiff" -"/pdf" -"/pdfx" -"/percent" -"/period" -"/periodcentered" -"/perthousand" -"/pi" -"/plus" -"/plusminus" -"/pms#208400" -"/printX" -"/product" -"/question" -"/questiondown" -"/quotedbl" -"/quotedblbase" -"/quotedblleft" -"/quotedblright" -"/quoteleft" -"/quoteright" -"/quotesinglbase" -"/quotesingle" -"/r" -"/radical" -"/registered" -"/ring" -"/s" -"/s1" -"/sd1" -"/sd2" -"/section" -"/semicolon" -"/seven" -"/six" -"/slash" -"/sterling" -"/summation" -"/thinspace" -"/three" -"/threequarters" -"/threesuperior" -"/tilde" -"/trademark" -"/two" -"/twosuperior" -"/u" -"/underscore" -"/v" -"/w" -"/y1" -"/yen" -"/yes" -"/zero" -"0 R" -"1" -"1.0" -"<" -"<<" -">" -">>" -"Adobe.PPKLite" -"Adobe.PubSec" -"B*" -"BDC" -"BI" -"BMC" -"BT" -"BX" -"CS" -"DP" -"Do" -"EI" -"EMC" -"ET" -"EX" -"Entrust.PPKEF" -"ID" -"MP" -"R" -"T*" -"TJ" -"TL" -"Tc" -"Td" -"Tf" -"Tj" -"Tm" -"Tr" -"Ts" -"Tw" -"W*" -"[" -"[0.0 0.0 0.0 0.0 0.0 0.0]" -"[1 1 1]" -"[1.0 -1.0 1.0 -1.0]" -"[1.0 -1.0]" -"\\" -"]" -"abs" -"adbe.pkcs7.s3" -"adbe.pkcs7.s4" -"adbe.pkcs7.s5" -"add" -"and" -"atan" -"begin" -"beginarrangedfont" -"beginbfchar" -"begincidrange" -"begincmap" -"begincodespacerange" -"beginnotdefchar" -"beginnotdefrange" -"beginusematrix" -"bitshift" -"ceiling" -"cm" -"copy" -"cos" -"cvi" -"cvr" -"d0" -"d1" -"div" -"dup" -"end" -"endarrangedfont" -"endbfchar" -"endcidrange" -"endcmap" -"endcodespacerange" -"endnotdefchar" -"endnotdefrange" -"endobj" -"endstream" -"endusematrix" -"eq" -"exch" -"exp" -"f*" -"false" -"findresource" -"floor" -"ge" -"gs" -"gt" -"idiv" -"if" -"ifelse" -"index" -"le" -"ln" -"log" -"lt" -"mod" -"mul" -"ne" -"neg" -"not" -"null" -"obj" -"or" -"page" -"pop" -"re" -"rg" -"ri" -"roll" -"round" -"sin" -"sqrt" -"startxref" -"stream" -"sub" -"trailer" -"true" -"truncate" -"usecmap" -"usefont" -"xor" -"xref" -"{" -"}" diff --git a/chromium/testing/libfuzzer/fuzzers/dicts/png.dict b/chromium/testing/libfuzzer/fuzzers/dicts/png.dict new file mode 100644 index 00000000000..ea12d19e6ec --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/dicts/png.dict @@ -0,0 +1,38 @@ +# +# AFL dictionary for PNG images +# ----------------------------- +# +# Just the basic, standard-originating sections; does not include vendor +# extensions. +# +# Created by Michal Zalewski <lcamtuf@google.com> +# + +header_png="\x89PNG\x0d\x0a\x1a\x0a" + +section_IDAT="IDAT" +section_IEND="IEND" +section_IHDR="IHDR" +section_PLTE="PLTE" +section_bKGD="bKGD" +section_cHRM="cHRM" +section_fRAc="fRAc" +section_gAMA="gAMA" +section_gIFg="gIFg" +section_gIFt="gIFt" +section_gIFx="gIFx" +section_hIST="hIST" +section_iCCP="iCCP" +section_iTXt="iTXt" +section_oFFs="oFFs" +section_pCAL="pCAL" +section_pHYs="pHYs" +section_sBIT="sBIT" +section_sCAL="sCAL" +section_sPLT="sPLT" +section_sRGB="sRGB" +section_sTER="sTER" +section_tEXt="tEXt" +section_tIME="tIME" +section_tRNS="tRNS" +section_zTXt="zTXt" diff --git a/chromium/testing/libfuzzer/fuzzers/dicts/regexp.dict b/chromium/testing/libfuzzer/fuzzers/dicts/regexp.dict new file mode 100644 index 00000000000..963d44b3417 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/dicts/regexp.dict @@ -0,0 +1,221 @@ +# +# AFL dictionary for JS regex +# --------------------------- +# +# Contains various regular expressions. +# +# Created by Yang Guo <yangguo@chromium.org> +# + +"?" +"abc" +"()" +"[]" +"abc|def" +"abc|def|ghi" +"^xxx$" +"ab\\b\\d\\bcd" +"\\w|\\d" +"a*?" +"abc+" +"abc+?" +"xyz?" +"xyz??" +"xyz{0,1}" +"xyz{0,1}?" +"xyz{93}" +"xyz{1,32}" +"xyz{1,32}?" +"xyz{1,}" +"xyz{1,}?" +"a\\fb\\nc\\rd\\te\\vf" +"a\\nb\\bc" +"(?:foo)" +"(?: foo )" +"foo|(bar|baz)|quux" +"foo(?=bar)baz" +"foo(?!bar)baz" +"foo(?<=bar)baz" +"foo(?<!bar)baz" +"()" +"(?=)" +"[]" +"[x]" +"[xyz]" +"[a-zA-Z0-9]" +"[-123]" +"[^123]" +"]" +"}" +"[a-b-c]" +"[x\\dz]" +"[\\d-z]" +"[\\d-\\d]" +"[z-\\d]" +"\\cj\\cJ\\ci\\cI\\ck\\cK" +"\\c!" +"\\c_" +"\\c~" +"[\\c!]" +"[\\c_]" +"[\\c~]" +"[\\ca]" +"[\\cz]" +"[\\cA]" +"[\\cZ]" +"[\\c1]" +"\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ " +"[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]" +"\\8" +"\\9" +"\\11" +"\\11a" +"\\011" +"\\118" +"\\111" +"\\1111" +"(x)(x)(x)\\1" +"(x)(x)(x)\\2" +"(x)(x)(x)\\3" +"(x)(x)(x)\\4" +"(x)(x)(x)\\1*" +"(x)(x)(x)\\3*" +"(x)(x)(x)\\4*" +"(x)(x)(x)(x)(x)(x)(x)(x)(x)(x)\\10" +"(x)(x)(x)(x)(x)(x)(x)(x)(x)(x)\\11" +"(a)\\1" +"(a\\1)" +"(\\1a)" +"(\\2)(\\1)" +"(?=a){0,10}a" +"(?=a){1,10}a" +"(?=a){9,10}a" +"(?!a)?a" +"\\1(a)" +"(?!(a))\\1" +"(?!\\1(a\\1)\\1)\\1" +"\\1\\2(a(?:\\1(b\\1\\2))\\2)\\1" +"[\\0]" +"[\\11]" +"[\\11a]" +"[\\011]" +"[\\00011]" +"[\\118]" +"[\\111]" +"[\\1111]" +"\\x60" +"\\x3z" +"\\c" +"\\u0034" +"\\u003z" +"foo[z]*" +"\\u{12345}" +"\\u{12345}\\u{23456}" +"\\u{12345}{3}" +"\\u{12345}*" +"\\ud808\\udf45*" +"[\\ud808\\udf45-\\ud809\\udccc]" +"a" +"a|b" +"a\\n" +"a$" +"a\\b!" +"a\\Bb" +"a*?" +"a?" +"a??" +"a{0,1}?" +"a{1,2}?" +"a+?" +"(a)" +"(a)\\1" +"(\\1a)" +"\\1(a)" +"a\\s" +"a\\S" +"a\\D" +"a\\w" +"a\\W" +"a." +"a\\q" +"a[a]" +"a[^a]" +"a[a-z]" +"a(?:b)" +"a(?=b)" +"a(?!b)" +"\\x60" +"\\u0060" +"\\cA" +"\\q" +"\\1112" +"(a)\\1" +"(?!a)?a\\1" +"(?:(?=a))a\\1" +"a{}" +"a{,}" +"a{" +"a{z}" +"a{12z}" +"a{12," +"a{12,3b" +"{}" +"{,}" +"{" +"{z}" +"{1z}" +"{12," +"{12,3b" +"a" +"abc" +"a[bc]d" +"a|bc" +"ab|c" +"a||bc" +"(?:ab)" +"(?:ab|cde)" +"(?:ab)|cde" +"(ab)" +"(ab|cde)" +"(ab)\\1" +"(ab|cde)\\1" +"(?:ab)?" +"(?:ab)+" +"a?" +"a+" +"a??" +"a*?" +"a+?" +"(?:a?)?" +"(?:a+)?" +"(?:a?)+" +"(?:a*)+" +"(?:a+)+" +"(?:a?)*" +"(?:a*)*" +"(?:a+)*" +"a{0}" +"(?:a+){0,0}" +"a*b" +"a+b" +"a*b|c" +"a+b|c" +"(?:a{5,1000000}){3,1000000}" +"(?:ab){4,7}" +"a\\bc" +"a\\sc" +"a\\Sc" +"a(?=b)c" +"a(?=bbb|bb)c" +"a(?!bbb|bb)c" +"\xe2\x81\xa3" +"[\xe2\x81\xa3]" +"\xed\xb0\x80" +"\xed\xa0\x80" +"(\xed\xb0\x80)\x01" +"((\xed\xa0\x80))\x02" +"\xf0\x9f\x92\xa9" +"\x01" +"\x0f" +"[-\xf0\x9f\x92\xa9]+" +"[\xf0\x9f\x92\xa9-\xf4\x8f\xbf\xbf]" diff --git a/chromium/testing/libfuzzer/fuzzers/dicts/sql.dict b/chromium/testing/libfuzzer/fuzzers/dicts/sql.dict index 583424730c1..bf522cc45cf 100644 --- a/chromium/testing/libfuzzer/fuzzers/dicts/sql.dict +++ b/chromium/testing/libfuzzer/fuzzers/dicts/sql.dict @@ -159,7 +159,7 @@ keyword_QUERY="QUERY" keyword_RAISE="RAISE" keyword_RECURSIVE="RECURSIVE" keyword_REFERENCES="REFERENCES" -keyword_REGEXP="REGEXP" +#keyword_REGEXP="REGEXP" keyword_REINDEX="REINDEX" keyword_RELEASE="RELEASE" keyword_RENAME="RENAME" diff --git a/chromium/testing/libfuzzer/fuzzers/dicts/v8_wasm.dict b/chromium/testing/libfuzzer/fuzzers/dicts/v8_wasm.dict new file mode 100644 index 00000000000..c381ea53415 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/dicts/v8_wasm.dict @@ -0,0 +1,30 @@ +wasm_magic="\x6d\x73\x61\x00" +"memory" +"\x06memory" +"signatures" +"\x0asignatures" +"functions" +"\x09functions" +"globals" +"\x07globals" +"data_segments" +"\x0ddata_segments" +"function_table" +"\x0efunction_table" +"end" +"\x03end" +"start_function" +"\x0estart_function" +"import_table" +"\x0cimport_table" +"export_table" +"\x0cexport_table" +"function_signatures" +"\x13function_signatures" +"function_bodies" +"\x0ffunction_bodies" +"names" +"\x05names" +"\x00\x00\x00\x00\x00\x00\x00\x00" +"\x02\x00" + diff --git a/chromium/testing/libfuzzer/fuzzers/dicts/xml.dict b/chromium/testing/libfuzzer/fuzzers/dicts/xml.dict new file mode 100644 index 00000000000..ff44a2980e5 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/dicts/xml.dict @@ -0,0 +1,88 @@ +# +# AFL dictionary for XML +# ---------------------- +# +# Several basic syntax elements and attributes, modeled on libxml2. +# +# Created by Michal Zalewski <lcamtuf@google.com> +# + +attr_encoding=" encoding=\"1\"" +attr_generic=" a=\"1\"" +attr_href=" href=\"1\"" +attr_standalone=" standalone=\"no\"" +attr_version=" version=\"1\"" +attr_xml_base=" xml:base=\"1\"" +attr_xml_id=" xml:id=\"1\"" +attr_xml_lang=" xml:lang=\"1\"" +attr_xml_space=" xml:space=\"1\"" +attr_xmlns=" xmlns=\"1\"" + +entity_builtin="<" +entity_decimal="" +entity_external="&a;" +entity_hex="" + +string_any="ANY" +string_brackets="[]" +string_cdata="CDATA" +string_col_fallback=":fallback" +string_col_generic=":a" +string_col_include=":include" +string_dashes="--" +string_empty="EMPTY" +string_empty_dblquotes="\"\"" +string_empty_quotes="''" +string_entities="ENTITIES" +string_entity="ENTITY" +string_fixed="#FIXED" +string_id="ID" +string_idref="IDREF" +string_idrefs="IDREFS" +string_implied="#IMPLIED" +string_nmtoken="NMTOKEN" +string_nmtokens="NMTOKENS" +string_notation="NOTATION" +string_parentheses="()" +string_pcdata="#PCDATA" +string_percent="%a" +string_public="PUBLIC" +string_required="#REQUIRED" +string_schema=":schema" +string_system="SYSTEM" +string_ucs4="UCS-4" +string_utf16="UTF-16" +string_utf8="UTF-8" +string_xmlns="xmlns:" + +tag_attlist="<!ATTLIST" +tag_cdata="<![CDATA[" +tag_close="</a>" +tag_doctype="<!DOCTYPE" +tag_element="<!ELEMENT" +tag_entity="<!ENTITY" +tag_ignore="<![IGNORE[" +tag_include="<![INCLUDE[" +tag_notation="<!NOTATION" +tag_open="<a>" +tag_open_close="<a />" +tag_open_exclamation="<!" +tag_open_q="<?" +tag_sq2_close="]]>" +tag_xml_q="<?xml?>" +"http://docboo" +"http://www.w" +"UTF-16LE" +"xmlns" +"he30" +"he2" +"IET" +"FDF-10" +"aDUCS-4OPveb:" +"a>" +"UT" +"xMl" +"/usr/share/sg" +"ha07" +"http://www.oa" +"cle" diff --git a/chromium/testing/libfuzzer/fuzzers/dns_record_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/dns_record_fuzzer.cc deleted file mode 100644 index ebfcbaf079e..00000000000 --- a/chromium/testing/libfuzzer/fuzzers/dns_record_fuzzer.cc +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2015 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. - -#include <string> - -#include "net/dns/dns_response.h" - -// Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { - std::string out; - net::DnsRecordParser parser(data, size, 0); - if (!parser.IsValid()) { - return 0; - } - net::DnsResourceRecord record; - while (parser.ReadRecord(&record)) { - } - return 0; -} diff --git a/chromium/testing/libfuzzer/fuzzers/empty_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/empty_fuzzer.cc index a5cd30c46ea..fb38e8023a0 100644 --- a/chromium/testing/libfuzzer/fuzzers/empty_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/empty_fuzzer.cc @@ -1,13 +1,14 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. // Empty fuzzer that doesn't do anything. Used as test and documentation. #include <stddef.h> +#include <stdint.h> // Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { // Run your code on data. return 0; } diff --git a/chromium/testing/libfuzzer/fuzzers/es_parser_adts_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/es_parser_adts_fuzzer.cc index bbb4f5703b0..b3da4076195 100644 --- a/chromium/testing/libfuzzer/fuzzers/es_parser_adts_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/es_parser_adts_fuzzer.cc @@ -1,7 +1,10 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> +#include <stdint.h> + #include "base/bind.h" #include "media/formats/mp2t/es_parser_adts.h" @@ -9,7 +12,7 @@ static void NewAudioConfig(const media::AudioDecoderConfig& config) {} static void EmitBuffer(scoped_refptr<media::StreamParserBuffer> buffer) {} // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { media::mp2t::EsParserAdts es_parser(base::Bind(&NewAudioConfig), base::Bind(&EmitBuffer), true); if (!es_parser.Parse(data, size, media::kNoTimestamp(), diff --git a/chromium/testing/libfuzzer/fuzzers/es_parser_h264_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/es_parser_h264_fuzzer.cc index ddadf5fcc9d..952d719f6fe 100644 --- a/chromium/testing/libfuzzer/fuzzers/es_parser_h264_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/es_parser_h264_fuzzer.cc @@ -1,7 +1,10 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> +#include <stdint.h> + #include "base/bind.h" #include "media/formats/mp2t/es_parser_h264.h" @@ -9,7 +12,7 @@ static void NewVideoConfig(const media::VideoDecoderConfig& config) {} static void EmitBuffer(scoped_refptr<media::StreamParserBuffer> buffer) {} // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { media::mp2t::EsParserH264 es_parser(base::Bind(&NewVideoConfig), base::Bind(&EmitBuffer)); if (!es_parser.Parse(data, size, media::kNoTimestamp(), diff --git a/chromium/testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.cc index f8eaefdbb0b..bcb45afe709 100644 --- a/chromium/testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.cc @@ -1,7 +1,12 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> +#include <stdint.h> + +#include <memory> + #include "base/bind.h" #include "media/formats/mp2t/es_parser_mpeg1audio.h" @@ -10,7 +15,7 @@ class NullMediaLog : public media::MediaLog { NullMediaLog() {} void DoAddEventLogString(const std::string& event) {} - void AddEvent(scoped_ptr<media::MediaLogEvent> event) override {} + void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override {} protected: virtual ~NullMediaLog() {} @@ -23,7 +28,7 @@ static void NewAudioConfig(const media::AudioDecoderConfig& config) {} static void EmitBuffer(scoped_refptr<media::StreamParserBuffer> buffer) {} // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { scoped_refptr<NullMediaLog> media_log(new NullMediaLog()); media::mp2t::EsParserMpeg1Audio es_parser(base::Bind(&NewAudioConfig), base::Bind(&EmitBuffer), media_log); diff --git a/chromium/testing/libfuzzer/fuzzers/ftp_ctrl_response_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/ftp_ctrl_response_fuzzer.cc deleted file mode 100644 index 3cee91ef6fa..00000000000 --- a/chromium/testing/libfuzzer/fuzzers/ftp_ctrl_response_fuzzer.cc +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2015 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. - -#include "net/ftp/ftp_ctrl_response_buffer.h" -#include "net/log/net_log.h" - -// Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { - const net::BoundNetLog log; - net::FtpCtrlResponseBuffer buffer(log); - if (!buffer.ConsumeData(reinterpret_cast<const char*>(data), size)) { - return 0; - } - while (buffer.ResponseAvailable()) { - (void)buffer.PopResponse(); - } - return 0; -} diff --git a/chromium/testing/libfuzzer/fuzzers/ftp_directory_listing_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/ftp_directory_listing_fuzzer.cc deleted file mode 100644 index f222e076abf..00000000000 --- a/chromium/testing/libfuzzer/fuzzers/ftp_directory_listing_fuzzer.cc +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2015 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. - -#include <string> -#include <vector> - -#include "base/at_exit.h" -#include "base/i18n/icu_util.h" -#include "base/time/time.h" -#include "net/ftp/ftp_directory_listing_parser.h" - -struct TestCase { - TestCase() { - CHECK(base::i18n::InitializeICU()); - } - - // used by ICU integration. - base::AtExitManager at_exit_manager; -}; - -TestCase* test_case = new TestCase(); - - -// Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { - std::string buffer(reinterpret_cast<const char*>(data), size); - std::vector<net::FtpDirectoryListingEntry> entries; - net::ParseFtpDirectoryListing(buffer, base::Time::Now(), &entries); - return 0; -} diff --git a/chromium/testing/libfuzzer/fuzzers/gfx_png_image_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/gfx_png_image_fuzzer.cc index a74a181ef83..ab1e9e674bd 100644 --- a/chromium/testing/libfuzzer/fuzzers/gfx_png_image_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/gfx_png_image_fuzzer.cc @@ -1,15 +1,32 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. -#include <string> +#include <stddef.h> +#include <stdint.h> +#include "base/logging.h" #include "ui/gfx/image/image.h" + +struct Environment { + Environment() { + // Disable noisy logging. + logging::SetMinLogLevel(logging::LOG_FATAL); + } +}; + +Environment* env = new Environment(); + + // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, - unsigned long size) { - gfx::Image::CreateFrom1xPNGBytes(data, size); +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + gfx::Image image = gfx::Image::CreateFrom1xPNGBytes(data, size); + + if (image.IsEmpty()) + return 0; + + image.ToSkBitmap(); + return 0; } - diff --git a/chromium/testing/libfuzzer/fuzzers/http_chunked_decoder_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/http_chunked_decoder_fuzzer.cc deleted file mode 100644 index 896cda8a3e0..00000000000 --- a/chromium/testing/libfuzzer/fuzzers/http_chunked_decoder_fuzzer.cc +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2015 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. - -#include <vector> - -#include "net/http/http_chunked_decoder.h" - -// Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { - const char* data_ptr = reinterpret_cast<const char*>(data); - std::vector<char> buffer(data_ptr, data_ptr + size); - net::HttpChunkedDecoder decoder; - decoder.FilterBuf(buffer.data(), buffer.size()); - - return 0; -} diff --git a/chromium/testing/libfuzzer/fuzzers/icu_uregex_open_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/icu_uregex_open_fuzzer.cc new file mode 100644 index 00000000000..96c88c58cff --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/icu_uregex_open_fuzzer.cc @@ -0,0 +1,21 @@ +// 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. + +#include <stddef.h> +#include <stdint.h> + +#include "third_party/icu/source/i18n/unicode/regex.h" + +// Entry point for LibFuzzer. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + UParseError pe = { 0 }; + UErrorCode status = U_ZERO_ERROR; + URegularExpression* re = uregex_open(reinterpret_cast<const UChar*>(data), + static_cast<int>(size) / sizeof(UChar), + 0, &pe, &status); + if (re) + uregex_close(re); + + return 0; +} diff --git a/chromium/testing/libfuzzer/fuzzers/icu_uregex_open_fuzzer.options b/chromium/testing/libfuzzer/fuzzers/icu_uregex_open_fuzzer.options new file mode 100644 index 00000000000..cc373e1979f --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/icu_uregex_open_fuzzer.options @@ -0,0 +1,2 @@ +[libfuzzer] +max_len = random(8, 128) diff --git a/chromium/testing/libfuzzer/fuzzers/language_detection_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/language_detection_fuzzer.cc index 27da15a747b..1545f76aff9 100644 --- a/chromium/testing/libfuzzer/fuzzers/language_detection_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/language_detection_fuzzer.cc @@ -1,8 +1,10 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> #include <stdint.h> + #include <string> #include "base/strings/string16.h" @@ -10,14 +12,14 @@ #include "components/translate/core/language_detection/language_detection_util.h" // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size == 0) { return 0; } uint8_t ch = data[0]; int lang_len = ch & 0xF; int html_lang_len = (ch >> 4) & 0xF; - int text_len = size - lang_len - html_lang_len; + int text_len = static_cast<int>(size) - lang_len - html_lang_len; if ((text_len < 0) || (text_len % 2 != 0)) { return 0; } diff --git a/chromium/testing/libfuzzer/fuzzers/libexif_parser_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/libexif_parser_fuzzer.cc deleted file mode 100644 index 1239767a49b..00000000000 --- a/chromium/testing/libfuzzer/fuzzers/libexif_parser_fuzzer.cc +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015 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. - -#include <stdlib.h> - -#include "libexif/exif-data.h" -#include "libexif/exif-system.h" - -extern "C" int LLVMFuzzerTestOneInput(unsigned char* data, size_t size) { - ExifData* exif_data = exif_data_new_from_data(data, size); - exif_data_unref(exif_data); - return 0; -} diff --git a/chromium/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc index 83c24628858..15a23c0444b 100644 --- a/chromium/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc @@ -2,14 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> +#include <stdint.h> + #include <vector> #include "base/bind.h" #include "base/callback_helpers.h" +#define PNG_INTERNAL #include "third_party/libpng/png.h" struct BufState { - const unsigned char *data; + const uint8_t* data; size_t bytes_left; }; @@ -27,13 +31,13 @@ static const int kPngHeaderSize = 8; // Entry point for LibFuzzer. // Roughly follows the libpng book example: // http://www.libpng.org/pub/png/book/chapter13.html -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size < kPngHeaderSize) { return 0; } std::vector<unsigned char> v(data, data + size); - if (!png_sig_cmp(v.data(), 0, kPngHeaderSize)) { + if (png_sig_cmp(v.data(), 0, kPngHeaderSize)) { // not a PNG. return 0; } @@ -42,17 +46,18 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { (PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); assert(png_ptr); + png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; + png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_IGNORE; + + png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; + png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_NOWARN; + png_infop info_ptr = png_create_info_struct(png_ptr); assert(info_ptr); base::ScopedClosureRunner struct_deleter(base::Bind( &png_destroy_read_struct, &png_ptr, &info_ptr, nullptr)); - if (setjmp(png_ptr->jmpbuf)) { - // error handling for libpng - return 0; - } - // Setting up reading from buffer. std::unique_ptr<BufState> buf_state(new BufState()); buf_state->data = data + kPngHeaderSize; @@ -60,12 +65,22 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { png_set_read_fn(png_ptr, buf_state.get(), user_read_data); png_set_sig_bytes(png_ptr, kPngHeaderSize); - // Reading + // libpng error handling. + if (setjmp(png_ptr->jmpbuf)) { + return 0; + } + + // Reading. png_read_info(png_ptr, info_ptr); png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); base::ScopedClosureRunner png_deleter(base::Bind( &png_free, png_ptr, row)); + // reset error handler to put png_deleter into scope. + if (setjmp(png_ptr->jmpbuf)) { + return 0; + } + png_uint_32 width, height; int bit_depth, color_type, interlace_type, compression_type; int filter_type; @@ -76,6 +91,10 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { return 0; } + // This is going to be too slow. + if (width && height > 100000000 / width) + return 0; + int passes = png_set_interlace_handling(png_ptr); png_start_read_image(png_ptr); diff --git a/chromium/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc index 392a9e3a2bc..464a6e95df8 100644 --- a/chromium/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc @@ -1,18 +1,21 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> +#include <stdint.h> + #include "libxml/parser.h" -void ignore (void * ctx, const char * msg, ...) { +void ignore (void* ctx, const char* msg, ...) { // Error handler to avoid spam of error messages from libxml parser. } -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { xmlSetGenericErrorFunc(NULL, &ignore); - if (auto doc = xmlReadMemory(reinterpret_cast<const char *>(data), - size, "noname.xml", NULL, 0)) { + if (auto doc = xmlReadMemory(reinterpret_cast<const char*>(data), + static_cast<int>(size), "noname.xml", NULL, 0)) { xmlFreeDoc(doc); } diff --git a/chromium/testing/libfuzzer/fuzzers/libxml_xml_regexp_compile_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/libxml_xml_regexp_compile_fuzzer.cc new file mode 100644 index 00000000000..65aba2962c5 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/libxml_xml_regexp_compile_fuzzer.cc @@ -0,0 +1,34 @@ +// 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. + +#include <stddef.h> +#include <stdint.h> + +#include <algorithm> +#include <string> +#include <vector> + +#include "libxml/parser.h" +#include "libxml/tree.h" +#include "libxml/xmlversion.h" + + +void ignore (void * ctx, const char * msg, ...) { + // Error handler to avoid spam of error messages from libxml parser. +} + + +// Entry point for LibFuzzer. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + xmlSetGenericErrorFunc(NULL, &ignore); + + std::vector<uint8_t> buffer(size + 1, 0); + std::copy(data, data + size, buffer.data()); + + xmlRegexpPtr x = xmlRegexpCompile(buffer.data()); + if (x) + xmlRegFreeRegexp(x); + + return 0; +} diff --git a/chromium/testing/libfuzzer/fuzzers/libxml_xml_regexp_compile_fuzzer.options b/chromium/testing/libfuzzer/fuzzers/libxml_xml_regexp_compile_fuzzer.options new file mode 100644 index 00000000000..76499d953fb --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/libxml_xml_regexp_compile_fuzzer.options @@ -0,0 +1,2 @@ +[libfuzzer] +max_len = random(4, 32) diff --git a/chromium/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.cc index 3e64259d282..6e5c6bd58a1 100644 --- a/chromium/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.cc @@ -1,10 +1,14 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> +#include <stdint.h> + +#include <memory> + #include "media/formats/mp4/box_reader.h" #include "base/logging.h" -#include "base/memory/scoped_ptr.h" class NullMediaLog : public media::MediaLog { public: @@ -12,7 +16,7 @@ class NullMediaLog : public media::MediaLog { void DoAddEventLogString(const std::string& event) {} - void AddEvent(scoped_ptr<media::MediaLogEvent> event) override {} + void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override {} protected: virtual ~NullMediaLog() {} @@ -22,11 +26,12 @@ class NullMediaLog : public media::MediaLog { }; // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { bool err; scoped_refptr<NullMediaLog> media_log(new NullMediaLog()); - scoped_ptr<media::mp4::BoxReader> reader( - media::mp4::BoxReader::ReadTopLevelBox(data, size, media_log, &err)); + std::unique_ptr<media::mp4::BoxReader> reader( + media::mp4::BoxReader::ReadTopLevelBox(data, static_cast<const int>(size), + media_log, &err)); if (err) { return 0; } diff --git a/chromium/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.options b/chromium/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.options new file mode 100644 index 00000000000..a0ef8e64c58 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.options @@ -0,0 +1,2 @@ +[libfuzzer] +max_len=500 diff --git a/chromium/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc deleted file mode 100644 index 1ccd4f17da6..00000000000 --- a/chromium/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) 2015 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. - -// This fuzzer is simplified & cleaned up pdfium/samples/pdfium_test.cc - -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <list> -#include <sstream> -#include <string> -#include <utility> -#include <vector> - -#include "third_party/pdfium/public/fpdf_dataavail.h" -#include "third_party/pdfium/public/fpdf_ext.h" -#include "third_party/pdfium/public/fpdf_formfill.h" -#include "third_party/pdfium/public/fpdf_text.h" -#include "third_party/pdfium/public/fpdfview.h" -#include "third_party/pdfium/testing/test_support.h" - -#include "v8/include/v8.h" - -static int ExampleAppAlert(IPDF_JSPLATFORM*, FPDF_WIDESTRING, FPDF_WIDESTRING, - int, int) { - return 0; -} - -static void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) { } - -static void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) { } - - -FPDF_BOOL Is_Data_Avail(FX_FILEAVAIL* pThis, size_t offset, size_t size) { - return true; -} - -static void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) { } - -static bool RenderPage(const FPDF_DOCUMENT& doc, - const FPDF_FORMHANDLE& form, - const int page_index) { - FPDF_PAGE page = FPDF_LoadPage(doc, page_index); - if (!page) { - return false; - } - FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page); - FORM_OnAfterLoadPage(page, form); - FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN); - - double scale = 1.0; - int width = static_cast<int>(FPDF_GetPageWidth(page) * scale); - int height = static_cast<int>(FPDF_GetPageHeight(page) * scale); - - FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0); - if (!bitmap) { - return false; - } - - FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF); - FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); - - FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0); - - FPDFBitmap_Destroy(bitmap); - FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_CLOSE); - FORM_OnBeforeClosePage(page, form); - FPDFText_ClosePage(text_page); - FPDF_ClosePage(page); - return true; -} - -static void RenderPdf(const char* pBuf, size_t len) { - IPDF_JSPLATFORM platform_callbacks; - memset(&platform_callbacks, '\0', sizeof(platform_callbacks)); - platform_callbacks.version = 3; - platform_callbacks.app_alert = ExampleAppAlert; - platform_callbacks.Doc_gotoPage = ExampleDocGotoPage; - - FPDF_FORMFILLINFO form_callbacks; - memset(&form_callbacks, '\0', sizeof(form_callbacks)); - form_callbacks.version = 1; - form_callbacks.m_pJsPlatform = &platform_callbacks; - - TestLoader loader(pBuf, len); - FPDF_FILEACCESS file_access; - memset(&file_access, '\0', sizeof(file_access)); - file_access.m_FileLen = static_cast<unsigned long>(len); - file_access.m_GetBlock = TestLoader::GetBlock; - file_access.m_Param = &loader; - - FX_FILEAVAIL file_avail; - memset(&file_avail, '\0', sizeof(file_avail)); - file_avail.version = 1; - file_avail.IsDataAvail = Is_Data_Avail; - - FX_DOWNLOADHINTS hints; - memset(&hints, '\0', sizeof(hints)); - hints.version = 1; - hints.AddSegment = Add_Segment; - - FPDF_DOCUMENT doc; - int nRet = PDF_DATA_NOTAVAIL; - bool bIsLinearized = false; - FPDF_AVAIL pdf_avail = FPDFAvail_Create(&file_avail, &file_access); - - if (FPDFAvail_IsLinearized(pdf_avail) == PDF_LINEARIZED) { - doc = FPDFAvail_GetDocument(pdf_avail, nullptr); - if (doc) { - while (nRet == PDF_DATA_NOTAVAIL) { - nRet = FPDFAvail_IsDocAvail(pdf_avail, &hints); - } - if (nRet == PDF_DATA_ERROR) { - return; - } - nRet = FPDFAvail_IsFormAvail(pdf_avail, &hints); - if (nRet == PDF_FORM_ERROR || nRet == PDF_FORM_NOTAVAIL) { - return; - } - bIsLinearized = true; - } - } else { - doc = FPDF_LoadCustomDocument(&file_access, nullptr); - } - - if (!doc) { - FPDFAvail_Destroy(pdf_avail); - return; - } - - (void)FPDF_GetDocPermissions(doc); - - FPDF_FORMHANDLE form = FPDFDOC_InitFormFillEnvironment(doc, &form_callbacks); - FPDF_SetFormFieldHighlightColor(form, 0, 0xFFE4DD); - FPDF_SetFormFieldHighlightAlpha(form, 100); - - FORM_DoDocumentJSAction(form); - FORM_DoDocumentOpenAction(form); - - int page_count = FPDF_GetPageCount(doc); - - for (int i = 0; i < page_count; ++i) { - if (bIsLinearized) { - nRet = PDF_DATA_NOTAVAIL; - while (nRet == PDF_DATA_NOTAVAIL) { - nRet = FPDFAvail_IsPageAvail(pdf_avail, i, &hints); - } - if (nRet == PDF_DATA_ERROR) { - return; - } - } - RenderPage(doc, form, i); - } - - FORM_DoDocumentAAction(form, FPDFDOC_AACTION_WC); - FPDFDOC_ExitFormFillEnvironment(form); - FPDF_CloseDocument(doc); - FPDFAvail_Destroy(pdf_avail); -} - -std::string ProgramPath() { - char *path = new char[PATH_MAX + 1]; - assert(path); - ssize_t sz = readlink("/proc/self/exe", path, PATH_MAX); - assert(sz > 0); - std::string result(path, sz); - delete[] path; - return result; -} - -struct TestCase { - TestCase() { - InitializeV8ForPDFium(ProgramPath(), "", &natives_blob, &snapshot_blob, - &platform); - - memset(&config, '\0', sizeof(config)); - config.version = 2; - config.m_pUserFontPaths = nullptr; - config.m_pIsolate = nullptr; - config.m_v8EmbedderSlot = 0; - FPDF_InitLibraryWithConfig(&config); - - memset(&unsupport_info, '\0', sizeof(unsupport_info)); - unsupport_info.version = 1; - unsupport_info.FSDK_UnSupport_Handler = ExampleUnsupportedHandler; - FSDK_SetUnSpObjProcessHandler(&unsupport_info); - } - - v8::Platform* platform; - v8::StartupData natives_blob; - v8::StartupData snapshot_blob; - FPDF_LIBRARY_CONFIG config; - UNSUPPORT_INFO unsupport_info; -}; - -static TestCase* testCase = new TestCase(); - -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { - RenderPdf(reinterpret_cast<const char*>(data), size); - return 0; -} diff --git a/chromium/testing/libfuzzer/fuzzers/quic_crypto_framer_parse_message_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/quic_crypto_framer_parse_message_fuzzer.cc deleted file mode 100644 index ffe831650f8..00000000000 --- a/chromium/testing/libfuzzer/fuzzers/quic_crypto_framer_parse_message_fuzzer.cc +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2015 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. - -#include "base/strings/string_piece.h" -#include "net/quic/crypto/crypto_framer.h" - -// Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { - base::StringPiece crypto_input(reinterpret_cast<const char *>(data), size); - std::unique_ptr<net::CryptoHandshakeMessage> handshake_message( - net::CryptoFramer::ParseMessage(crypto_input)); - - return 0; -} diff --git a/chromium/testing/libfuzzer/fuzzers/re2_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/re2_fuzzer.cc new file mode 100644 index 00000000000..353aa7ef330 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/re2_fuzzer.cc @@ -0,0 +1,88 @@ +// Copyright (c) 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. + +#include <stddef.h> +#include <stdint.h> + +#include <string> + +#include "re2/re2.h" +#include "util/logging.h" + +using std::string; + +void Test(const string& buffer, const string& pattern, + const RE2::Options& options) { + RE2 re(pattern, options); + if (!re.ok()) + return; + + string m1, m2; + int i1, i2; + double d1; + + if (re.NumberOfCapturingGroups() == 0) { + RE2::FullMatch(buffer, re); + RE2::PartialMatch(buffer, re); + } else if (re.NumberOfCapturingGroups() == 1) { + RE2::FullMatch(buffer, re, &m1); + RE2::PartialMatch(buffer, re, &i1); + } else if (re.NumberOfCapturingGroups() == 2) { + RE2::FullMatch(buffer, re, &i1, &i2); + RE2::PartialMatch(buffer, re, &m1, &m2); + } + + re2::StringPiece input(buffer); + RE2::Consume(&input, re, &m1); + RE2::FindAndConsume(&input, re, &d1); + string tmp1(buffer); + RE2::Replace(&tmp1, re, "zz"); + string tmp2(buffer); + RE2::GlobalReplace(&tmp2, re, "xx"); + RE2::QuoteMeta(re2::StringPiece(pattern)); +} + +// Entry point for LibFuzzer. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + if (size < 1) + return 0; + + re2::FLAGS_minloglevel = 3; + RE2::Options options; + + size_t options_randomizer = 0; + for (size_t i = 0; i < size; i++) + options_randomizer += data[i]; + + if (options_randomizer & 1) + options.set_encoding(RE2::Options::EncodingLatin1); + + options.set_posix_syntax(options_randomizer & 2); + options.set_longest_match(options_randomizer & 4); + options.set_literal(options_randomizer & 8); + options.set_never_nl(options_randomizer & 16); + options.set_dot_nl(options_randomizer & 32); + options.set_never_capture(options_randomizer & 64); + options.set_case_sensitive(options_randomizer & 128); + options.set_perl_classes(options_randomizer & 256); + options.set_word_boundary(options_randomizer & 512); + options.set_one_line(options_randomizer & 1024); + + options.set_log_errors(false); + + const char* data_input = reinterpret_cast<const char*>(data); + { + string pattern(data_input, size); + string buffer(data_input, size); + Test(buffer, pattern, options); + } + + if (size >= 3) { + string pattern(data_input, size / 3); + string buffer(data_input + size / 3, size - size / 3); + Test(buffer, pattern, options); + } + + return 0; +} diff --git a/chromium/testing/libfuzzer/fuzzers/re2_fuzzer.options b/chromium/testing/libfuzzer/fuzzers/re2_fuzzer.options new file mode 100644 index 00000000000..dbe9bb432e0 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/re2_fuzzer.options @@ -0,0 +1,3 @@ +[libfuzzer] +# re2_fuzzer is very slow and almost useless for long inputs. +max_len = random(4, 32) diff --git a/chromium/testing/libfuzzer/fuzzers/snappy_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/snappy_fuzzer.cc index 56d1b52c2bf..3bb9b55d876 100644 --- a/chromium/testing/libfuzzer/fuzzers/snappy_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/snappy_fuzzer.cc @@ -1,14 +1,15 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> #include <stdint.h> #include "third_party/snappy/src/snappy-sinksource.h" #include "third_party/snappy/src/snappy.h" // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { snappy::ByteArraySource src(reinterpret_cast<const char*>(data), size); uint32_t len; // Note: src is invalid after GetUncompressedLength call. diff --git a/chromium/testing/libfuzzer/fuzzers/sqlite3_prepare_v2_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/sqlite3_prepare_v2_fuzzer.cc index fda2f84551a..b63e30b8a23 100644 --- a/chromium/testing/libfuzzer/fuzzers/sqlite3_prepare_v2_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/sqlite3_prepare_v2_fuzzer.cc @@ -1,20 +1,46 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. #include <stddef.h> +#include <stdint.h> + +#include <algorithm> +#include <array> +#include <string> +#include <vector> #include "third_party/sqlite/sqlite3.h" + +static const std::array<uint8_t, 6> kBadKeyword{{'R', 'E', 'G', 'E', 'X', 'P'}}; + + +bool checkForBadKeyword(const uint8_t* data, size_t size) { + auto it = std::search( + data, data + size, kBadKeyword.begin(), kBadKeyword.end(), + [](char c1, char c2) { return std::toupper(c1) == std::toupper(c2); }); + + if (it != data + size) + return true; + + return false; +} + + static int Progress(void *not_used_ptr) { return 1; } + // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size < 2) return 0; + if (checkForBadKeyword(data, size)) + return 0; + sqlite3* db; if (SQLITE_OK != sqlite3_open(":memory:", &db)) return 0; @@ -32,8 +58,8 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { selector <<= 1; sqlite3_stmt* statement = NULL; - int result = sqlite3_prepare_v2(db, (const char*)(data + 1), size - 1, - &statement, NULL); + int result = sqlite3_prepare_v2(db, reinterpret_cast<const char*>(data + 1), + static_cast<int>(size - 1), &statement, NULL); if (result == SQLITE_OK) { // Use selector value to randomize number of iterations. for (int i = 0; i < selector; i++) { diff --git a/chromium/testing/libfuzzer/fuzzers/string_to_int_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/string_to_int_fuzzer.cc index 03ce0959b89..ca42f678528 100644 --- a/chromium/testing/libfuzzer/fuzzers/string_to_int_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/string_to_int_fuzzer.cc @@ -1,7 +1,8 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> #include <stdint.h> #include <string> @@ -10,7 +11,7 @@ #include "base/strings/string_number_conversions.h" // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { std::string input(reinterpret_cast<const char*>(data), size); int out_int; base::StringToInt(input, &out_int); diff --git a/chromium/testing/libfuzzer/fuzzers/string_tokenizer_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/string_tokenizer_fuzzer.cc index 3aa6a09cf33..7d033b1aefb 100644 --- a/chromium/testing/libfuzzer/fuzzers/string_tokenizer_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/string_tokenizer_fuzzer.cc @@ -1,13 +1,16 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> +#include <stdint.h> + #include <string> #include "base/strings/string_tokenizer.h" // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size < 1) { return 0; } diff --git a/chromium/testing/libfuzzer/fuzzers/unescape_url_component_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/unescape_url_component_fuzzer.cc deleted file mode 100644 index fd3cc19bb4a..00000000000 --- a/chromium/testing/libfuzzer/fuzzers/unescape_url_component_fuzzer.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2015 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. - -#include <string> - -#include "net/base/escape.h" - - -static const int kMaxUnescapeRule = 31; - - -// Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { - std::string path(reinterpret_cast<const char*>(data), size); - for (int i = 0; i <= kMaxUnescapeRule; i++) { - (void)net::UnescapeURLComponent(path, - static_cast<net::UnescapeRule::Type>(i)); - } - return 0; -} diff --git a/chromium/testing/libfuzzer/fuzzers/unicode_string_codepage_create_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/unicode_string_codepage_create_fuzzer.cc index 08806f2bf82..9a0e49a71cd 100644 --- a/chromium/testing/libfuzzer/fuzzers/unicode_string_codepage_create_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/unicode_string_codepage_create_fuzzer.cc @@ -1,7 +1,10 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> +#include <stdint.h> + #include <algorithm> #include <array> #include <vector> @@ -60,7 +63,7 @@ static const std::array<const char*, 45> kConverters = { }; // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size < 2) return 0; @@ -91,7 +94,9 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { codepage = const_cast<char*>(kConverters[index]); } - icu::UnicodeString unicode_string(buffer.data(), size, codepage); + icu::UnicodeString unicode_string(buffer.data(), + static_cast<int>(size), + codepage); return 0; } diff --git a/chromium/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc index d9c7c1bcfb6..e2e814da6e1 100644 --- a/chromium/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc @@ -1,7 +1,10 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> +#include <stdint.h> + #include "base/at_exit.h" #include "base/i18n/icu_util.h" #include "url/gurl.h" @@ -18,7 +21,7 @@ struct TestCase { TestCase* test_case = new TestCase(); // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { GURL url(std::string(reinterpret_cast<const char*>(data), size)); return 0; } diff --git a/chromium/testing/libfuzzer/fuzzers/v8_regexp_parser_fuzzer.options b/chromium/testing/libfuzzer/fuzzers/v8_regexp_parser_fuzzer.options new file mode 100644 index 00000000000..edfc5aa253a --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/v8_regexp_parser_fuzzer.options @@ -0,0 +1,2 @@ +[libfuzzer] +max_len = random(1, 1024) diff --git a/chromium/testing/libfuzzer/fuzzers/v8_wasm_fuzzer.options b/chromium/testing/libfuzzer/fuzzers/v8_wasm_fuzzer.options new file mode 100644 index 00000000000..790e88daea2 --- /dev/null +++ b/chromium/testing/libfuzzer/fuzzers/v8_wasm_fuzzer.options @@ -0,0 +1,2 @@ +[libfuzzer] +max_len = 500 diff --git a/chromium/testing/libfuzzer/fuzzers/vp9_parser_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/vp9_parser_fuzzer.cc index 258b9b4618d..90b379e6d17 100644 --- a/chromium/testing/libfuzzer/fuzzers/vp9_parser_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/vp9_parser_fuzzer.cc @@ -1,13 +1,16 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> +#include <stdint.h> + #include "media/filters/vp9_parser.h" // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { media::Vp9Parser parser; - parser.SetStream(data, size); + parser.SetStream(data, static_cast<off_t>(size)); while (true) { media::Vp9FrameHeader fhdr; if (media::Vp9Parser::kOk != parser.ParseNextFrame(&fhdr)) { diff --git a/chromium/testing/libfuzzer/fuzzers/websocket_frame_parser_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/websocket_frame_parser_fuzzer.cc deleted file mode 100644 index f1d710c768e..00000000000 --- a/chromium/testing/libfuzzer/fuzzers/websocket_frame_parser_fuzzer.cc +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2015 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. - -#include <vector> - -#include "net/websockets/websocket_frame_parser.h" - -// Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { - net::WebSocketFrameParser parser; - std::vector<scoped_ptr<net::WebSocketFrameChunk>> frame_chunks; - parser.Decode(reinterpret_cast<const char*>(data), size, &frame_chunks); - - return 0; -} diff --git a/chromium/testing/libfuzzer/fuzzers/zlib_uncompress_fuzzer.cc b/chromium/testing/libfuzzer/fuzzers/zlib_uncompress_fuzzer.cc index 952fe24771b..39f984e328f 100644 --- a/chromium/testing/libfuzzer/fuzzers/zlib_uncompress_fuzzer.cc +++ b/chromium/testing/libfuzzer/fuzzers/zlib_uncompress_fuzzer.cc @@ -1,18 +1,21 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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. +#include <stddef.h> #include <stdint.h> +#include <string.h> #include "third_party/zlib/zlib.h" +static Bytef buffer[256 * 1024] = { 0 }; + // Entry point for LibFuzzer. -extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { - uint8_t buffer[1024 * 1024] = { 0 }; - size_t buffer_length = sizeof(buffer); - if (Z_OK != uncompress(buffer, &buffer_length, data, size)) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + uLongf buffer_length = static_cast<uLongf>(sizeof(buffer)); + if (Z_OK != uncompress(buffer, &buffer_length, data, + static_cast<uLong>(size))) { return 0; } - return 0; } diff --git a/chromium/testing/libfuzzer/gen_fuzzer_config.py b/chromium/testing/libfuzzer/gen_fuzzer_config.py new file mode 100755 index 00000000000..5628a30f7b5 --- /dev/null +++ b/chromium/testing/libfuzzer/gen_fuzzer_config.py @@ -0,0 +1,47 @@ +#!/usr/bin/python2 +# +# Copyright (c) 2015 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. + +"""Generate or update an existing config (.options file) for libfuzzer test. + +Invoked by GN from fuzzer_test.gni. +""" + +import argparse +import os +import sys + + +OPTIONS_FILE_TEMPLATE = '''# This is automatically generated fuzzer config. +[libfuzzer] +dict = %(dict)s +''' + +def main(): + parser = argparse.ArgumentParser(description="Generate fuzzer config.") + parser.add_argument('--config', required=True) + parser.add_argument('--dict', required=True) + parser.add_argument('--libfuzzer_options', required=False) + args = parser.parse_args() + + config_path = args.config + # Dict will be copied into build directory, use only its basename for config. + dict_name = os.path.basename(args.dict) + + if not args.libfuzzer_options: + # Generate .options file with initialized 'dict' option. + with open(config_path, 'w') as options_file: + options_file.write(OPTIONS_FILE_TEMPLATE % {'dict': dict_name}) + return + + # Append 'dict' option to an existing .options file. + initial_config = open(args.libfuzzer_options).read() + with open(config_path, 'w') as options_file: + options_file.write(initial_config) + options_file.write('\ndict = %s\n' % dict_name) + + +if __name__ == '__main__': + main() diff --git a/chromium/testing/libfuzzer/gen_fuzzer_runner.py b/chromium/testing/libfuzzer/gen_fuzzer_runner.py deleted file mode 100755 index 516bd648506..00000000000 --- a/chromium/testing/libfuzzer/gen_fuzzer_runner.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/python -# -# Copyright (c) 2015 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. - -"""Generate .sh runner for libfuzzer test. - -Invoked by GN from fuzzer_test.gni. -""" - -import argparse -import os -import sys - - -parser = argparse.ArgumentParser(description="Generate fuzzer launcher.") -parser.add_argument('--fuzzer', required=True) -parser.add_argument('--launcher', required=True) -parser.add_argument('--dict', required=True) -args = parser.parse_args() - -out = open(args.launcher, 'w') -out.write("""#!/bin/bash -set -ue -DIR=$(dirname $0) -$DIR/%(fuzzer)s -dict=$DIR/%(dict)s $* -""" % { "fuzzer": args.fuzzer, "dict": args.dict }) -out.close() - -os.chmod(args.launcher, os.stat(args.launcher).st_mode | 0o111) # chmod a+x diff --git a/chromium/testing/libfuzzer/getting_started.md b/chromium/testing/libfuzzer/getting_started.md new file mode 100644 index 00000000000..62863dc1451 --- /dev/null +++ b/chromium/testing/libfuzzer/getting_started.md @@ -0,0 +1,120 @@ +# Getting Started with libFuzzer in Chrome + +*** note +**Prerequisites:** libFuzzer in Chrome is supported with GN on Linux only. +*** + +This document will walk you through: + +* setting up your build enviroment. +* creating your first fuzzer. +* running the fuzzer and verifying its vitals. + +## Check Out ToT Clang + +libFuzzer relies heavily on compile-time instrumentation. Because it is still +under heavy development you need to use tot clang with libFuzzer ([crbug/598448]): + +```bash +# In chrome/src +LLVM_FORCE_HEAD_REVISION=1 ./tools/clang/scripts/update.py --force-local-build --without-android +``` + +To revert this run the same script without specifying `LLVM_FORCE_HEAD_REVISION`. + +## Configure Build + +Use `use_libfuzzer` GN argument together with sanitizer to generate build files: + +```bash +# With address sanitizer +gn gen out/libfuzzer '--args=use_libfuzzer=true is_asan=true enable_nacl=false' --check +``` + +Supported sanitizer configurations are: + +| GN Argument | Description | +|--------------|----| +| is_asan=true | enables [Address Sanitizer] to catch problems like buffer overruns. | +| is_msan=true | enables [Memory Sanitizer] to catch problems like uninitialed reads. | + + +## Write Fuzzer Function + +Create a new .cc file and define a `LLVMFuzzerTestOneInput` function: + +```cpp +extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { + // put your fuzzing code here and use data+size as input. + return 0; +} +``` + +[url_parse_fuzzer.cc] is a simple example of real-world fuzzer. + +## Define GN Target + +Define `fuzzer_test` GN target: + +``` +import("//testing/libfuzzer/fuzzer_test.gni") +fuzzer_test("my_fuzzer") { + sources = [ "my_fuzzer.cc" ] + deps = [ ... ] +} +``` + +## Build and Run Fuzzer Locally + +Build with ninja as usual and run: + +```bash +ninja -C out/libfuzzer url_parse_fuzzer +./out/libfuzzer/url_parse_fuzzer +``` + +Your fuzzer should produce output like this: + +``` +INFO: Seed: 1787335005 +INFO: -max_len is not provided, using 64 +INFO: PreferSmall: 1 +#0 READ units: 1 exec/s: 0 +#1 INITED cov: 2361 bits: 95 indir: 29 units: 1 exec/s: 0 +#2 NEW cov: 2710 bits: 359 indir: 36 units: 2 exec/s: 0 L: 64 MS: 0 +#3 NEW cov: 2715 bits: 371 indir: 37 units: 3 exec/s: 0 L: 64 MS: 1 ShuffleBytes- +#5 NEW cov: 2728 bits: 375 indir: 38 units: 4 exec/s: 0 L: 63 MS: 3 ShuffleBytes-ShuffleBytes-EraseByte- +#6 NEW cov: 2729 bits: 384 indir: 38 units: 5 exec/s: 0 L: 10 MS: 4 ShuffleBytes-ShuffleBytes-EraseByte-CrossOver- +#7 NEW cov: 2733 bits: 424 indir: 39 units: 6 exec/s: 0 L: 63 MS: 1 ShuffleBytes- +#8 NEW cov: 2733 bits: 426 indir: 39 units: 7 exec/s: 0 L: 63 MS: 2 ShuffleBytes-ChangeByte- +#11 NEW cov: 2733 bits: 447 indir: 39 units: 8 exec/s: 0 L: 33 MS: 5 ShuffleBytes-ChangeByte-ChangeASCIIInt-ChangeBit-CrossOver- +#12 NEW cov: 2733 bits: 451 indir: 39 units: 9 exec/s: 0 L: 62 MS: 1 CrossOver- +#16 NEW cov: 2733 bits: 454 indir: 39 units: 10 exec/s: 0 L: 61 MS: 5 CrossOver-ChangeBit-ChangeBit-EraseByte-ChangeBit- +#18 NEW cov: 2733 bits: 458 indir: 39 units: 11 exec/s: 0 L: 24 MS: 2 CrossOver-CrossOver- +``` + +The `... NEW ...` line appears when libFuzzer finds new and interesting input. The +efficient fuzzer should be able to finds lots of them rather quickly. + +The `... pulse ...` line will appear periodically to show the current status. + + +## Submitting Fuzzer to ClusterFuzz + +ClusterFuzz builds and executes all `fuzzer_test` targets in the source tree. +The only thing you should do is to submit a fuzzer into Chrome. + +## Next Steps + +* After your fuzzer is submitted, you should check its [ClusterFuzz status] in +a day or two. +* Check the [Efficient Fuzzer Guide] to better understand your fuzzer +performance and for optimization hints. + + +[Address Sanitizer]: http://clang.llvm.org/docs/AddressSanitizer.html +[Memory Sanitizer]: http://clang.llvm.org/docs/MemorySanitizer.html +[url_parse_fuzzer.cc]: https://code.google.com/p/chromium/codesearch#chromium/src/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc +[ClusterFuzz status]: clusterfuzz.md#Status-Links +[Efficient Fuzzer Guide]: efficient_fuzzer.md +[crbug/598448]: https://bugs.chromium.org/p/chromium/issues/detail?id=598448 diff --git a/chromium/testing/libfuzzer/reference.md b/chromium/testing/libfuzzer/reference.md new file mode 100644 index 00000000000..8f373ef7904 --- /dev/null +++ b/chromium/testing/libfuzzer/reference.md @@ -0,0 +1,54 @@ +# libFuzzer Integration Reference + +## fuzzer_test GN Template + +Use `fuzzer_test` to define libFuzzer targets: + +``` +fuzzer_test("my_fuzzer") { + ... +} +``` + +Following arguments are supported: + +| Argument | Description | +|----------|-------------| +| sources | **required** list of fuzzer test source files. | +| deps | fuzzer dependencies | +| additional_configs | additional GN configurations to be used for compilation | +| dict | a dictionary file for the fuzzer | +| libfuzzer_options | runtime options file for the fuzzer. See [Fuzzer Runtime Options](Fuzzer-Options) | + + +## Fuzzer Runtime Options + +There are many different runtime options supported by libFuzzer. Options +are passed as command line arguments: + +``` +./fuzzer [-flag1=val1 [-flag2=val2 ...] ] [dir1 [dir2 ...] ] +``` + +Most common flags are: + +| Flag | Description | +|------|-------------| +| max_len | Maximum length of test input. | +| timeout | Timeout of seconds. Units slower than this value will be reported as bugs. | + +A fuller list of options can be found at [libFuzzer Usage] page and by running +the binary with `-help=1`. + +To specify these options for ClusterFuzz, create `<my_fuzzer>.options` file: + +``` +[libfuzzer] +max_len=500 +``` + +and specify the file in `libfuzzer_options` target attribute. + +[libFuzzer Usage]: http://llvm.org/docs/LibFuzzer.html#usage + + diff --git a/chromium/testing/libfuzzer/unittest_main.cc b/chromium/testing/libfuzzer/unittest_main.cc new file mode 100644 index 00000000000..1de128cfbab --- /dev/null +++ b/chromium/testing/libfuzzer/unittest_main.cc @@ -0,0 +1,41 @@ +// Copyright 2015 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. + +// A simple unit-test style driver for libfuzzer tests. +// Usage: <fuzzer_test> <file>... + +#include <fstream> +#include <iostream> +#include <iterator> +#include <vector> + +// Libfuzzer API. +extern "C" { + // User function. + int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size); + // Initialization function. + __attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv); +} + +std::vector<char> readFile(std::string path) { + std::ifstream in(path); + return std::vector<char>((std::istreambuf_iterator<char>(in)), + std::istreambuf_iterator<char>()); +} + +int main(int argc, char **argv) { + if (argc == 1) { + std::cerr << "Usage: " << argv[0] << " <file>..." << std::endl; + exit(1); + } + + if (LLVMFuzzerInitialize) + LLVMFuzzerInitialize(&argc, &argv); + + for (int i = 1; i < argc; ++i) { + std::cout << argv[i] << std::endl; + auto v = readFile(argv[i]); + LLVMFuzzerTestOneInput((const unsigned char *)v.data(), v.size()); + } +} diff --git a/chromium/testing/scripts/android_gtest_test.py b/chromium/testing/scripts/android_gtest_test.py deleted file mode 100755 index 6fc6ca86c55..00000000000 --- a/chromium/testing/scripts/android_gtest_test.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python -# Copyright 2015 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. - -import json -import os -import sys - - -import common - - -def main_run(args): - filter_tests = [] - if args.filter_file: - filter_tests = json.load(args.filter_file) - - script_args = args.args - test_suite = script_args[0] - - with common.temporary_file() as tempfile_path: - cmd = [ - os.path.join( - args.paths['checkout'], 'build', 'android', 'test_runner.py'), - 'gtest', - '--release' if 'release' in args.build_config_fs.lower() else '--debug', - '--suite', test_suite, - '--verbose', - '--flakiness-dashboard-server=http://test-results.appspot.com', - '--json-results-file', tempfile_path, - '--blacklist-file', - os.path.join(args.paths['checkout'], 'out', 'bad_devices.json'), - ] - if filter_tests: - cmd.extend(['--gtest-filter', ':'.join(filter_tests)]) - - rc = common.run_command(cmd) - - with open(tempfile_path) as f: - results = json.load(f) - - parsed_results = common.parse_gtest_test_results(results) - - json.dump({ - 'valid': True, - 'failures': parsed_results['failures'], - }, args.output) - - return rc - - -def main_compile_targets(args): - json.dump(['${name}_apk'], args.output) - - -if __name__ == '__main__': - funcs = { - 'run': main_run, - 'compile_targets': main_compile_targets, - } - sys.exit(common.run_script(sys.argv[1:], funcs)) diff --git a/chromium/testing/scripts/common.py b/chromium/testing/scripts/common.py index 69ee3e49b97..5cba136cb51 100644 --- a/chromium/testing/scripts/common.py +++ b/chromium/testing/scripts/common.py @@ -72,16 +72,15 @@ def run_runtest(cmd_args, runtest_args): sys.executable, os.path.join( cmd_args.paths['checkout'], 'infra', 'scripts', 'runtest_wrapper.py'), - '--path-build', cmd_args.paths['build'], '--', ] else: cmd = [ sys.executable, - os.path.join(cmd_args.paths['build'], 'scripts', 'tools', 'runit.py'), + cmd_args.paths['runit.py'], '--show-path', sys.executable, - os.path.join(cmd_args.paths['build'], 'scripts', 'slave', 'runtest.py'), + cmd_args.paths['runtest.py'], ] return run_command(cmd + [ '--target', cmd_args.build_config_fs, @@ -155,17 +154,15 @@ def parse_common_test_results(json_results, test_separator='/'): return results -def parse_gtest_test_results(json_results): - failures = set() - for cur_iteration_data in json_results.get('per_iteration_data', []): - for test_fullname, results in cur_iteration_data.iteritems(): - # Results is a list with one entry per test try. Last one is the final - # result, the only we care about here. - last_result = results[-1] +def run_integration_test(script_to_run, extra_args, log_file, output): + integration_test_res = subprocess.call( + [sys.executable, script_to_run] + extra_args) - if last_result['status'] != 'SUCCESS': - failures.add(test_fullname) + with open(log_file) as f: + failures = json.load(f) + json.dump({ + 'valid': integration_test_res == 0, + 'failures': failures, + }, output) - return { - 'failures': sorted(failures), - } + return integration_test_res diff --git a/chromium/testing/scripts/host_info.py b/chromium/testing/scripts/host_info.py index f5ebfd13856..b7da5ab2292 100755 --- a/chromium/testing/scripts/host_info.py +++ b/chromium/testing/scripts/host_info.py @@ -28,8 +28,7 @@ def get_free_disk_space(failures): # Stat the current path for info on the current disk. stat_result = os.statvfs('.') # Multiply block size by number of free blocks, express in GiB. - return stat_result.f_frsize * stat_result.f_bavail / ( - 1024.0 / 1024.0 / 1024.0) + return stat_result.f_frsize * stat_result.f_bavail / (1024.0 ** 3) failures.append('get_free_disk_space: OS %s not supported.' % os.name) return 0 diff --git a/chromium/testing/scripts/kasko_integration_tests.py b/chromium/testing/scripts/kasko_integration_tests.py new file mode 100755 index 00000000000..1be0474855f --- /dev/null +++ b/chromium/testing/scripts/kasko_integration_tests.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# 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. + +"""Wrapper for the Kasko integration tests.""" + + +import json +import os +import sys + + +import common + + +# Bring in the Kasko test modules. +KASKO_TEST_DIR = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, + 'chrome', 'test', 'kasko') +KASKO_INTEGRATION_TEST = os.path.join(KASKO_TEST_DIR, + 'kasko_integration_test.py') + + +def main_run(args): + if not sys.platform.startswith('win'): + json.dump({ + 'valid': False, + 'failures': ['This script should only be called on win32.'], + }, args.output) + + with common.temporary_file() as tempfile_path: + kasko_integration_test_res = common.run_integration_test( + KASKO_INTEGRATION_TEST, + ['--log-to-json', tempfile_path], + tempfile_path, args.output) + + return kasko_integration_test_res + + +def main_compile_targets(args): + json.dump(['chrome', 'chromedriver'], args.output) + + +if __name__ == '__main__': + funcs = { + 'run': main_run, + 'compile_targets': main_compile_targets, + } + sys.exit(common.run_script(sys.argv[1:], funcs)) diff --git a/chromium/testing/scripts/mojo_apptests.py b/chromium/testing/scripts/mojo_apptests.py index 70f32c8037c..8718ddd648f 100755 --- a/chromium/testing/scripts/mojo_apptests.py +++ b/chromium/testing/scripts/mojo_apptests.py @@ -16,7 +16,7 @@ def main_run(args): build_dir = os.path.join(common.SRC_DIR, 'out', args.build_config_fs) with common.temporary_file() as tempfile_path: - rc = common.run_command([runner, build_dir, '--verbose', + rc = common.run_command([sys.executable, runner, build_dir, '--verbose', '--write-full-results-to', tempfile_path]) with open(tempfile_path) as f: results = json.load(f) @@ -34,7 +34,7 @@ def main_run(args): def main_compile_targets(args): - json.dump(['mandoline:tests', 'mash/wm:tests'], args.output) + json.dump(['mojo_apptests'], args.output) if __name__ == '__main__': diff --git a/chromium/testing/scripts/run_under_valgrind.py b/chromium/testing/scripts/run_under_valgrind.py new file mode 100755 index 00000000000..789aa556df2 --- /dev/null +++ b/chromium/testing/scripts/run_under_valgrind.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# 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. + +import json +import os +import sys + + +import common + + +def main_run(args): + rc = common.run_runtest(args, [ + os.path.join(common.SRC_DIR, 'tools', 'valgrind', 'chrome_tests.sh'), + '--tool', 'memcheck', + '--build-dir', os.path.join(common.SRC_DIR, 'out', args.build_config_fs), + ] + args.args) + + json.dump({ + 'valid': True, + 'failures': ['failed'] if rc else [] + }, args.output) + + return rc + + +def main_compile_targets(args): + json.dump(['$name'], args.output) + + +if __name__ == '__main__': + funcs = { + 'run': main_run, + 'compile_targets': main_compile_targets, + } + sys.exit(common.run_script(sys.argv[1:], funcs)) diff --git a/chromium/testing/scripts/syzyasan_integration_tests.py b/chromium/testing/scripts/syzyasan_integration_tests.py new file mode 100755 index 00000000000..5d6d8472529 --- /dev/null +++ b/chromium/testing/scripts/syzyasan_integration_tests.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# 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. + +"""Wrapper for the SyzyAsan integration tests.""" + + +import json +import os +import sys + + +import common + + +# Bring in the SyzyAsan test modules. +SYZYASAN_TEST_DIR = os.path.join(os.path.dirname(__file__), os.pardir, + os.pardir, 'chrome', 'test', 'kasko') +SYZYASAN_INTEGRATION_TEST = os.path.join(SYZYASAN_TEST_DIR, + 'syzyasan_integration_test.py') + + +def main_run(args): + if not sys.platform.startswith('win'): + json.dump({ + 'valid': False, + 'failures': ['This script should only be called on win32.'], + }, args.output) + + with common.temporary_file() as tempfile_path: + syzyasan_integration_test_res = common.run_integration_test( + SYZYASAN_INTEGRATION_TEST, + ['--log-to-json', tempfile_path], + tempfile_path, args.output) + + return syzyasan_integration_test_res + + +def main_compile_targets(args): + json.dump(['chrome', 'chromedriver'], args.output) + + +if __name__ == '__main__': + funcs = { + 'run': main_run, + 'compile_targets': main_compile_targets, + } + sys.exit(common.run_script(sys.argv[1:], funcs)) diff --git a/chromium/testing/test.gni b/chromium/testing/test.gni index 6739bfebb21..13c434238ac 100644 --- a/chromium/testing/test.gni +++ b/chromium/testing/test.gni @@ -8,126 +8,177 @@ # Define a test as an executable (or apk on Android) with the "testonly" flag # set. +# Variable: +# use_raw_android_executable: Use executable() rather than android_apk(). template("test") { if (is_android) { import("//build/config/android/config.gni") import("//build/config/android/rules.gni") - main_target_name = target_name - library_name = "_${target_name}__library" - apk_name = "${target_name}_apk" + _use_raw_android_executable = defined(invoker.use_raw_android_executable) && + invoker.use_raw_android_executable - shared_library(library_name) { - # Configs will always be defined since we set_defaults for a component - # in the main config. We want to use those rather than whatever came with - # the nested shared/static library inside the component. - configs = [] # Prevent list overwriting warning. - configs = invoker.configs + # output_name is used to allow targets with the same name but in different + # packages to still produce unique runner scripts. + _output_name = invoker.target_name + if (defined(invoker.output_name)) { + _output_name = invoker.output_name + } - testonly = true + if (_use_raw_android_executable) { + _exec_target = "${target_name}__exec" + _dist_target = "${target_name}__dist" + _exec_output = + "$target_out_dir/${invoker.target_name}/${invoker.target_name}" + + executable(_exec_target) { + # Configs will always be defined since we set_defaults in BUILDCONFIG.gn. + configs = [] + data_deps = [] + forward_variables_from(invoker, "*", [ "extra_dist_files" ]) + testonly = true + + # Thanks to the set_defaults() for test(), configs are initialized with + # the default shared_library configs rather than executable configs. + configs -= [ + "//build/config:shared_library_config", + "//build/config/android:hide_native_jni_exports", + ] + configs += [ "//build/config:executable_config" ] + + # Don't output to the root or else conflict with the group() below. + output_name = rebase_path(_exec_output, root_out_dir) + if (is_component_build || is_asan) { + data_deps += [ "//build/android:cpplib_stripped" ] + } + } - # Don't use "*" to forward all variables since some (like output_name - # and isolate_file) apply only to the APK below. - deps = [] - forward_variables_from(invoker, - [ - "all_dependent_configs", - "allow_circular_includes_from", - "cflags", - "cflags_c", - "cflags_cc", - "check_includes", - "data", - "data_deps", - "datadeps", - "defines", - "deps", - "include_dirs", - "ldflags", - "lib_dirs", - "libs", - "output_extension", - "output_name", - "public", - "public_configs", - "public_deps", - "sources", - "visibility", - ]) - - if (!defined(invoker.use_default_launcher) || - invoker.use_default_launcher) { - deps += [ "//testing/android/native_test:native_test_native_code" ] + create_native_executable_dist(_dist_target) { + testonly = true + dist_dir = "$root_out_dir/$target_name" + binary = _exec_output + deps = [ + ":$_exec_target", + ] + if (defined(invoker.extra_dist_files)) { + extra_files = invoker.extra_dist_files + } } - } + } else { + _library_target = "_${target_name}__library" + _apk_target = "${target_name}_apk" + _apk_specific_vars = [ + "android_manifest", + "enable_multidex", + "use_default_launcher", + "write_asset_list", + ] + shared_library(_library_target) { + # Configs will always be defined since we set_defaults in BUILDCONFIG.gn. + configs = [] # Prevent list overwriting warning. + configs = invoker.configs + testonly = true - unittest_apk(apk_name) { - forward_variables_from(invoker, - [ - "android_manifest", - "deps", - "enable_multidex", - "use_default_launcher", - "write_asset_list", - ]) - unittests_dep = ":$library_name" - apk_name = main_target_name - if (defined(invoker.output_name)) { - apk_name = invoker.output_name - unittests_binary = "lib${apk_name}.so" + deps = [] + forward_variables_from(invoker, + "*", + _apk_specific_vars + [ + "isolate_file", + "visibility", + ]) + + if (!defined(invoker.use_default_launcher) || + invoker.use_default_launcher) { + deps += [ "//testing/android/native_test:native_test_native_code" ] + } + } + unittest_apk(_apk_target) { + forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) + unittests_dep = ":$_library_target" + apk_name = invoker.target_name + if (defined(invoker.output_name)) { + apk_name = invoker.output_name + unittests_binary = "lib${apk_name}.so" + install_script_name = "install_${invoker.output_name}" + } + deps += [ ":$_library_target" ] } - deps += [ ":$library_name" ] - } - _test_name = main_target_name - if (defined(invoker.output_name)) { - _test_name = invoker.output_name - } - test_runner_script_name = "${_test_name}__test_runner_script" - test_runner_script(test_runner_script_name) { - test_name = _test_name - test_type = "gtest" - test_suite = _test_name - if (defined(invoker.isolate_file)) { - isolate_file = invoker.isolate_file + # Incremental test targets work only for .apks. + _incremental_test_runner_target = + "${_output_name}_incremental__test_runner_script" + test_runner_script(_incremental_test_runner_target) { + forward_variables_from(invoker, [ "isolate_file" ]) + apk_target = ":$_apk_target" + test_name = "${_output_name}_incremental" + test_type = "gtest" + test_suite = _output_name + incremental_install = true + } + group("${target_name}_incremental") { + testonly = true + datadeps = [ + ":$_incremental_test_runner_target", + ] + deps = [ + ":${_apk_target}_incremental", + ] } } - incremental_test_runner_script_name = - "${_test_name}_incremental__test_runner_script" - test_runner_script(incremental_test_runner_script_name) { - test_name = "${_test_name}_incremental" - test_type = "gtest" - test_suite = _test_name - incremental_install = true - if (defined(invoker.isolate_file)) { - isolate_file = invoker.isolate_file + + _test_runner_target = "${_output_name}__test_runner_script" + test_runner_script(_test_runner_target) { + forward_variables_from(invoker, [ "isolate_file" ]) + if (_use_raw_android_executable) { + executable_dist_dir = "$root_out_dir/$_dist_target" + } else { + apk_target = ":$_apk_target" } + test_name = _output_name + test_type = "gtest" + test_suite = _output_name } group(target_name) { testonly = true - datadeps = [ - ":$test_runner_script_name", - ] deps = [ - ":$apk_name", + ":$_test_runner_target", ] + if (_use_raw_android_executable) { + deps += [ ":$_dist_target" ] + } else { + deps += [ ":$_apk_target" ] + } } - group("${target_name}_incremental") { + + # TODO(GYP): Delete this after we've converted everything to GN. + # The _run targets exist only for compatibility w/ GYP. + group("${target_name}_apk_run") { testonly = true - datadeps = [ - ":$incremental_test_runner_script_name", - ] deps = [ - ":${apk_name}_incremental", + ":${invoker.target_name}", ] } } else if (is_ios) { - if (is_ios) { - import("//build/config/ios/rules.gni") + import("//build/config/ios/rules.gni") + + _test_target = target_name + _resources_bundle_data = target_name + "_resources_bundle_data" + + bundle_data(_resources_bundle_data) { + visibility = [ + ":${_test_target}", + ":${_test_target}_generate_executable", + ] + sources = [ + "//testing/gtest_ios/Default.png", + ] + outputs = [ + "{{bundle_resources_dir}}/{{source_file_part}}", + ] } - ios_app(target_name) { + app(_test_target) { # TODO(GYP): Make this configurable and only provide a default # that can be overridden. info_plist = "//testing/gtest_ios/unittest-Info.plist" @@ -135,42 +186,19 @@ template("test") { entitlements_path = "//testing/gtest_ios" code_signing_identity = "" testonly = true + extra_substitutions = [ "BUNDLE_ID_TEST_NAME=$app_name" ] # See above call. set_sources_assignment_filter([]) - forward_variables_from(invoker, - [ - "all_dependent_configs", - "allow_circular_includes_from", - "cflags", - "cflags_c", - "cflags_cc", - "cflags_objc", - "cflags_objcc", - "check_includes", - "configs", - "data", - "data_deps", - "defines", - "include_dirs", - "ldflags", - "libs", - "output_extension", - "output_name", - "public", - "public_configs", - "public_deps", - "sources", - "visibility", - ]) - - if (defined(invoker.deps)) { - deps = invoker.deps - } else { + forward_variables_from(invoker, "*") + + if (!defined(deps)) { deps = [] } deps += [ + ":$_resources_bundle_data", + # All shared libraries must have the sanitizer deps to properly link in # asan mode (this target will be empty in other cases). "//build/config/sanitizers:deps", @@ -178,13 +206,10 @@ template("test") { } } else { executable(target_name) { + deps = [] forward_variables_from(invoker, "*") testonly = true - - if (!defined(invoker.deps)) { - deps = [] - } deps += [ # All shared libraries must have the sanitizer deps to properly link in # asan mode (this target will be empty in other cases). @@ -194,5 +219,14 @@ template("test") { "//build/win:default_exe_manifest", ] } + + # TODO(GYP): Delete this after we've converted everything to GN. + # The _run targets exist only for compatibility with GYP. + group("${target_name}_run") { + testonly = true + deps = [ + ":${invoker.target_name}", + ] + } } } diff --git a/chromium/testing/test_env.py b/chromium/testing/test_env.py index 052df6769b2..7d72169d235 100755 --- a/chromium/testing/test_env.py +++ b/chromium/testing/test_env.py @@ -65,8 +65,8 @@ def get_sanitizer_env(cmd, asan, lsan, msan, tsan): # TODO(glider): remove the symbolizer path once # https://code.google.com/p/address-sanitizer/issues/detail?id=134 is fixed. - symbolizer_path = os.path.abspath(os.path.join(ROOT_DIR, 'third_party', - 'llvm-build', 'Release+Asserts', 'bin', 'llvm-symbolizer')) + symbolizer_path = os.path.join(ROOT_DIR, + 'third_party', 'llvm-build', 'Release+Asserts', 'bin', 'llvm-symbolizer') if lsan or tsan: # LSan is not sandbox-compatible, so we can use online symbolization. In @@ -125,7 +125,8 @@ def get_sanitizer_env(cmd, asan, lsan, msan, tsan): def get_sanitizer_symbolize_command(json_path=None, executable_path=None): """Construct the command to invoke offline symbolization script.""" - script_path = '../tools/valgrind/asan/asan_symbolize.py' + script_path = os.path.join( + ROOT_DIR, 'tools', 'valgrind', 'asan', 'asan_symbolize.py') cmd = [sys.executable, script_path] if json_path is not None: cmd.append('--test-summary-json-file=%s' % json_path) @@ -155,11 +156,13 @@ def symbolize_snippets_in_json(cmd, env): p = subprocess.Popen(symbolize_command, stderr=subprocess.PIPE, env=env) (_, stderr) = p.communicate() except OSError as e: - print 'Exception while symbolizing snippets: %s' % e + print >> sys.stderr, 'Exception while symbolizing snippets: %s' % e + raise if p.returncode != 0: - print "Error: failed to symbolize snippets in JSON:\n" - print stderr + print >> sys.stderr, "Error: failed to symbolize snippets in JSON:\n" + print >> sys.stderr, stderr + raise subprocess.CalledProcessError(p.returncode, symbolize_command) def run_executable(cmd, env): diff --git a/chromium/testing/variations/fieldtrial_testing_config_android.json b/chromium/testing/variations/fieldtrial_testing_config_android.json index b6f0a7571e9..03686cea2e9 100644 --- a/chromium/testing/variations/fieldtrial_testing_config_android.json +++ b/chromium/testing/variations/fieldtrial_testing_config_android.json @@ -4,6 +4,17 @@ "group_name": "Disabled" } ], + "AsyncDns": [ + { + "group_name": "AsyncDnsA" + }, + { + "group_name": "SystemDnsA" + }, + { + "group_name": "AsyncDnsNoFallbackA" + } + ], "AutodetectEncoding": [ { "group_name": "Enabled" @@ -25,6 +36,9 @@ "params": { "limit": "3" } + }, + { + "group_name": "Enabled" } ], "ChromotingQUIC": [ @@ -78,14 +92,6 @@ "group_name": "Enabled" } ], - "DataReductionProxyConfigService": [ - { - "group_name": "Enabled", - "params": { - "minimum_refresh_interval_on_success_msec": "21600000" - } - } - ], "DataReductionProxyFREPromo": [ { "group_name": "Enabled" @@ -104,48 +110,25 @@ } } ], - "EnableMediaThreadForMediaPlayback": [ + "DocumentWriteEvaluator": [ { + "enable_features": [ + "DocumentWriteEvaluator" + ], "group_name": "Enabled" } ], - "EnhancedBookmarks": [ - { - "group_name": "Launch EnableEnhancedBookmarks", - "params": { - "id": "Fake_id_to_trigger_experiment_code" - } - }, - { - "group_name": "Launch Control" - }, - { - "group_name": "EnableEnhancedBookmarks", - "params": { - "id": "Fake_id_to_trigger_experiment_code" - } - }, - { - "group_name": "EnableEnhancedBookmarksGrid", - "params": { - "DefaultViewMode": "Grid", - "id": "Fake_id_to_trigger_experiment_code" - } - }, + "EnableMediaThreadForMediaPlayback": [ { - "group_name": "EnableEnhancedBookmarksList", - "params": { - "DefaultViewMode": "List", - "id": "Fake_id_to_trigger_experiment_code" - } + "group_name": "Enabled" } ], - "IconNTP": [ + "ImeThread": [ { - "group_name": "Enabled", - "params": { - "state": "enabled" - } + "enable_features": [ + "ImeThread" + ], + "group_name": "Enabled" } ], "InvalidationsGCMUpstream": [ @@ -172,12 +155,25 @@ } } ], + "MinidumpDirectoryObserver": [ + { + "group_name": "ObserverExperimentGroup", + "params": { + "Enabled": "true" + } + } + ], + "ModerateBindingOnBackgroundTabCreation": [ + { + "group_name": "Enabled" + } + ], "NTPPopularSites": [ { - "group_name": "Enabled", + "group_name": "Enabled5", "params": { "country": "IN", - "version": "4" + "version": "5" } } ], @@ -205,11 +201,37 @@ } } ], + "OfferUploadCreditCards": [ + { + "group_name": "Enabled" + } + ], + "OfflinePages": [ + { + "enable_features": [ + "NTPOfflinePages" + ], + "group_name": "EnabledAsBookmarks" + } + ], + "PageRevisitInstrumentation": [ + { + "group_name": "Enabled" + } + ], "PasswordBranding": [ { "group_name": "SmartLockBrandingSavePromptOnly" } ], + "PhysicalWeb": [ + { + "enable_features": [ + "PhysicalWeb" + ], + "group_name": "Enabled" + } + ], "Precache": [ { "group_name": "Enabled" @@ -225,10 +247,7 @@ ], "QUIC": [ { - "group_name": "Enabled", - "params": { - "alternate_protocol_probability_threshold": "0.001" - } + "group_name": "Enabled" } ], "ReaderModeUIFeedback": [ @@ -239,6 +258,14 @@ "group_name": "DoNotShow" } ], + "RenderingPipelineThrottling": [ + { + "enable_features": [ + "RenderingPipelineThrottling" + ], + "group_name": "Enabled" + } + ], "ReportCertificateErrors": [ { "group_name": "ShowAndPossiblySend", @@ -268,6 +295,14 @@ "group_name": "DontShowAndDontSend" } ], + "ResourcePriorities": [ + { + "group_name": "AllExceptAsyncScripts_11011_1_1_10" + }, + { + "group_name": "Control" + } + ], "SafeBrowsingAndroid": [ { "group_name": "Enabled", @@ -291,14 +326,14 @@ "group_name": "Disabled" } ], - "SdchPersistence": [ + "SchedulerExpensiveTaskBlocking": [ { "group_name": "Enabled" } ], - "SpdyEnableDependencies": [ + "SdchPersistence": [ { - "group_name": "Enable" + "group_name": "Enabled" } ], "SpeculativeResourcePrefetching": [ @@ -342,16 +377,29 @@ "group_name": "Enabled" } ], + "TokenBinding": [ + { + "enable_features": [ + "token-binding" + ], + "group_name": "TokenBinding" + } + ], "UMA_EnableCellularLogUpload": [ { - "group_name": "Enabled", + "group_name": "Enabled_wo_sampling", "params": { "Enabled": "true", "Optimize": "true", - "Sample_Probability": "50" + "Sample_Probability": "100" } } ], + "UnifiedMediaPipelineTrial": [ + { + "group_name": "Enabled" + } + ], "UpdateMenuItem": [ { "group_name": "Enabled", @@ -396,6 +444,15 @@ } } ], + "V8SerializeOptions": [ + { + "enable_features": [ + "V8_Serialize_Eager", + "V8_Serialize_Age_Code" + ], + "group_name": "SerializeEagerAndAgeCode" + } + ], "VarationsServiceControl": [ { "group_name": "Interval_30min", @@ -418,5 +475,13 @@ { "group_name": "Enabled" } + ], + "use-new-media-cache": [ + { + "enable_features": [ + "use-new-media-cache" + ], + "group_name": "Enabled" + } ] } diff --git a/chromium/testing/variations/fieldtrial_testing_config_chromeos.json b/chromium/testing/variations/fieldtrial_testing_config_chromeos.json index 01c539e40ee..f9c4aa1aa17 100644 --- a/chromium/testing/variations/fieldtrial_testing_config_chromeos.json +++ b/chromium/testing/variations/fieldtrial_testing_config_chromeos.json @@ -15,6 +15,9 @@ "params": { "limit": "3" } + }, + { + "group_name": "Enabled" } ], "CaptivePortalInterstitial": [ @@ -35,14 +38,6 @@ "group_name": "Enabled" } ], - "DataReductionProxyConfigService": [ - { - "group_name": "Enabled", - "params": { - "minimum_refresh_interval_on_success_msec": "21600000" - } - } - ], "EnableGoogleCachedCopyTextExperiment": [ { "group_name": "Button" @@ -53,11 +48,26 @@ "group_name": "Enabled" } ], + "LocalNTPSuggestionsService": [ + { + "group_name": "Enabled" + } + ], "MaterialDesignDownloads": [ { "group_name": "Enabled" } ], + "OfferUploadCreditCards": [ + { + "group_name": "Enabled" + } + ], + "PageRevisitInstrumentation": [ + { + "group_name": "Enabled" + } + ], "PasswordBranding": [ { "group_name": "SmartLockBrandingSavePromptOnly" @@ -65,10 +75,15 @@ ], "QUIC": [ { - "group_name": "Enabled", - "params": { - "alternate_protocol_probability_threshold": "0.01" - } + "group_name": "Enabled" + } + ], + "RenderingPipelineThrottling": [ + { + "enable_features": [ + "RenderingPipelineThrottling" + ], + "group_name": "Enabled" } ], "ReportCertificateErrors": [ @@ -100,22 +115,34 @@ "group_name": "DontShowAndDontSend" } ], + "SSLCommonNameMismatchHandling": [ + { + "group_name": "Enabled" + } + ], "SafeBrowsingUnverifiedDownloads": [ { - "group_name": "DisableByParameterExe", + "group_name": "DisableByParameterMostSbTypes2", "params": { - "blacklist": ".exe" + "blacklist": ".exe-,.zip-", + "block_sb_types": "true", + "whitelist": ".rar,.svg,.url,.xml,.zip" } } ], + "SchedulerExpensiveTaskBlocking": [ + { + "group_name": "Enabled" + } + ], "SdchPersistence": [ { "group_name": "Enabled" } ], - "SpdyEnableDependencies": [ + "SimpleCacheTrial": [ { - "group_name": "Enable" + "group_name": "ExperimentYes" } ], "StrictSecureCookies": [ @@ -136,6 +163,23 @@ "group_name": "Enabled" } ], + "TokenBinding": [ + { + "enable_features": [ + "token-binding" + ], + "group_name": "TokenBinding" + } + ], + "V8SerializeOptions": [ + { + "enable_features": [ + "V8_Serialize_Eager", + "V8_Serialize_Age_Code" + ], + "group_name": "SerializeEagerAndAgeCode" + } + ], "VarationsServiceControl": [ { "group_name": "Interval_30min", @@ -149,6 +193,14 @@ "group_name": "Enabled" } ], + "WebRTC-H264WithOpenH264FFmpeg": [ + { + "enable_features": [ + "WebRTC-H264WithOpenH264FFmpeg" + ], + "group_name": "Enabled" + } + ], "WebRTC-LocalIPPermissionCheck": [ { "group_name": "Enabled" @@ -158,5 +210,13 @@ { "group_name": "Enabled" } + ], + "use-new-media-cache": [ + { + "enable_features": [ + "use-new-media-cache" + ], + "group_name": "Enabled" + } ] } diff --git a/chromium/testing/variations/fieldtrial_testing_config_ios.json b/chromium/testing/variations/fieldtrial_testing_config_ios.json index f7bbd075993..d7a666661d2 100644 --- a/chromium/testing/variations/fieldtrial_testing_config_ios.json +++ b/chromium/testing/variations/fieldtrial_testing_config_ios.json @@ -10,6 +10,9 @@ "params": { "limit": "3" } + }, + { + "group_name": "Enabled" } ], "ChromotingQUIC": [ @@ -25,12 +28,9 @@ "group_name": "Enabled" } ], - "DataReductionProxyConfigService": [ + "PageRevisitInstrumentation": [ { - "group_name": "Enabled", - "params": { - "minimum_refresh_interval_on_success_msec": "21600000" - } + "group_name": "Enabled" } ], "PasswordBranding": [ @@ -40,10 +40,7 @@ ], "QUIC": [ { - "group_name": "Enabled", - "params": { - "alternate_protocol_probability_threshold": "0.001" - } + "group_name": "Enabled" } ], "SdchPersistence": [ @@ -51,11 +48,6 @@ "group_name": "Enabled" } ], - "SpdyEnableDependencies": [ - { - "group_name": "Enable" - } - ], "SyncHttpContentCompression": [ { "group_name": "Enabled" diff --git a/chromium/testing/variations/fieldtrial_testing_config_linux.json b/chromium/testing/variations/fieldtrial_testing_config_linux.json index 7a904ac6954..43de8b21f1d 100644 --- a/chromium/testing/variations/fieldtrial_testing_config_linux.json +++ b/chromium/testing/variations/fieldtrial_testing_config_linux.json @@ -20,6 +20,9 @@ "params": { "limit": "3" } + }, + { + "group_name": "Enabled" } ], "CaptivePortalInterstitial": [ @@ -40,12 +43,12 @@ "group_name": "Enabled" } ], - "DataReductionProxyConfigService": [ + "DocumentWriteEvaluator": [ { - "group_name": "Enabled", - "params": { - "minimum_refresh_interval_on_success_msec": "21600000" - } + "enable_features": [ + "DocumentWriteEvaluator" + ], + "group_name": "Enabled" } ], "EnableGoogleCachedCopyTextExperiment": [ @@ -68,11 +71,26 @@ "group_name": "Enabled" } ], + "LocalNTPSuggestionsService": [ + { + "group_name": "Enabled" + } + ], "MaterialDesignDownloads": [ { "group_name": "Enabled" } ], + "OfferUploadCreditCards": [ + { + "group_name": "Enabled" + } + ], + "PageRevisitInstrumentation": [ + { + "group_name": "Enabled" + } + ], "PasswordBranding": [ { "group_name": "SmartLockBrandingSavePromptOnly" @@ -80,10 +98,7 @@ ], "QUIC": [ { - "group_name": "Enabled", - "params": { - "alternate_protocol_probability_threshold": "0.01" - } + "group_name": "Enabled" } ], "RefreshTokenDeviceId": [ @@ -91,6 +106,14 @@ "group_name": "Enabled" } ], + "RenderingPipelineThrottling": [ + { + "enable_features": [ + "RenderingPipelineThrottling" + ], + "group_name": "Enabled" + } + ], "ReportCertificateErrors": [ { "group_name": "ShowAndPossiblySend", @@ -120,6 +143,19 @@ "group_name": "DontShowAndDontSend" } ], + "ResourcePriorities": [ + { + "group_name": "AllExceptAsyncScripts_11011_1_1_10" + }, + { + "group_name": "Control" + } + ], + "SSLCommonNameMismatchHandling": [ + { + "group_name": "Enabled" + } + ], "SafeBrowsingReportPhishingErrorLink": [ { "group_name": "Enabled" @@ -133,9 +169,11 @@ ], "SafeBrowsingUnverifiedDownloads": [ { - "group_name": "DisableByParameterExe", + "group_name": "DisableByParameterMostSbTypes2", "params": { - "blacklist": ".exe" + "blacklist": ".exe-,.zip-", + "block_sb_types": "true", + "whitelist": ".rar,.svg,.url,.xml,.zip" } } ], @@ -147,14 +185,19 @@ } } ], + "SchedulerExpensiveTaskBlocking": [ + { + "group_name": "Enabled" + } + ], "SdchPersistence": [ { "group_name": "Enabled" } ], - "SpdyEnableDependencies": [ + "SimpleCacheTrial": [ { - "group_name": "Enable" + "group_name": "ExperimentYes" } ], "StrictSecureCookies": [ @@ -175,6 +218,23 @@ "group_name": "Enabled" } ], + "TokenBinding": [ + { + "enable_features": [ + "token-binding" + ], + "group_name": "TokenBinding" + } + ], + "V8SerializeOptions": [ + { + "enable_features": [ + "V8_Serialize_Eager", + "V8_Serialize_Age_Code" + ], + "group_name": "SerializeEagerAndAgeCode" + } + ], "VarationsServiceControl": [ { "group_name": "Interval_30min", @@ -188,6 +248,14 @@ "group_name": "Enabled" } ], + "WebRTC-H264WithOpenH264FFmpeg": [ + { + "enable_features": [ + "WebRTC-H264WithOpenH264FFmpeg" + ], + "group_name": "Enabled" + } + ], "WebRTC-LocalIPPermissionCheck": [ { "group_name": "Enabled" @@ -197,5 +265,13 @@ { "group_name": "Enabled" } + ], + "use-new-media-cache": [ + { + "enable_features": [ + "use-new-media-cache" + ], + "group_name": "Enabled" + } ] } diff --git a/chromium/testing/variations/fieldtrial_testing_config_mac.json b/chromium/testing/variations/fieldtrial_testing_config_mac.json index 7948154efb7..bf7f987809e 100644 --- a/chromium/testing/variations/fieldtrial_testing_config_mac.json +++ b/chromium/testing/variations/fieldtrial_testing_config_mac.json @@ -15,6 +15,9 @@ "params": { "limit": "3" } + }, + { + "group_name": "Enabled" } ], "AutomaticTabDiscarding": [ @@ -22,7 +25,10 @@ "enable_features": [ "AutomaticTabDiscarding" ], - "group_name": "Enabled_Once" + "group_name": "Enabled_Once_10-gen2", + "params": { + "MinimumProtectionTime": "600" + } } ], "CaptivePortalInterstitial": [ @@ -43,12 +49,12 @@ "group_name": "Enabled" } ], - "DataReductionProxyConfigService": [ + "DocumentWriteEvaluator": [ { - "group_name": "Enabled", - "params": { - "minimum_refresh_interval_on_success_msec": "21600000" - } + "enable_features": [ + "DocumentWriteEvaluator" + ], + "group_name": "Enabled" } ], "EnableGoogleCachedCopyTextExperiment": [ @@ -81,11 +87,26 @@ "group_name": "Enabled" } ], + "LocalNTPSuggestionsService": [ + { + "group_name": "Enabled" + } + ], + "MacMemoryMechanism": [ + { + "group_name": "Mach" + } + ], "MaterialDesignDownloads": [ { "group_name": "Enabled" } ], + "PageRevisitInstrumentation": [ + { + "group_name": "Enabled" + } + ], "PasswordBranding": [ { "group_name": "SmartLockBrandingSavePromptOnly" @@ -93,10 +114,7 @@ ], "QUIC": [ { - "group_name": "Enabled", - "params": { - "alternate_protocol_probability_threshold": "0.01" - } + "group_name": "Enabled" } ], "RefreshTokenDeviceId": [ @@ -104,6 +122,14 @@ "group_name": "Enabled" } ], + "RenderingPipelineThrottling": [ + { + "enable_features": [ + "RenderingPipelineThrottling" + ], + "group_name": "Enabled" + } + ], "ReportCertificateErrors": [ { "group_name": "ShowAndPossiblySend", @@ -133,6 +159,19 @@ "group_name": "DontShowAndDontSend" } ], + "ResourcePriorities": [ + { + "group_name": "AllExceptAsyncScripts_11011_1_1_10" + }, + { + "group_name": "Control" + } + ], + "SSLCommonNameMismatchHandling": [ + { + "group_name": "Enabled" + } + ], "SafeBrowsingReportPhishingErrorLink": [ { "group_name": "Enabled" @@ -146,9 +185,11 @@ ], "SafeBrowsingUnverifiedDownloads": [ { - "group_name": "DisableByParameterExe", + "group_name": "DisableByParameterMostSbTypes2", "params": { - "blacklist": ".exe" + "blacklist": ".exe-,.zip-", + "block_sb_types": "true", + "whitelist": ".rar,.svg,.url,.xml,.zip" } } ], @@ -160,14 +201,19 @@ } } ], + "SchedulerExpensiveTaskBlocking": [ + { + "group_name": "Enabled" + } + ], "SdchPersistence": [ { "group_name": "Enabled" } ], - "SpdyEnableDependencies": [ + "SimpleCacheTrial": [ { - "group_name": "Enable" + "group_name": "ExperimentYes" } ], "StrictSecureCookies": [ @@ -188,6 +234,23 @@ "group_name": "Enabled" } ], + "TokenBinding": [ + { + "enable_features": [ + "token-binding" + ], + "group_name": "TokenBinding" + } + ], + "V8SerializeOptions": [ + { + "enable_features": [ + "V8_Serialize_Eager", + "V8_Serialize_Age_Code" + ], + "group_name": "SerializeEagerAndAgeCode" + } + ], "VarationsServiceControl": [ { "group_name": "Interval_30min", @@ -196,11 +259,27 @@ } } ], + "ViewsSimplifiedFullscreenUI": [ + { + "enable_features": [ + "ViewsSimplifiedFullscreenUI" + ], + "group_name": "Enabled" + } + ], "WebFontsIntervention": [ { "group_name": "Enabled" } ], + "WebRTC-H264WithOpenH264FFmpeg": [ + { + "enable_features": [ + "WebRTC-H264WithOpenH264FFmpeg" + ], + "group_name": "Enabled" + } + ], "WebRTC-LocalIPPermissionCheck": [ { "group_name": "Enabled" @@ -210,5 +289,13 @@ { "group_name": "Enabled" } + ], + "use-new-media-cache": [ + { + "enable_features": [ + "use-new-media-cache" + ], + "group_name": "Enabled" + } ] } diff --git a/chromium/testing/variations/fieldtrial_testing_config_win.json b/chromium/testing/variations/fieldtrial_testing_config_win.json index 64507f4c0d5..331817c1045 100644 --- a/chromium/testing/variations/fieldtrial_testing_config_win.json +++ b/chromium/testing/variations/fieldtrial_testing_config_win.json @@ -1,9 +1,4 @@ { - "AsyncSetAsDefault": [ - { - "group_name": "Enabled" - } - ], "AutofillClassifier": [ { "group_name": "Enabled" @@ -20,6 +15,9 @@ "params": { "limit": "3" } + }, + { + "group_name": "Enabled" } ], "AutomaticTabDiscarding": [ @@ -27,7 +25,10 @@ "enable_features": [ "AutomaticTabDiscarding" ], - "group_name": "Enabled_Once" + "group_name": "Enabled_Once_10-gen2", + "params": { + "MinimumProtectionTime": "600" + } } ], "BrowserBlacklist": [ @@ -58,12 +59,12 @@ "group_name": "Enabled" } ], - "DataReductionProxyConfigService": [ + "DocumentWriteEvaluator": [ { - "group_name": "Enabled", - "params": { - "minimum_refresh_interval_on_success_msec": "21600000" - } + "enable_features": [ + "DocumentWriteEvaluator" + ], + "group_name": "Enabled" } ], "EnableGoogleCachedCopyTextExperiment": [ @@ -111,6 +112,11 @@ "group_name": "Enabled" } ], + "LocalNTPSuggestionsService": [ + { + "group_name": "Enabled" + } + ], "MaterialDesignDownloads": [ { "group_name": "Enabled" @@ -145,6 +151,16 @@ "group_name": "Enabled" } ], + "OfferUploadCreditCards": [ + { + "group_name": "Enabled" + } + ], + "PageRevisitInstrumentation": [ + { + "group_name": "Enabled" + } + ], "PasswordBranding": [ { "group_name": "SmartLockBrandingSavePromptOnly" @@ -155,19 +171,32 @@ "group_name": "Disabled" } ], - "QUIC": [ + "PreRead": [ { - "group_name": "Enabled", + "group_name": "NoPrefetchArgument", "params": { - "alternate_protocol_probability_threshold": "0.01" + "NoPrefetchArgument": "true" } } ], + "QUIC": [ + { + "group_name": "Enabled" + } + ], "RefreshTokenDeviceId": [ { "group_name": "Enabled" } ], + "RenderingPipelineThrottling": [ + { + "enable_features": [ + "RenderingPipelineThrottling" + ], + "group_name": "Enabled" + } + ], "ReportCertificateErrors": [ { "group_name": "ShowAndPossiblySend", @@ -197,11 +226,24 @@ "group_name": "DontShowAndDontSend" } ], + "ResourcePriorities": [ + { + "group_name": "AllExceptAsyncScripts_11011_1_1_10" + }, + { + "group_name": "Control" + } + ], "SRTPromptFieldTrial": [ { "group_name": "On" } ], + "SSLCommonNameMismatchHandling": [ + { + "group_name": "Enabled" + } + ], "SafeBrowsingReportPhishingErrorLink": [ { "group_name": "Enabled" @@ -215,9 +257,11 @@ ], "SafeBrowsingUnverifiedDownloads": [ { - "group_name": "DisableByParameterExe", + "group_name": "DisableByParameterMostSbTypes2", "params": { - "blacklist": ".exe" + "blacklist": ".exe-,.zip-", + "block_sb_types": "true", + "whitelist": ".rar,.svg,.url,.xml,.zip" } } ], @@ -229,19 +273,19 @@ } } ], - "SdchPersistence": [ + "SchedulerExpensiveTaskBlocking": [ { "group_name": "Enabled" } ], - "SettingsEnforcement": [ + "SdchPersistence": [ { - "group_name": "enforce_always_with_extensions_and_dse" + "group_name": "Enabled" } ], - "SpdyEnableDependencies": [ + "SettingsEnforcement": [ { - "group_name": "Enable" + "group_name": "enforce_always_with_extensions_and_dse" } ], "StrictSecureCookies": [ @@ -262,11 +306,28 @@ "group_name": "Enabled" } ], + "TokenBinding": [ + { + "enable_features": [ + "token-binding" + ], + "group_name": "TokenBinding" + } + ], "TriggeredResetFieldTrial": [ { "group_name": "On" } ], + "V8SerializeOptions": [ + { + "enable_features": [ + "V8_Serialize_Eager", + "V8_Serialize_Age_Code" + ], + "group_name": "SerializeEagerAndAgeCode" + } + ], "VarationsServiceControl": [ { "group_name": "Interval_30min", @@ -280,6 +341,14 @@ "group_name": "Enabled" } ], + "WebRTC-H264WithOpenH264FFmpeg": [ + { + "enable_features": [ + "WebRTC-H264WithOpenH264FFmpeg" + ], + "group_name": "Enabled" + } + ], "WebRTC-LocalIPPermissionCheck": [ { "group_name": "Enabled" @@ -289,5 +358,13 @@ { "group_name": "Enabled" } + ], + "use-new-media-cache": [ + { + "enable_features": [ + "use-new-media-cache" + ], + "group_name": "Enabled" + } ] } |