Debian Codegraph @

src/external/googletest/googlemock/include/gmock/gmock-spec-builders.h

raw symbols SCIP
1 // Copyright 2007, Google Inc.cxx . . $ `<file>/src/external/googletest/googlemock/include/gmock/gmock-spec-builders.h`/
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 // * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 // Google Mock - a framework for writing C++ mock classes.
31 //
32 // This file implements the ON_CALL() and EXPECT_CALL() macros.
33 //
34 // A user can use the ON_CALL() macro to specify the default action of
35 // a mock method. The syntax is:
36 //
37 // ON_CALL(mock_object, Method(argument-matchers))
38 // .With(multi-argument-matcher)
39 // .WillByDefault(action);
40 //
41 // where the .With() clause is optional.
42 //
43 // A user can use the EXPECT_CALL() macro to specify an expectation on
44 // a mock method. The syntax is:
45 //
46 // EXPECT_CALL(mock_object, Method(argument-matchers))
47 // .With(multi-argument-matchers)
48 // .Times(cardinality)
49 // .InSequence(sequences)
50 // .After(expectations)
51 // .WillOnce(action)
52 // .WillRepeatedly(action)
53 // .RetiresOnSaturation();
54 //
55 // where all clauses are optional, and .InSequence()/.After()/
56 // .WillOnce() can appear any number of times.
57
58 // IWYU pragma: private, include "gmock/gmock.h"
59 // IWYU pragma: friend gmock/.*
60
61 #ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
62 #define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_cxx . . $ `src/external/googletest/googlemock/include/gmock/gmock-spec-builders.h:62:9`!
63
64 #include <cstdint>
65 #include <functional>
66 #include <map>
67 #include <memory>
68 #include <ostream>
69 #include <set>
70 #include <sstream>
71 #include <string>
72 #include <type_traits>
73 #include <utility>
74 #include <vector>
75
76 #include "gmock/gmock-actions.h"cxx . . $ `<file>/src/external/googletest/googlemock/include/gmock/gmock-actions.h`/
77 #include "gmock/gmock-cardinalities.h"cxx . . $ `<file>/src/external/googletest/googlemock/include/gmock/gmock-cardinalities.h`/
78 #include "gmock/gmock-matchers.h"cxx . . $ `<file>/src/external/googletest/googlemock/include/gmock/gmock-matchers.h`/
79 #include "gmock/internal/gmock-internal-utils.h"cxx . . $ `<file>/src/external/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h`/
80 #include "gmock/internal/gmock-port.h"cxx . . $ `<file>/src/external/googletest/googlemock/include/gmock/internal/gmock-port.h`/
81 #include "gtest/gtest.h"cxx . . $ `<file>/src/external/googletest/googletest/include/gtest/gtest.h`/
82
83 #if GTEST_HAS_EXCEPTIONScxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:483:9`!
84 #include <stdexcept> // NOLINT
85 #endif
86
87 GTEST_DISABLE_MSC_WARNINGS_PUSH_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:375:9`!(4251 \
88 /* class A needs to have dll-interface to be used by clients of class B */)
89
90 namespace testingcxx . . $ testing/ {
91
92 // An abstract handle of an expectation.
93 class Expectationcxx . . $ testing/Expectation#;
94
95 // A set of expectation handles.
96 class ExpectationSetcxx . . $ testing/ExpectationSet#;
97
98 // Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
99 // and MUST NOT BE USED IN USER CODE!!!
100 namespace internalcxx . . $ testing/internal/ {
101
102 // Implements a mock function.
103 template <typename F>
104 class FunctionMockercxx . . $ testing/internal/FunctionMocker#;
105
106 // Base class for expectations.
107 class ExpectationBasecxx . . $ testing/internal/ExpectationBase#;
108
109 // Implements an expectation.
110 template <typename F>
111 class TypedExpectationcxx . . $ testing/internal/TypedExpectation#;
112
113 // Helper class for testing the Expectation class template.
114 class ExpectationTestercxx . . $ testing/internal/ExpectationTester#;
115
116 // Helper classes for implementing NiceMock, StrictMock, and NaggyMock.
117 template <typename MockClass>
118 class NiceMockImplcxx . . $ testing/internal/NiceMockImpl#;
119 template <typename MockClass>
120 class StrictMockImplcxx . . $ testing/internal/StrictMockImpl#;
121 template <typename MockClass>
122 class NaggyMockImplcxx . . $ testing/internal/NaggyMockImpl#;
123
124 // Protects the mock object registry (in class Mock), all function
125 // mockers, and all expectations.
126 //
127 // The reason we don't use more fine-grained protection is: when a
128 // mock function Foo() is called, it needs to consult its expectations
129 // to see which one should be picked. If another thread is allowed to
130 // call a mock function (either Foo() or a different one) at the same
131 // time, it could affect the "retired" attributes of Foo()'s
132 // expectations when InSequence() is used, and thus affect which
133 // expectation gets picked. Therefore, we sequence all mock function
134 // calls to ensure the integrity of the mock objects' states.
135 GTEST_API_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:844:9`! GTEST_DECLARE_STATIC_MUTEX_cxx . . $ testing/internal/g_gmock_mutex.(g_gmock_mutex);
136
137 // Abstract base class of FunctionMocker. This is the
138 // type-agnostic part of the function mocker interface. Its pure
139 // virtual methods are implemented by FunctionMocker.
140 class GTEST_API_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:844:9`! UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase# {
141 public:
142 UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedFunctionMockerBase(49f6e7a06ebc5aa8).();
143 virtual ~cxx . . $ testing/internal/UntypedFunctionMockerBase#`~UntypedFunctionMockerBase`(49f6e7a06ebc5aa8).UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase#();
144
145 // Verifies that all expectations on this mock function have been
146 // satisfied. Reports one or more Google Test non-fatal failures
147 // and returns false if not.
148 bool VerifyAndClearExpectationsLockedcxx . . $ testing/internal/UntypedFunctionMockerBase#VerifyAndClearExpectationsLocked(c9857a73d68e59ba).()
149 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex);
150
151 // Clears the ON_CALL()s set on this mock function.
152 virtual void ClearDefaultActionsLockedcxx . . $ testing/internal/UntypedFunctionMockerBase#ClearDefaultActionsLocked(49f6e7a06ebc5aa8).()
153 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) = 0;
154
155 // In all of the following Untyped* functions, it's the caller's
156 // responsibility to guarantee the correctness of the arguments'
157 // types.
158
159 // Writes a message that the call is uninteresting (i.e. neither
160 // explicitly expected nor explicitly unexpected) to the given
161 // ostream.
162 virtual void UntypedDescribeUninterestingCallcxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedDescribeUninterestingCall(a94ecf7da2f13db4).(const void* untyped_args,
163 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os) const
164 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex) = 0;
165
166 // Returns the expectation that matches the given function arguments
167 // (or NULL is there's no match); when a match is found,
168 // untyped_action is set to point to the action that should be
169 // performed (or NULL if the action is "do default"), and
170 // is_excessive is modified to indicate whether the call exceeds the
171 // expected number.
172 virtual const ExpectationBasecxx . . $ testing/internal/ExpectationBase#* UntypedFindMatchingExpectationcxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedFindMatchingExpectation(43a714f85d03c494).(
173 const void* untyped_args, const void** untyped_action, bool* is_excessive,
174 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* what, ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* why)
175 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex) = 0;
176
177 // Prints the given function arguments to the ostream.
178 virtual void UntypedPrintArgscxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedPrintArgs(a94ecf7da2f13db4).(const void* untyped_args,
179 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os) const = 0;
180
181 // Sets the mock object this mock method belongs to, and registers
182 // this information in the global mock registry. Will be called
183 // whenever an EXPECT_CALL() or ON_CALL() is executed on this mock
184 // method.
185 void RegisterOwnercxx . . $ testing/internal/UntypedFunctionMockerBase#RegisterOwner(e4289f82fef2c2f9).(const void* mock_obj) GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex);
186
187 // Sets the mock object this mock method belongs to, and sets the
188 // name of the mock function. Will be called upon each invocation
189 // of this mock function.
190 void SetOwnerAndNamecxx . . $ testing/internal/UntypedFunctionMockerBase#SetOwnerAndName(33a902498bf7c942).(const void* mock_obj, const char* name)
191 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex);
192
193 // Returns the mock object this mock method belongs to. Must be
194 // called after RegisterOwner() or SetOwnerAndName() has been
195 // called.
196 const void* MockObjectcxx . . $ testing/internal/UntypedFunctionMockerBase#MockObject(3a8ef3fdc6e817ef).() const GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex);
197
198 // Returns the name of this mock method. Must be called after
199 // SetOwnerAndName() has been called.
200 const char* Namecxx . . $ testing/internal/UntypedFunctionMockerBase#Name(a9f41ea0e82d88cf).() const GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex);
201
202 protected:
203 typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<const void*> UntypedOnCallSpecscxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedOnCallSpecs#;
204
205 using UntypedExpectationscxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedExpectations# = stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<ExpectationBasecxx . . $ testing/internal/ExpectationBase#>>;
206
207 struct UninterestingCallCleanupHandlercxx . . $ testing/internal/UntypedFunctionMockerBase#UninterestingCallCleanupHandler#;
208 struct FailureCleanupHandlercxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#;
209
210 // Returns an Expectation object that references and co-owns exp,
211 // which must be an expectation on this mock function.
212 Expectationcxx . . $ testing/Expectation# GetHandleOfcxx . . $ testing/internal/UntypedFunctionMockerBase#GetHandleOf(12b1a0a8e8c45767).(ExpectationBasecxx . . $ testing/internal/ExpectationBase#* exp);
213
214 // Address of the mock object this mock method belongs to. Only
215 // valid after this mock method has been called or
216 // ON_CALL/EXPECT_CALL has been invoked on it.
217 const void* mock_obj_cxx . . $ testing/internal/UntypedFunctionMockerBase#mock_obj_.; // Protected by g_gmock_mutex.
218
219 // Name of the function being mocked. Only valid after this mock
220 // method has been called.
221 const char* name_cxx . . $ testing/internal/UntypedFunctionMockerBase#name_.; // Protected by g_gmock_mutex.
222
223 // All default action specs for this function mocker.
224 UntypedOnCallSpecscxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedOnCallSpecs# untyped_on_call_specs_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_on_call_specs_.;
225
226 // All expectations for this function mocker.
227 //
228 // It's undefined behavior to interleave expectations (EXPECT_CALLs
229 // or ON_CALLs) and mock function calls. Also, the order of
230 // expectations is important. Therefore it's a logic race condition
231 // to read/write untyped_expectations_ concurrently. In order for
232 // tools like tsan to catch concurrent read/write accesses to
233 // untyped_expectations, we deliberately leave accesses to it
234 // unprotected.
235 UntypedExpectationscxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedExpectations# untyped_expectations_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_expectations_.;
236 }; // class UntypedFunctionMockerBase
237
238 // Untyped base class for OnCallSpec<F>.
239 class UntypedOnCallSpecBasecxx . . $ testing/internal/UntypedOnCallSpecBase# {
240 public:
241 // The arguments are the location of the ON_CALL() statement.
242 UntypedOnCallSpecBasecxx . . $ testing/internal/UntypedOnCallSpecBase#UntypedOnCallSpecBase(34d26762b42c433a).(const char* a_file, int a_line)
243 : file_cxx . . $ testing/internal/UntypedOnCallSpecBase#file_.(a_file), line_cxx . . $ testing/internal/UntypedOnCallSpecBase#line_.(a_line), last_clause_cxx . . $ testing/internal/UntypedOnCallSpecBase#last_clause_.(kNonecxx . . $ testing/internal/UntypedOnCallSpecBase#kNone.) {}
244
245 // Where in the source file was the default action spec defined?
246 const char* filecxx . . $ testing/internal/UntypedOnCallSpecBase#file(a9f41ea0e82d88cf).() const { return file_cxx . . $ testing/internal/UntypedOnCallSpecBase#file_.; }
247 int linecxx . . $ testing/internal/UntypedOnCallSpecBase#line(455f465bc33b4cdf).() const { return line_cxx . . $ testing/internal/UntypedOnCallSpecBase#line_.; }
248
249 protected:
250 // Gives each clause in the ON_CALL() statement a name.
251 enum Clausecxx . . $ testing/internal/UntypedOnCallSpecBase#Clause# {
252 // Do not change the order of the enum members! The run-time
253 // syntax checking relies on it.
254 kNonecxx . . $ testing/internal/UntypedOnCallSpecBase#kNone.,
255 kWithcxx . . $ testing/internal/UntypedOnCallSpecBase#kWith.,
256 kWillByDefaultcxx . . $ testing/internal/UntypedOnCallSpecBase#kWillByDefault.
257 };
258
259 // Asserts that the ON_CALL() statement has a certain property.
260 void AssertSpecPropertycxx . . $ testing/internal/UntypedOnCallSpecBase#AssertSpecProperty(f103917cc8525fb6).(bool property,
261 const stdcxx . . $ std/::stringcxx . . $ std/string#& failure_message) const {
262 Assertcxx . . $ testing/internal/Assert(f72e0045939ddf2e).(property, file_cxx . . $ testing/internal/UntypedOnCallSpecBase#file_., line_cxx . . $ testing/internal/UntypedOnCallSpecBase#line_., failure_message);
263 }
264
265 // Expects that the ON_CALL() statement has a certain property.
266 void ExpectSpecPropertycxx . . $ testing/internal/UntypedOnCallSpecBase#ExpectSpecProperty(f103917cc8525fb6).(bool property,
267 const stdcxx . . $ std/::stringcxx . . $ std/string#& failure_message) const {
268 Expectcxx . . $ testing/internal/Expect(f72e0045939ddf2e).(property, file_cxx . . $ testing/internal/UntypedOnCallSpecBase#file_., line_cxx . . $ testing/internal/UntypedOnCallSpecBase#line_., failure_message);
269 }
270
271 const char* file_cxx . . $ testing/internal/UntypedOnCallSpecBase#file_.;
272 int line_cxx . . $ testing/internal/UntypedOnCallSpecBase#line_.;
273
274 // The last clause in the ON_CALL() statement as seen so far.
275 // Initially kNone and changes as the statement is parsed.
276 Clausecxx . . $ testing/internal/UntypedOnCallSpecBase#Clause# last_clause_cxx . . $ testing/internal/UntypedOnCallSpecBase#last_clause_.;
277 }; // class UntypedOnCallSpecBase
278
279 // This template class implements an ON_CALL spec.
280 template <typename F>
281 class OnCallSpeccxx . . $ testing/internal/OnCallSpec# : public UntypedOnCallSpecBasecxx . . $ testing/internal/UntypedOnCallSpecBase# {
282 public:
283 typedef typename Functioncxx . . $ testing/internal/Function#<F>::ArgumentTuple ArgumentTuplecxx . . $ testing/internal/OnCallSpec#ArgumentTuple#;
284 typedef typename Functioncxx . . $ testing/internal/Function#<F>::ArgumentMatcherTuple ArgumentMatcherTuplecxx . . $ testing/internal/OnCallSpec#ArgumentMatcherTuple#;
285
286 // Constructs an OnCallSpec object from the information inside
287 // the parenthesis of an ON_CALL() statement.
288 OnCallSpeccxx . . $ testing/internal/OnCallSpec#`OnCallSpec<F>`(499c5d4a2822b73a).(const char* a_file, int a_line,
289 const ArgumentMatcherTuplecxx . . $ testing/internal/OnCallSpec#ArgumentMatcherTuple#& matchers)
290 : UntypedOnCallSpecBasecxx . . $ testing/internal/UntypedOnCallSpecBase#(a_file, a_line),
291 matchers_cxx . . $ testing/internal/OnCallSpec#matchers_.(matchers),
292 // By default, extra_matcher_ should match anything. However,
293 // we cannot initialize it with _ as that causes ambiguity between
294 // Matcher's copy and move constructor for some argument types.
295 extra_matcher_cxx . . $ testing/internal/OnCallSpec#extra_matcher_.(Acxx . . $ testing/A(7149edf3a1255e15).<const ArgumentTuplecxx . . $ testing/internal/OnCallSpec#ArgumentTuple#&>()) {}
296
297 // Implements the .With() clause.
298 OnCallSpec& Withcxx . . $ testing/internal/OnCallSpec#With(71176a6d9a233b2c).(const Matchercxx . . $ testing/Matcher#<const ArgumentTuplecxx . . $ testing/internal/OnCallSpec#ArgumentTuple#&>& m) {
299 // Makes sure this is called at most once.
300 ExpectSpecPropertycxx . . $ testing/internal/UntypedOnCallSpecBase#ExpectSpecProperty(f103917cc8525fb6).(last_clause_cxx . . $ testing/internal/UntypedOnCallSpecBase#last_clause_. < kWithcxx . . $ testing/internal/UntypedOnCallSpecBase#kWith.,
301 ".With() cannot appear "
302 "more than once in an ON_CALL().");
303 last_clause_cxx . . $ testing/internal/UntypedOnCallSpecBase#last_clause_. = kWithcxx . . $ testing/internal/UntypedOnCallSpecBase#kWith.;
304
305 extra_matcher_cxx . . $ testing/internal/OnCallSpec#extra_matcher_. = m;
306 return *this;
307 }
308
309 // Implements the .WillByDefault() clause.
310 OnCallSpec& WillByDefaultcxx . . $ testing/internal/OnCallSpec#WillByDefault(a2a3cdcf3631fba3).(const Actioncxx . . $ testing/Action#<F>& action) {
311 ExpectSpecPropertycxx . . $ testing/internal/UntypedOnCallSpecBase#ExpectSpecProperty(f103917cc8525fb6).(last_clause_cxx . . $ testing/internal/UntypedOnCallSpecBase#last_clause_. < kWillByDefaultcxx . . $ testing/internal/UntypedOnCallSpecBase#kWillByDefault.,
312 ".WillByDefault() must appear "
313 "exactly once in an ON_CALL().");
314 last_clause_cxx . . $ testing/internal/UntypedOnCallSpecBase#last_clause_. = kWillByDefaultcxx . . $ testing/internal/UntypedOnCallSpecBase#kWillByDefault.;
315
316 ExpectSpecPropertycxx . . $ testing/internal/UntypedOnCallSpecBase#ExpectSpecProperty(f103917cc8525fb6).(!action.IsDoDefault(),
317 "DoDefault() cannot be used in ON_CALL().");
318 action_cxx . . $ testing/internal/OnCallSpec#action_. = action;
319 return *this;
320 }
321
322 // Returns true if and only if the given arguments match the matchers.
323 bool Matchescxx . . $ testing/internal/OnCallSpec#Matches(a63ebbabfeaea7c5).(const ArgumentTuplecxx . . $ testing/internal/OnCallSpec#ArgumentTuple#& args) const {
324 return TupleMatchescxx . . $ testing/internal/TupleMatches(acb94948942028a1).(matchers_cxx . . $ testing/internal/OnCallSpec#matchers_., args) && extra_matcher_cxx . . $ testing/internal/OnCallSpec#extra_matcher_..Matchescxx . . $ testing/internal/MatcherBase#Matches(8877ebe272b9620d).(args);
325 }
326
327 // Returns the action specified by the user.
328 const Actioncxx . . $ testing/Action#<F>& GetActioncxx . . $ testing/internal/OnCallSpec#GetAction(3798827440f9e338).() const {
329 AssertSpecPropertycxx . . $ testing/internal/UntypedOnCallSpecBase#AssertSpecProperty(f103917cc8525fb6).(last_clause_cxx . . $ testing/internal/UntypedOnCallSpecBase#last_clause_. ==cxx . . $ testing/internal/`operator==`(67d151cd10fc7f68). kWillByDefaultcxx . . $ testing/internal/UntypedOnCallSpecBase#kWillByDefault.,
330 ".WillByDefault() must appear exactly "
331 "once in an ON_CALL().");
332 return action_cxx . . $ testing/internal/OnCallSpec#action_.;
333 }
334
335 private:
336 // The information in statement
337 //
338 // ON_CALL(mock_object, Method(matchers))
339 // .With(multi-argument-matcher)
340 // .WillByDefault(action);
341 //
342 // is recorded in the data members like this:
343 //
344 // source file that contains the statement => file_
345 // line number of the statement => line_
346 // matchers => matchers_
347 // multi-argument-matcher => extra_matcher_
348 // action => action_
349 ArgumentMatcherTuplecxx . . $ testing/internal/OnCallSpec#ArgumentMatcherTuple# matchers_cxx . . $ testing/internal/OnCallSpec#matchers_.;
350 Matchercxx . . $ testing/Matcher#<const ArgumentTuplecxx . . $ testing/internal/OnCallSpec#ArgumentTuple#&> extra_matcher_cxx . . $ testing/internal/OnCallSpec#extra_matcher_.;
351 Actioncxx . . $ testing/Action#<F> action_cxx . . $ testing/internal/OnCallSpec#action_.;
352 }; // class OnCallSpec
353
354 // Possible reactions on uninteresting calls.
355 enum CallReactioncxx . . $ testing/internal/CallReaction# {
356 kAllowcxx . . $ testing/internal/kAllow.,
357 kWarncxx . . $ testing/internal/kWarn.,
358 kFailcxx . . $ testing/internal/kFail.,
359 };
360
361 } // namespace internal
362
363 // Utilities for manipulating mock objects.
364 class GTEST_API_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:844:9`! Mockcxx . . $ testing/Mock# {
365 public:
366 // The following public methods can be called concurrently.
367
368 // Tells Google Mock to ignore mock_obj when checking for leaked
369 // mock objects.
370 static void AllowLeakcxx . . $ testing/Mock#AllowLeak(e4289f82fef2c2f9).(const void* mock_obj)
371 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
372
373 // Verifies and clears all expectations on the given mock object.
374 // If the expectations aren't satisfied, generates one or more
375 // Google Test non-fatal failures and returns false.
376 static bool VerifyAndClearExpectationscxx . . $ testing/Mock#VerifyAndClearExpectations(db00c6a08f501612).(void* mock_obj)
377 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
378
379 // Verifies all expectations on the given mock object and clears its
380 // default actions and expectations. Returns true if and only if the
381 // verification was successful.
382 static bool VerifyAndClearcxx . . $ testing/Mock#VerifyAndClear(db00c6a08f501612).(void* mock_obj)
383 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
384
385 // Returns whether the mock was created as a naggy mock (default)
386 static bool IsNaggycxx . . $ testing/Mock#IsNaggy(db00c6a08f501612).(void* mock_obj)
387 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
388 // Returns whether the mock was created as a nice mock
389 static bool IsNicecxx . . $ testing/Mock#IsNice(db00c6a08f501612).(void* mock_obj)
390 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
391 // Returns whether the mock was created as a strict mock
392 static bool IsStrictcxx . . $ testing/Mock#IsStrict(db00c6a08f501612).(void* mock_obj)
393 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
394
395 private:
396 friend class internalcxx . . $ testing/internal/::UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase#;
397
398 // Needed for a function mocker to register itself (so that we know
399 // how to clear a mock object).
400 template <typename F>
401 friend class internalcxx . . $ testing/internal/::FunctionMockercxx . . $ testing/internal/FunctionMocker#;
402
403 template <typename MockClass>
404 friend class internalcxx . . $ testing/internal/::NiceMockImplcxx . . $ testing/internal/NiceMockImpl#;
405 template <typename MockClass>
406 friend class internalcxx . . $ testing/internal/::NaggyMockImplcxx . . $ testing/internal/NaggyMockImpl#;
407 template <typename MockClass>
408 friend class internalcxx . . $ testing/internal/::StrictMockImplcxx . . $ testing/internal/StrictMockImpl#;
409
410 // Tells Google Mock to allow uninteresting calls on the given mock
411 // object.
412 static void AllowUninterestingCallscxx . . $ testing/Mock#AllowUninterestingCalls(2c44cd906ae4e829).(uintptr_tcxx . . $ uintptr_t# mock_obj)
413 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
414
415 // Tells Google Mock to warn the user about uninteresting calls on
416 // the given mock object.
417 static void WarnUninterestingCallscxx . . $ testing/Mock#WarnUninterestingCalls(2c44cd906ae4e829).(uintptr_tcxx . . $ uintptr_t# mock_obj)
418 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
419
420 // Tells Google Mock to fail uninteresting calls on the given mock
421 // object.
422 static void FailUninterestingCallscxx . . $ testing/Mock#FailUninterestingCalls(2c44cd906ae4e829).(uintptr_tcxx . . $ uintptr_t# mock_obj)
423 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
424
425 // Tells Google Mock the given mock object is being destroyed and
426 // its entry in the call-reaction table should be removed.
427 static void UnregisterCallReactioncxx . . $ testing/Mock#UnregisterCallReaction(2c44cd906ae4e829).(uintptr_tcxx . . $ uintptr_t# mock_obj)
428 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
429
430 // Returns the reaction Google Mock will have on uninteresting calls
431 // made on the given mock object.
432 static internalcxx . . $ testing/internal/::CallReactioncxx . . $ testing/internal/CallReaction# GetReactionOnUninterestingCallscxx . . $ testing/Mock#GetReactionOnUninterestingCalls(1c357ff12bdefb06).(
433 const void* mock_obj) GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
434
435 // Verifies that all expectations on the given mock object have been
436 // satisfied. Reports one or more Google Test non-fatal failures
437 // and returns false if not.
438 static bool VerifyAndClearExpectationsLockedcxx . . $ testing/Mock#VerifyAndClearExpectationsLocked(db00c6a08f501612).(void* mock_obj)
439 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(internal::g_gmock_mutex);
440
441 // Clears all ON_CALL()s set on the given mock object.
442 static void ClearDefaultActionsLockedcxx . . $ testing/Mock#ClearDefaultActionsLocked(5d22bdacc48458e8).(void* mock_obj)
443 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(internal::g_gmock_mutex);
444
445 // Registers a mock object and a mock method it owns.
446 static void Registercxx . . $ testing/Mock#Register(40f55432ec43cc40).(const void* mock_obj,
447 internalcxx . . $ testing/internal/::UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase#* mocker)
448 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
449
450 // Tells Google Mock where in the source code mock_obj is used in an
451 // ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this
452 // information helps the user identify which object it is.
453 static void RegisterUseByOnCallOrExpectCallcxx . . $ testing/Mock#RegisterUseByOnCallOrExpectCall(9e2fdd24afadf9a9).(const void* mock_obj,
454 const char* file, int line)
455 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(internal::g_gmock_mutex);
456
457 // Unregisters a mock method; removes the owning mock object from
458 // the registry when the last mock method associated with it has
459 // been unregistered. This is called only in the destructor of
460 // FunctionMocker.
461 static void UnregisterLockedcxx . . $ testing/Mock#UnregisterLocked(b9b61ea223a768f2).(internalcxx . . $ testing/internal/::UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase#* mocker)
462 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(internal::g_gmock_mutex);
463 }; // class Mock
464
465 // An abstract handle of an expectation. Useful in the .After()
466 // clause of EXPECT_CALL() for setting the (partial) order of
467 // expectations. The syntax:
468 //
469 // Expectation e1 = EXPECT_CALL(...)...;
470 // EXPECT_CALL(...).After(e1)...;
471 //
472 // sets two expectations where the latter can only be matched after
473 // the former has been satisfied.
474 //
475 // Notes:
476 // - This class is copyable and has value semantics.
477 // - Constness is shallow: a const Expectation object itself cannot
478 // be modified, but the mutable methods of the ExpectationBase
479 // object it references can be called via expectation_base().
480
481 class GTEST_API_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:844:9`! Expectationcxx . . $ testing/Expectation# {
482 public:
483 // Constructs a null object that doesn't reference any expectation.
484 Expectationcxx . . $ testing/Expectation#Expectation(49f6e7a06ebc5aa8).();
485 Expectationcxx . . $ testing/Expectation#Expectation(3ef4a824d31daad6).(Expectationcxx . . $ testing/Expectation#&&) = default;
486 Expectationcxx . . $ testing/Expectation#Expectation(1d65c3970b08b52).(const Expectationcxx . . $ testing/Expectation#&) = default;
487 Expectationcxx . . $ testing/Expectation#& operatorcxx . . $ testing/Expectation#`operator=`(b5ae4f796affd6ec).=(Expectationcxx . . $ testing/Expectation#&&) = default;
488 Expectationcxx . . $ testing/Expectation#& operatorcxx . . $ testing/Expectation#`operator=`(f3056c52f1cb0cdd).=(const Expectationcxx . . $ testing/Expectation#&) = default;
489 ~cxx . . $ testing/Expectation#`~Expectation`(ced63f7c635d850d).Expectationcxx . . $ testing/Expectation#();
490
491 // This single-argument ctor must not be explicit, in order to support the
492 // Expectation e = EXPECT_CALL(...);
493 // syntax.
494 //
495 // A TypedExpectation object stores its pre-requisites as
496 // Expectation objects, and needs to call the non-const Retire()
497 // method on the ExpectationBase objects they reference. Therefore
498 // Expectation must receive a *non-const* reference to the
499 // ExpectationBase object.
500 Expectationcxx . . $ testing/Expectation#Expectation(707f32d011ded14c).(internalcxx . . $ testing/internal/::ExpectationBasecxx . . $ testing/internal/ExpectationBase#& exp); // NOLINT
501
502 // The compiler-generated copy ctor and operator= work exactly as
503 // intended, so we don't need to define our own.
504
505 // Returns true if and only if rhs references the same expectation as this
506 // object does.
507 bool operatorcxx . . $ testing/Expectation#`operator==`(a555d769d21641c0).==(const Expectationcxx . . $ testing/Expectation#& rhs) const {
508 return expectation_base_cxx . . $ testing/Expectation#expectation_base_. ==cxx . . $ std/`operator==`(d621a01e6852c7f3). rhs.expectation_base_cxx . . $ testing/Expectation#expectation_base_.;
509 }
510
511 bool operatorcxx . . $ testing/Expectation#`operator!=`(a555d769d21641c0).!=(const Expectationcxx . . $ testing/Expectation#& rhs) const { return !(*this ==cxx . . $ testing/Expectation#`operator==`(a555d769d21641c0). rhs); }
512
513 private:
514 friend class ExpectationSetcxx . . $ testing/ExpectationSet#;
515 friend class Sequencecxx . . $ testing/Sequence#;
516 friend class ::testingcxx . . $ testing/::internalcxx . . $ testing/internal/::ExpectationBasecxx . . $ testing/internal/ExpectationBase#;
517 friend class ::testingcxx . . $ testing/::internalcxx . . $ testing/internal/::UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase#;
518
519 template <typename F>
520 friend class ::testingcxx . . $ testing/::internalcxx . . $ testing/internal/::FunctionMockercxx . . $ testing/internal/FunctionMocker#;
521
522 template <typename F>
523 friend class ::testingcxx . . $ testing/::internalcxx . . $ testing/internal/::TypedExpectationcxx . . $ testing/internal/TypedExpectation#;
524
525 // This comparator is needed for putting Expectation objects into a set.
526 class Lesscxx . . $ testing/Expectation#Less# {
527 public:
528 bool operatorcxx . . $ testing/Expectation#Less#`operator()`(742fe7e48bfd0e4e).()(const Expectationcxx . . $ testing/Expectation#& lhs, const Expectationcxx . . $ testing/Expectation#& rhs) const {
529 return lhs.expectation_base_cxx . . $ testing/Expectation#expectation_base_..getcxx . . $ std/__shared_ptr#get(68fd140ff244f535).() < rhs.expectation_base_cxx . . $ testing/Expectation#expectation_base_..getcxx . . $ std/__shared_ptr#get(68fd140ff244f535).();
530 }
531 };
532
533 typedef ::stdcxx . . $ std/::setcxx . . $ std/set#<Expectationcxx . . $ testing/Expectation#, Lesscxx . . $ testing/Expectation#Less#> Setcxx . . $ testing/Expectation#Set#;
534
535 Expectationcxx . . $ testing/Expectation#Expectation(403a5e975b8e64b5).(
536 const stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<internalcxx . . $ testing/internal/::ExpectationBasecxx . . $ testing/internal/ExpectationBase#>& expectation_base);
537
538 // Returns the expectation this object references.
539 const stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<internalcxx . . $ testing/internal/::ExpectationBasecxx . . $ testing/internal/ExpectationBase#>& expectation_basecxx . . $ testing/Expectation#expectation_base(1ba548a909ff7ac8).() const {
540 return expectation_base_cxx . . $ testing/Expectation#expectation_base_.;
541 }
542
543 // A shared_ptr that co-owns the expectation this handle references.
544 stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<internalcxx . . $ testing/internal/::ExpectationBasecxx . . $ testing/internal/ExpectationBase#> expectation_base_cxx . . $ testing/Expectation#expectation_base_.;
545 };
546
547 // A set of expectation handles. Useful in the .After() clause of
548 // EXPECT_CALL() for setting the (partial) order of expectations. The
549 // syntax:
550 //
551 // ExpectationSet es;
552 // es += EXPECT_CALL(...)...;
553 // es += EXPECT_CALL(...)...;
554 // EXPECT_CALL(...).After(es)...;
555 //
556 // sets three expectations where the last one can only be matched
557 // after the first two have both been satisfied.
558 //
559 // This class is copyable and has value semantics.
560 class ExpectationSetcxx . . $ testing/ExpectationSet# {
561 public:
562 // A bidirectional iterator that can read a const element in the set.
563 typedef Expectationcxx . . $ testing/Expectation#::Setcxx . . $ testing/Expectation#Set#::const_iteratorcxx . . $ std/set#const_iterator# const_iteratorcxx . . $ testing/ExpectationSet#const_iterator#;
564
565 // An object stored in the set. This is an alias of Expectation.
566 typedef Expectationcxx . . $ testing/Expectation#::Setcxx . . $ testing/Expectation#Set#::value_typecxx . . $ std/set#value_type# value_typecxx . . $ testing/ExpectationSet#value_type#;
567
568 // Constructs an empty set.
569 ExpectationSetcxx . . $ testing/ExpectationSet#ExpectationSet(ced63f7c635d850d).() = default;
570
571 // This single-argument ctor must not be explicit, in order to support the
572 // ExpectationSet es = EXPECT_CALL(...);
573 // syntax.
574 ExpectationSetcxx . . $ testing/ExpectationSet#ExpectationSet(707f32d011ded14c).(internalcxx . . $ testing/internal/::ExpectationBasecxx . . $ testing/internal/ExpectationBase#& exp) { // NOLINT
575 *this +=cxx . . $ testing/ExpectationSet#`operator+=`(5edc877937322ab5). Expectationcxx . . $ testing/Expectation#Expectation(707f32d011ded14c).(exp);
576 }
577
578 // This single-argument ctor implements implicit conversion from
579 // Expectation and thus must not be explicit. This allows either an
580 // Expectation or an ExpectationSet to be used in .After().
581 ExpectationSetcxx . . $ testing/ExpectationSet#ExpectationSet(d2f2cf41e51f806c).(const Expectationcxx . . $ testing/Expectation#& e) { // NOLINT
582 *this +=cxx . . $ testing/ExpectationSet#`operator+=`(5edc877937322ab5). e;
583 }
584
585 // The compiler-generator ctor and operator= works exactly as
586 // intended, so we don't need to define our own.
587
588 // Returns true if and only if rhs contains the same set of Expectation
589 // objects as this does.
590 bool operatorcxx . . $ testing/ExpectationSet#`operator==`(bb3be434bc0316ee).==(const ExpectationSetcxx . . $ testing/ExpectationSet#& rhs) const {
591 return expectations_cxx . . $ testing/ExpectationSet#expectations_. ==cxx . . $ std/`operator==`(c27708345ce5fd4e). rhs.expectations_cxx . . $ testing/ExpectationSet#expectations_.;
592 }
593
594 bool operatorcxx . . $ testing/ExpectationSet#`operator!=`(bb3be434bc0316ee).!=(const ExpectationSetcxx . . $ testing/ExpectationSet#& rhs) const { return !(*this ==cxx . . $ testing/ExpectationSet#`operator==`(bb3be434bc0316ee). rhs); }
595
596 // Implements the syntax
597 // expectation_set += EXPECT_CALL(...);
598 ExpectationSetcxx . . $ testing/ExpectationSet#& operatorcxx . . $ testing/ExpectationSet#`operator+=`(5edc877937322ab5).+=(const Expectationcxx . . $ testing/Expectation#& e) {
599 expectations_cxx . . $ testing/ExpectationSet#expectations_..insertcxx . . $ std/set#insert(411a10a755068dfe).(e);
600 return *this;
601 }
602
603 int sizecxx . . $ testing/ExpectationSet#size(455f465bc33b4cdf).() const { return static_cast<int>(expectations_cxx . . $ testing/ExpectationSet#expectations_..sizecxx . . $ std/set#size(fa801f5ac5d26b4e).()); }
604
605 const_iteratorcxx . . $ testing/ExpectationSet#const_iterator# begincxx . . $ testing/ExpectationSet#begin(993d89c9f833d74f).() const { return expectations_cxx . . $ testing/ExpectationSet#expectations_..begincxx . . $ std/set#begin(3220b82c0db6d2a1).(); }
606 const_iteratorcxx . . $ testing/ExpectationSet#const_iterator# endcxx . . $ testing/ExpectationSet#end(993d89c9f833d74f).() const { return expectations_cxx . . $ testing/ExpectationSet#expectations_..endcxx . . $ std/set#end(3220b82c0db6d2a1).(); }
607
608 private:
609 Expectationcxx . . $ testing/Expectation#::Setcxx . . $ testing/Expectation#Set# expectations_cxx . . $ testing/ExpectationSet#expectations_.;
610 };
611
612 // Sequence objects are used by a user to specify the relative order
613 // in which the expectations should match. They are copyable (we rely
614 // on the compiler-defined copy constructor and assignment operator).
615 class GTEST_API_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:844:9`! Sequencecxx . . $ testing/Sequence# {
616 public:
617 // Constructs an empty sequence.
618 Sequencecxx . . $ testing/Sequence#Sequence(49f6e7a06ebc5aa8).() : last_expectation_cxx . . $ std/shared_ptr#shared_ptr(7e6e718d4f0ca9be).(new Expectationcxx . . $ testing/Expectation#Expectation(49f6e7a06ebc5aa8).) {}
619
620 // Adds an expectation to this sequence. The caller must ensure
621 // that no other thread is accessing this Sequence object.
622 void AddExpectationcxx . . $ testing/Sequence#AddExpectation(eaeee4810625b545).(const Expectationcxx . . $ testing/Expectation#& expectation) const;
623
624 private:
625 // The last expectation in this sequence.
626 stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<Expectationcxx . . $ testing/Expectation#> last_expectation_cxx . . $ testing/Sequence#last_expectation_.;
627 }; // class Sequence
628
629 // An object of this type causes all EXPECT_CALL() statements
630 // encountered in its scope to be put in an anonymous sequence. The
631 // work is done in the constructor and destructor. You should only
632 // create an InSequence object on the stack.
633 //
634 // The sole purpose for this class is to support easy definition of
635 // sequential expectations, e.g.
636 //
637 // {
638 // InSequence dummy; // The name of the object doesn't matter.
639 //
640 // // The following expectations must match in the order they appear.
641 // EXPECT_CALL(a, Bar())...;
642 // EXPECT_CALL(a, Baz())...;
643 // ...
644 // EXPECT_CALL(b, Xyz())...;
645 // }
646 //
647 // You can create InSequence objects in multiple threads, as long as
648 // they are used to affect different mock objects. The idea is that
649 // each thread can create and set up its own mocks as if it's the only
650 // thread. However, for clarity of your tests we recommend you to set
651 // up mocks in the main thread unless you have a good reason not to do
652 // so.
653 class GTEST_API_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:844:9`! InSequencecxx . . $ testing/InSequence# {
654 public:
655 InSequencecxx . . $ testing/InSequence#InSequence(49f6e7a06ebc5aa8).();
656 ~cxx . . $ testing/InSequence#`~InSequence`(49f6e7a06ebc5aa8).InSequencecxx . . $ testing/InSequence#();
657
658 private:
659 bool sequence_created_cxx . . $ testing/InSequence#sequence_created_.;
660
661 InSequencecxx . . $ testing/InSequence#InSequence(8a3c15976e8b050d).(const InSequencecxx . . $ testing/InSequence#&) = delete;
662 InSequencecxx . . $ testing/InSequence#& operatorcxx . . $ testing/InSequence#`operator=`(6fe89b493e6d7986).=(const InSequencecxx . . $ testing/InSequence#&) = delete;
663 };
664
665 namespace internalcxx . . $ testing/internal/ {
666
667 // Points to the implicit sequence introduced by a living InSequence
668 // object (if any) in the current thread or NULL.
669 GTEST_API_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:844:9`! extern ThreadLocalcxx . . $ testing/internal/ThreadLocal#<Sequencecxx . . $ testing/Sequence#*> g_gmock_implicit_sequencecxx . . $ testing/internal/g_gmock_implicit_sequence.;
670
671 // Base class for implementing expectations.
672 //
673 // There are two reasons for having a type-agnostic base class for
674 // Expectation:
675 //
676 // 1. We need to store collections of expectations of different
677 // types (e.g. all pre-requisites of a particular expectation, all
678 // expectations in a sequence). Therefore these expectation objects
679 // must share a common base class.
680 //
681 // 2. We can avoid binary code bloat by moving methods not depending
682 // on the template argument of Expectation to the base class.
683 //
684 // This class is internal and mustn't be used by user code directly.
685 class GTEST_API_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:844:9`! ExpectationBasecxx . . $ testing/internal/ExpectationBase# {
686 public:
687 // source_text is the EXPECT_CALL(...) source that created this Expectation.
688 ExpectationBasecxx . . $ testing/internal/ExpectationBase#ExpectationBase(a30737d7380ac3c6).(const char* file, int line, const stdcxx . . $ std/::stringcxx . . $ std/string#& source_text);
689
690 virtual ~cxx . . $ testing/internal/ExpectationBase#`~ExpectationBase`(49f6e7a06ebc5aa8).ExpectationBasecxx . . $ testing/internal/ExpectationBase#();
691
692 // Where in the source file was the expectation spec defined?
693 const char* filecxx . . $ testing/internal/ExpectationBase#file(a9f41ea0e82d88cf).() const { return file_cxx . . $ testing/internal/ExpectationBase#file_.; }
694 int linecxx . . $ testing/internal/ExpectationBase#line(455f465bc33b4cdf).() const { return line_cxx . . $ testing/internal/ExpectationBase#line_.; }
695 const char* source_textcxx . . $ testing/internal/ExpectationBase#source_text(a9f41ea0e82d88cf).() const { return source_text_cxx . . $ testing/internal/ExpectationBase#source_text_..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(); }
696 // Returns the cardinality specified in the expectation spec.
697 const Cardinalitycxx . . $ testing/Cardinality#& cardinalitycxx . . $ testing/internal/ExpectationBase#cardinality(fa9518326bb5533b).() const { return cardinality_cxx . . $ testing/internal/ExpectationBase#cardinality_.; }
698
699 // Describes the source file location of this expectation.
700 void DescribeLocationTocxx . . $ testing/internal/ExpectationBase#DescribeLocationTo(7b1875f5045e6781).(::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os) const {
701 *os <<cxx . . $ std/`operator<<`(88df5bef833f7f83). FormatFileLocationcxx . . $ testing/internal/FormatFileLocation(a4045e16862dad42).(filecxx . . $ testing/internal/ExpectationBase#file(a9f41ea0e82d88cf).(), linecxx . . $ testing/internal/ExpectationBase#line(455f465bc33b4cdf).()) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " ";
702 }
703
704 // Describes how many times a function call matching this
705 // expectation has occurred.
706 void DescribeCallCountTocxx . . $ testing/internal/ExpectationBase#DescribeCallCountTo(7b1875f5045e6781).(::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os) const
707 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex);
708
709 // If this mock method has an extra matcher (i.e. .With(matcher)),
710 // describes it to the ostream.
711 virtual void MaybeDescribeExtraMatcherTocxx . . $ testing/internal/ExpectationBase#MaybeDescribeExtraMatcherTo(5d3481b062d90072).(::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os) = 0;
712
713 // Do not rely on this for correctness.
714 // This is only for making human-readable test output easier to understand.
715 void UntypedDescriptioncxx . . $ testing/internal/ExpectationBase#UntypedDescription(8d4ab0a187bf9331).(stdcxx . . $ std/::stringcxx . . $ std/string# description) {
716 description_cxx . . $ testing/internal/ExpectationBase#description_. =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(description);
717 }
718
719 protected:
720 friend class ::testingcxx . . $ testing/::Expectationcxx . . $ testing/Expectation#;
721 friend class UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase#;
722
723 enum Clausecxx . . $ testing/internal/ExpectationBase#Clause# {
724 // Don't change the order of the enum members!
725 kNonecxx . . $ testing/internal/ExpectationBase#kNone.,
726 kWithcxx . . $ testing/internal/ExpectationBase#kWith.,
727 kTimescxx . . $ testing/internal/ExpectationBase#kTimes.,
728 kInSequencecxx . . $ testing/internal/ExpectationBase#kInSequence.,
729 kAftercxx . . $ testing/internal/ExpectationBase#kAfter.,
730 kWillOncecxx . . $ testing/internal/ExpectationBase#kWillOnce.,
731 kWillRepeatedlycxx . . $ testing/internal/ExpectationBase#kWillRepeatedly.,
732 kRetiresOnSaturationcxx . . $ testing/internal/ExpectationBase#kRetiresOnSaturation.
733 };
734
735 typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<const void*> UntypedActionscxx . . $ testing/internal/ExpectationBase#UntypedActions#;
736
737 // Returns an Expectation object that references and co-owns this
738 // expectation.
739 virtual Expectationcxx . . $ testing/Expectation# GetHandlecxx . . $ testing/internal/ExpectationBase#GetHandle(664511b22ed2e5f6).() = 0;
740
741 // Asserts that the EXPECT_CALL() statement has the given property.
742 void AssertSpecPropertycxx . . $ testing/internal/ExpectationBase#AssertSpecProperty(f103917cc8525fb6).(bool property,
743 const stdcxx . . $ std/::stringcxx . . $ std/string#& failure_message) const {
744 Assertcxx . . $ testing/internal/Assert(f72e0045939ddf2e).(property, file_cxx . . $ testing/internal/ExpectationBase#file_., line_cxx . . $ testing/internal/ExpectationBase#line_., failure_message);
745 }
746
747 // Expects that the EXPECT_CALL() statement has the given property.
748 void ExpectSpecPropertycxx . . $ testing/internal/ExpectationBase#ExpectSpecProperty(f103917cc8525fb6).(bool property,
749 const stdcxx . . $ std/::stringcxx . . $ std/string#& failure_message) const {
750 Expectcxx . . $ testing/internal/Expect(f72e0045939ddf2e).(property, file_cxx . . $ testing/internal/ExpectationBase#file_., line_cxx . . $ testing/internal/ExpectationBase#line_., failure_message);
751 }
752
753 // Explicitly specifies the cardinality of this expectation. Used
754 // by the subclasses to implement the .Times() clause.
755 void SpecifyCardinalitycxx . . $ testing/internal/ExpectationBase#SpecifyCardinality(c7f9e03cf4c2f7b2).(const Cardinalitycxx . . $ testing/Cardinality#& cardinality);
756
757 // Returns true if and only if the user specified the cardinality
758 // explicitly using a .Times().
759 bool cardinality_specifiedcxx . . $ testing/internal/ExpectationBase#cardinality_specified(50ce9a9e25b4a850).() const { return cardinality_specified_cxx . . $ testing/internal/ExpectationBase#cardinality_specified_.; }
760
761 // Sets the cardinality of this expectation spec.
762 void set_cardinalitycxx . . $ testing/internal/ExpectationBase#set_cardinality(c7f9e03cf4c2f7b2).(const Cardinalitycxx . . $ testing/Cardinality#& a_cardinality) {
763 cardinality_cxx . . $ testing/internal/ExpectationBase#cardinality_. =cxx . . $ testing/Cardinality#`operator=`(256623f566c6b0b8). a_cardinality;
764 }
765
766 // The following group of methods should only be called after the
767 // EXPECT_CALL() statement, and only when g_gmock_mutex is held by
768 // the current thread.
769
770 // Retires all pre-requisites of this expectation.
771 void RetireAllPreRequisitescxx . . $ testing/internal/ExpectationBase#RetireAllPreRequisites(49f6e7a06ebc5aa8).() GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex);
772
773 // Returns true if and only if this expectation is retired.
774 bool is_retiredcxx . . $ testing/internal/ExpectationBase#is_retired(50ce9a9e25b4a850).() const GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
775 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
776 return retired_cxx . . $ testing/internal/ExpectationBase#retired_.;
777 }
778
779 // Retires this expectation.
780 void Retirecxx . . $ testing/internal/ExpectationBase#Retire(49f6e7a06ebc5aa8).() GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
781 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
782 retired_cxx . . $ testing/internal/ExpectationBase#retired_. = true;
783 }
784
785 // Returns a human-readable description of this expectation.
786 // Do not rely on this for correctness. It is only for human readability.
787 const stdcxx . . $ std/::stringcxx . . $ std/string#& GetDescriptioncxx . . $ testing/internal/ExpectationBase#GetDescription(f4fff0029955a25f).() const { return description_cxx . . $ testing/internal/ExpectationBase#description_.; }
788
789 // Returns true if and only if this expectation is satisfied.
790 bool IsSatisfiedcxx . . $ testing/internal/ExpectationBase#IsSatisfied(50ce9a9e25b4a850).() const GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
791 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
792 return cardinalitycxx . . $ testing/internal/ExpectationBase#cardinality(fa9518326bb5533b).().IsSatisfiedByCallCountcxx . . $ testing/Cardinality#IsSatisfiedByCallCount(4a668f6de69bf818).(call_count_cxx . . $ testing/internal/ExpectationBase#call_count_.);
793 }
794
795 // Returns true if and only if this expectation is saturated.
796 bool IsSaturatedcxx . . $ testing/internal/ExpectationBase#IsSaturated(50ce9a9e25b4a850).() const GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
797 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
798 return cardinalitycxx . . $ testing/internal/ExpectationBase#cardinality(fa9518326bb5533b).().IsSaturatedByCallCountcxx . . $ testing/Cardinality#IsSaturatedByCallCount(4a668f6de69bf818).(call_count_cxx . . $ testing/internal/ExpectationBase#call_count_.);
799 }
800
801 // Returns true if and only if this expectation is over-saturated.
802 bool IsOverSaturatedcxx . . $ testing/internal/ExpectationBase#IsOverSaturated(50ce9a9e25b4a850).() const GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
803 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
804 return cardinalitycxx . . $ testing/internal/ExpectationBase#cardinality(fa9518326bb5533b).().IsOverSaturatedByCallCountcxx . . $ testing/Cardinality#IsOverSaturatedByCallCount(4a668f6de69bf818).(call_count_cxx . . $ testing/internal/ExpectationBase#call_count_.);
805 }
806
807 // Returns true if and only if all pre-requisites of this expectation are
808 // satisfied.
809 bool AllPrerequisitesAreSatisfiedcxx . . $ testing/internal/ExpectationBase#AllPrerequisitesAreSatisfied(50ce9a9e25b4a850).() const
810 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex);
811
812 // Adds unsatisfied pre-requisites of this expectation to 'result'.
813 void FindUnsatisfiedPrerequisitescxx . . $ testing/internal/ExpectationBase#FindUnsatisfiedPrerequisites(eca8dd495df6b951).(ExpectationSetcxx . . $ testing/ExpectationSet#* result) const
814 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex);
815
816 // Returns the number this expectation has been invoked.
817 int call_countcxx . . $ testing/internal/ExpectationBase#call_count(455f465bc33b4cdf).() const GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
818 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
819 return call_count_cxx . . $ testing/internal/ExpectationBase#call_count_.;
820 }
821
822 // Increments the number this expectation has been invoked.
823 void IncrementCallCountcxx . . $ testing/internal/ExpectationBase#IncrementCallCount(49f6e7a06ebc5aa8).() GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
824 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
825 call_count_cxx . . $ testing/internal/ExpectationBase#call_count_.++;
826 }
827
828 // Checks the action count (i.e. the number of WillOnce() and
829 // WillRepeatedly() clauses) against the cardinality if this hasn't
830 // been done before. Prints a warning if there are too many or too
831 // few actions.
832 void CheckActionCountIfNotDonecxx . . $ testing/internal/ExpectationBase#CheckActionCountIfNotDone(83f5f38750778ac8).() const GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(mutex_);
833
834 friend class ::testingcxx . . $ testing/::Sequencecxx . . $ testing/Sequence#;
835 friend class ::testingcxx . . $ testing/::internalcxx . . $ testing/internal/::ExpectationTestercxx . . $ testing/internal/ExpectationTester#;
836
837 template <typename Function>
838 friend class TypedExpectationcxx . . $ testing/internal/TypedExpectation#;
839
840 // Implements the .Times() clause.
841 void UntypedTimescxx . . $ testing/internal/ExpectationBase#UntypedTimes(c7f9e03cf4c2f7b2).(const Cardinalitycxx . . $ testing/Cardinality#& a_cardinality);
842
843 // This group of fields are part of the spec and won't change after
844 // an EXPECT_CALL() statement finishes.
845 const char* file_cxx . . $ testing/internal/ExpectationBase#file_.; // The file that contains the expectation.
846 int line_cxx . . $ testing/internal/ExpectationBase#line_.; // The line number of the expectation.
847 const stdcxx . . $ std/::stringcxx . . $ std/string# source_text_cxx . . $ testing/internal/ExpectationBase#source_text_.; // The EXPECT_CALL(...) source text.
848 stdcxx . . $ std/::stringcxx . . $ std/string# description_cxx . . $ testing/internal/ExpectationBase#description_.; // User-readable name for the expectation.
849 // True if and only if the cardinality is specified explicitly.
850 bool cardinality_specified_cxx . . $ testing/internal/ExpectationBase#cardinality_specified_.;
851 Cardinalitycxx . . $ testing/Cardinality# cardinality_cxx . . $ testing/internal/ExpectationBase#cardinality_.; // The cardinality of the expectation.
852 // The immediate pre-requisites (i.e. expectations that must be
853 // satisfied before this expectation can be matched) of this
854 // expectation. We use std::shared_ptr in the set because we want an
855 // Expectation object to be co-owned by its FunctionMocker and its
856 // successors. This allows multiple mock objects to be deleted at
857 // different times.
858 ExpectationSetcxx . . $ testing/ExpectationSet# immediate_prerequisites_cxx . . $ testing/internal/ExpectationBase#immediate_prerequisites_.;
859
860 // This group of fields are the current state of the expectation,
861 // and can change as the mock function is called.
862 int call_count_cxx . . $ testing/internal/ExpectationBase#call_count_.; // How many times this expectation has been invoked.
863 bool retired_cxx . . $ testing/internal/ExpectationBase#retired_.; // True if and only if this expectation has retired.
864 UntypedActionscxx . . $ testing/internal/ExpectationBase#UntypedActions# untyped_actions_cxx . . $ testing/internal/ExpectationBase#untyped_actions_.;
865 bool extra_matcher_specified_cxx . . $ testing/internal/ExpectationBase#extra_matcher_specified_.;
866 bool repeated_action_specified_cxx . . $ testing/internal/ExpectationBase#repeated_action_specified_.; // True if a WillRepeatedly() was specified.
867 bool retires_on_saturation_cxx . . $ testing/internal/ExpectationBase#retires_on_saturation_.;
868 Clausecxx . . $ testing/internal/ExpectationBase#Clause# last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_.;
869 mutable bool action_count_checked_cxx . . $ testing/internal/ExpectationBase#action_count_checked_.; // Under mutex_.
870 mutable Mutexcxx . . $ testing/internal/Mutex# mutex_cxx . . $ testing/internal/ExpectationBase#mutex_.; // Protects action_count_checked_.
871 }; // class ExpectationBase
872
873 template <typename F>
874 class TypedExpectationcxx . . $ testing/internal/TypedExpectation#;
875
876 // Implements an expectation for the given function type.
877 template <typename R, typename... Args>
878 class TypedExpectationcxx . . $ testing/internal/TypedExpectation#<R(Args...)> : public ExpectationBasecxx . . $ testing/internal/ExpectationBase# {
879 private:
880 using Fcxx . . $ testing/internal/TypedExpectation#F# = R(Args...);
881
882 public:
883 typedef typename Functioncxx . . $ testing/internal/Function#<F>::ArgumentTuple ArgumentTuplecxx . . $ testing/internal/TypedExpectation#ArgumentTuple#;
884 typedef typename Functioncxx . . $ testing/internal/Function#<F>::ArgumentMatcherTuple ArgumentMatcherTuplecxx . . $ testing/internal/TypedExpectation#ArgumentMatcherTuple#;
885 typedef typename Functioncxx . . $ testing/internal/Function#<F>::Result Resultcxx . . $ testing/internal/TypedExpectation#Result#;
886
887 TypedExpectationcxx . . $ testing/internal/TypedExpectation#`TypedExpectation<R (Args...)>`(1df72c62e59817b5).(FunctionMockercxx . . $ testing/internal/FunctionMocker#<Fcxx . . $ testing/internal/TypedExpectation#F#>* owner, const char* a_file, int a_line,
888 const stdcxx . . $ std/::stringcxx . . $ std/string#& a_source_text,
889 const ArgumentMatcherTuplecxx . . $ testing/internal/TypedExpectation#ArgumentMatcherTuple#& m)
890 : ExpectationBasecxx . . $ testing/internal/ExpectationBase#(a_file, a_line, a_source_text),
891 owner_cxx . . $ testing/internal/TypedExpectation#owner_.(owner),
892 matchers_cxx . . $ testing/internal/TypedExpectation#matchers_.(m),
893 // By default, extra_matcher_ should match anything. However,
894 // we cannot initialize it with _ as that causes ambiguity between
895 // Matcher's copy and move constructor for some argument types.
896 extra_matcher_cxx . . $ testing/internal/TypedExpectation#extra_matcher_.(Acxx . . $ testing/A(7149edf3a1255e15).<const ArgumentTuplecxx . . $ testing/internal/TypedExpectation#ArgumentTuple#&>()),
897 repeated_action_cxx . . $ testing/internal/TypedExpectation#repeated_action_.(DoDefaultcxx . . $ testing/DoDefault(c974be13ff1d6259).()) {}
898
899 ~cxx . . $ testing/internal/TypedExpectation#`~TypedExpectation<R (Args...)>`(49f6e7a06ebc5aa8).TypedExpectation() override {
900 // Check the validity of the action count if it hasn't been done
901 // yet (for example, if the expectation was never used).
902 CheckActionCountIfNotDonecxx . . $ testing/internal/ExpectationBase#CheckActionCountIfNotDone(83f5f38750778ac8).();
903 for (UntypedActionscxx . . $ testing/internal/ExpectationBase#UntypedActions#::const_iteratorcxx . . $ std/vector#const_iterator# it = untyped_actions_cxx . . $ testing/internal/ExpectationBase#untyped_actions_..begincxx . . $ std/vector#begin(d1e1699016b9d7e6).();
904 it !=cxx . . $ testing/internal/`operator!=`(67d151cd10fc7f68). untyped_actions_cxx . . $ testing/internal/ExpectationBase#untyped_actions_..endcxx . . $ std/vector#end(d1e1699016b9d7e6).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) {
905 delete static_cast<const Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/TypedExpectation#F#>*>(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(f9c37c6e427d43d6).it);
906 }
907 }
908
909 // Implements the .With() clause.
910 TypedExpectation& Withcxx . . $ testing/internal/TypedExpectation#With(6a275f5643697c82).(const Matchercxx . . $ testing/Matcher#<const ArgumentTuplecxx . . $ testing/internal/TypedExpectation#ArgumentTuple#&>& m) {
911 if (last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. ==cxx . . $ testing/internal/`operator==`(67d151cd10fc7f68). kWithcxx . . $ testing/internal/ExpectationBase#kWith.) {
912 ExpectSpecPropertycxx . . $ testing/internal/ExpectationBase#ExpectSpecProperty(f103917cc8525fb6).(false,
913 ".With() cannot appear "
914 "more than once in an EXPECT_CALL().");
915 } else {
916 ExpectSpecPropertycxx . . $ testing/internal/ExpectationBase#ExpectSpecProperty(f103917cc8525fb6).(last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. < kWithcxx . . $ testing/internal/ExpectationBase#kWith.,
917 ".With() must be the first "
918 "clause in an EXPECT_CALL().");
919 }
920 last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. = kWithcxx . . $ testing/internal/ExpectationBase#kWith.;
921
922 extra_matcher_cxx . . $ testing/internal/TypedExpectation#extra_matcher_. = m;
923 extra_matcher_specified_cxx . . $ testing/internal/ExpectationBase#extra_matcher_specified_. = true;
924 return *this;
925 }
926
927 // Do not rely on this for correctness.
928 // This is only for making human-readable test output easier to understand.
929 TypedExpectation& Descriptioncxx . . $ testing/internal/TypedExpectation#Description(6b156ca4143d6dcf).(stdcxx . . $ std/::stringcxx . . $ std/string# name) {
930 ExpectationBasecxx . . $ testing/internal/ExpectationBase#::UntypedDescriptioncxx . . $ testing/internal/ExpectationBase#UntypedDescription(8d4ab0a187bf9331).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(name));
931 return *this;
932 }
933
934 // Implements the .Times() clause.
935 TypedExpectation& Timescxx . . $ testing/internal/TypedExpectation#Times(5cd32a1a2d0c80e3).(const Cardinalitycxx . . $ testing/Cardinality#& a_cardinality) {
936 ExpectationBasecxx . . $ testing/internal/ExpectationBase#::UntypedTimescxx . . $ testing/internal/ExpectationBase#UntypedTimes(c7f9e03cf4c2f7b2).(a_cardinality);
937 return *this;
938 }
939
940 // Implements the .Times() clause.
941 TypedExpectation& Timescxx . . $ testing/internal/TypedExpectation#Times(b2138ddaba8204d2).(int n) { return Times(Exactlycxx . . $ testing/Exactly(deb93fef430aec80).(n)); }
942
943 // Implements the .InSequence() clause.
944 TypedExpectation& InSequencecxx . . $ testing/internal/TypedExpectation#InSequence(aa053efcd9405d90).(const Sequencecxx . . $ testing/Sequence#& s) {
945 ExpectSpecPropertycxx . . $ testing/internal/ExpectationBase#ExpectSpecProperty(f103917cc8525fb6).(last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. <= kInSequencecxx . . $ testing/internal/ExpectationBase#kInSequence.,
946 ".InSequence() cannot appear after .After(),"
947 " .WillOnce(), .WillRepeatedly(), or "
948 ".RetiresOnSaturation().");
949 last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. = kInSequencecxx . . $ testing/internal/ExpectationBase#kInSequence.;
950
951 s.AddExpectationcxx . . $ testing/Sequence#AddExpectation(eaeee4810625b545).(GetHandlecxx . . $ testing/internal/TypedExpectation#GetHandle(664511b22ed2e5f6).());
952 return *this;
953 }
954 TypedExpectation& InSequencecxx . . $ testing/internal/TypedExpectation#InSequence(5c2e4d302ec5674).(const Sequencecxx . . $ testing/Sequence#& s1, const Sequencecxx . . $ testing/Sequence#& s2) {
955 return InSequence(s1).InSequence(s2);
956 }
957 TypedExpectation& InSequencecxx . . $ testing/internal/TypedExpectation#InSequence(3dc6bf732b52fcfc).(const Sequencecxx . . $ testing/Sequence#& s1, const Sequencecxx . . $ testing/Sequence#& s2,
958 const Sequencecxx . . $ testing/Sequence#& s3) {
959 return InSequence(s1, s2).InSequence(s3);
960 }
961 TypedExpectation& InSequencecxx . . $ testing/internal/TypedExpectation#InSequence(afa966a59c36f63e).(const Sequencecxx . . $ testing/Sequence#& s1, const Sequencecxx . . $ testing/Sequence#& s2,
962 const Sequencecxx . . $ testing/Sequence#& s3, const Sequencecxx . . $ testing/Sequence#& s4) {
963 return InSequence(s1, s2, s3).InSequence(s4);
964 }
965 TypedExpectation& InSequencecxx . . $ testing/internal/TypedExpectation#InSequence(a96f70fb64d61e8c).(const Sequencecxx . . $ testing/Sequence#& s1, const Sequencecxx . . $ testing/Sequence#& s2,
966 const Sequencecxx . . $ testing/Sequence#& s3, const Sequencecxx . . $ testing/Sequence#& s4,
967 const Sequencecxx . . $ testing/Sequence#& s5) {
968 return InSequence(s1, s2, s3, s4).InSequence(s5);
969 }
970
971 // Implements that .After() clause.
972 TypedExpectation& Aftercxx . . $ testing/internal/TypedExpectation#After(7efdf72eca0c2ef5).(const ExpectationSetcxx . . $ testing/ExpectationSet#& s) {
973 ExpectSpecPropertycxx . . $ testing/internal/ExpectationBase#ExpectSpecProperty(f103917cc8525fb6).(last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. <= kAftercxx . . $ testing/internal/ExpectationBase#kAfter.,
974 ".After() cannot appear after .WillOnce(),"
975 " .WillRepeatedly(), or "
976 ".RetiresOnSaturation().");
977 last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. = kAftercxx . . $ testing/internal/ExpectationBase#kAfter.;
978
979 for (ExpectationSetcxx . . $ testing/ExpectationSet#::const_iteratorcxx . . $ testing/ExpectationSet#const_iterator# it = s.begincxx . . $ testing/ExpectationSet#begin(993d89c9f833d74f).(); it !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). s.endcxx . . $ testing/ExpectationSet#end(993d89c9f833d74f).(); ++cxx . . $ std/_Rb_tree_const_iterator#operator++(9cb79ab07bb244bf).it) {
980 immediate_prerequisites_cxx . . $ testing/internal/ExpectationBase#immediate_prerequisites_. += *cxx . . $ std/_Rb_tree_const_iterator#`operator*`(2042464fc1fea03e).it;
981 }
982 return *this;
983 }
984 TypedExpectation& Aftercxx . . $ testing/internal/TypedExpectation#After(275dbdb1c5858ac6).(const ExpectationSetcxx . . $ testing/ExpectationSet#& s1, const ExpectationSetcxx . . $ testing/ExpectationSet#& s2) {
985 return After(s1).After(s2);
986 }
987 TypedExpectation& Aftercxx . . $ testing/internal/TypedExpectation#After(4ef5bc4c98cef052).(const ExpectationSetcxx . . $ testing/ExpectationSet#& s1, const ExpectationSetcxx . . $ testing/ExpectationSet#& s2,
988 const ExpectationSetcxx . . $ testing/ExpectationSet#& s3) {
989 return After(s1, s2).After(s3);
990 }
991 TypedExpectation& Aftercxx . . $ testing/internal/TypedExpectation#After(724d90339412487c).(const ExpectationSetcxx . . $ testing/ExpectationSet#& s1, const ExpectationSetcxx . . $ testing/ExpectationSet#& s2,
992 const ExpectationSetcxx . . $ testing/ExpectationSet#& s3, const ExpectationSetcxx . . $ testing/ExpectationSet#& s4) {
993 return After(s1, s2, s3).After(s4);
994 }
995 TypedExpectation& Aftercxx . . $ testing/internal/TypedExpectation#After(caef9d24e21d96f).(const ExpectationSetcxx . . $ testing/ExpectationSet#& s1, const ExpectationSetcxx . . $ testing/ExpectationSet#& s2,
996 const ExpectationSetcxx . . $ testing/ExpectationSet#& s3, const ExpectationSetcxx . . $ testing/ExpectationSet#& s4,
997 const ExpectationSetcxx . . $ testing/ExpectationSet#& s5) {
998 return After(s1, s2, s3, s4).After(s5);
999 }
1000
1001 // Preferred, type-safe overload: consume anything that can be directly
1002 // converted to a OnceAction, except for Action<F> objects themselves.
1003 TypedExpectation& WillOncecxx . . $ testing/internal/TypedExpectation#WillOnce(6a716c1a5898315f).(OnceActioncxx . . $ testing/OnceAction#<Fcxx . . $ testing/internal/TypedExpectation#F#> once_action) {
1004 // Call the overload below, smuggling the OnceAction as a copyable callable.
1005 // We know this is safe because a WillOnce action will not be called more
1006 // than once.
1007 return WillOnce(Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/TypedExpectation#F#>(ActionAdaptorcxx . . $ testing/internal/TypedExpectation#ActionAdaptor#{
1008 #ifndef __clang_analyzer__
1009 stdcxx . . $ std/::make_sharedcxx . . $ std/make_shared(ffca0f3977536948).<OnceActioncxx . . $ testing/OnceAction#<Fcxx . . $ testing/internal/TypedExpectation#F#>>(stdcxx . . $ std/::movecxx . . $ std/move(88304b602929f6f4).(once_action)),
1010 #else
1011 nullptr,
1012 #endif
1013 }));
1014 }
1015
1016 // Fallback overload: accept Action<F> objects and those actions that define
1017 // `operator Action<F>` but not `operator OnceAction<F>`.
1018 //
1019 // This is templated in order to cause the overload above to be preferred
1020 // when the input is convertible to either type.
1021 template <int&... ExplicitArgumentBarrier, typename = void>
1022 TypedExpectation& WillOncecxx . . $ testing/internal/TypedExpectation#WillOnce(7364756d137cedbc).(Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/TypedExpectation#F#> action) {
1023 ExpectSpecPropertycxx . . $ testing/internal/ExpectationBase#ExpectSpecProperty(f103917cc8525fb6).(last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. <= kWillOncecxx . . $ testing/internal/ExpectationBase#kWillOnce.,
1024 ".WillOnce() cannot appear after "
1025 ".WillRepeatedly() or .RetiresOnSaturation().");
1026 last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. = kWillOncecxx . . $ testing/internal/ExpectationBase#kWillOnce.;
1027
1028 untyped_actions_cxx . . $ testing/internal/ExpectationBase#untyped_actions_..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(new Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/TypedExpectation#F#>(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(action)));
1029
1030 if (!cardinality_specifiedcxx . . $ testing/internal/ExpectationBase#cardinality_specified(50ce9a9e25b4a850).()) {
1031 set_cardinalitycxx . . $ testing/internal/ExpectationBase#set_cardinality(c7f9e03cf4c2f7b2).(Exactlycxx . . $ testing/Exactly(deb93fef430aec80).(static_cast<int>(untyped_actions_cxx . . $ testing/internal/ExpectationBase#untyped_actions_..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())));
1032 }
1033 return *this;
1034 }
1035
1036 // Implements the .WillRepeatedly() clause.
1037 TypedExpectation& WillRepeatedlycxx . . $ testing/internal/TypedExpectation#WillRepeatedly(9c96c5b2d7a22794).(const Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/TypedExpectation#F#>& action) {
1038 if (last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. ==cxx . . $ testing/internal/`operator==`(67d151cd10fc7f68). kWillRepeatedlycxx . . $ testing/internal/ExpectationBase#kWillRepeatedly.) {
1039 ExpectSpecPropertycxx . . $ testing/internal/ExpectationBase#ExpectSpecProperty(f103917cc8525fb6).(false,
1040 ".WillRepeatedly() cannot appear "
1041 "more than once in an EXPECT_CALL().");
1042 } else {
1043 ExpectSpecPropertycxx . . $ testing/internal/ExpectationBase#ExpectSpecProperty(f103917cc8525fb6).(last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. < kWillRepeatedlycxx . . $ testing/internal/ExpectationBase#kWillRepeatedly.,
1044 ".WillRepeatedly() cannot appear "
1045 "after .RetiresOnSaturation().");
1046 }
1047 last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. = kWillRepeatedlycxx . . $ testing/internal/ExpectationBase#kWillRepeatedly.;
1048 repeated_action_specified_cxx . . $ testing/internal/ExpectationBase#repeated_action_specified_. = true;
1049
1050 repeated_action_cxx . . $ testing/internal/TypedExpectation#repeated_action_. = action;
1051 if (!cardinality_specifiedcxx . . $ testing/internal/ExpectationBase#cardinality_specified(50ce9a9e25b4a850).()) {
1052 set_cardinalitycxx . . $ testing/internal/ExpectationBase#set_cardinality(c7f9e03cf4c2f7b2).(AtLeastcxx . . $ testing/AtLeast(deb93fef430aec80).(static_cast<int>(untyped_actions_cxx . . $ testing/internal/ExpectationBase#untyped_actions_..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).())));
1053 }
1054
1055 // Now that no more action clauses can be specified, we check
1056 // whether their count makes sense.
1057 CheckActionCountIfNotDonecxx . . $ testing/internal/ExpectationBase#CheckActionCountIfNotDone(83f5f38750778ac8).();
1058 return *this;
1059 }
1060
1061 // Implements the .RetiresOnSaturation() clause.
1062 TypedExpectation& RetiresOnSaturationcxx . . $ testing/internal/TypedExpectation#RetiresOnSaturation(b8b87923e8a46288).() {
1063 ExpectSpecPropertycxx . . $ testing/internal/ExpectationBase#ExpectSpecProperty(f103917cc8525fb6).(last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. < kRetiresOnSaturationcxx . . $ testing/internal/ExpectationBase#kRetiresOnSaturation.,
1064 ".RetiresOnSaturation() cannot appear "
1065 "more than once.");
1066 last_clause_cxx . . $ testing/internal/ExpectationBase#last_clause_. = kRetiresOnSaturationcxx . . $ testing/internal/ExpectationBase#kRetiresOnSaturation.;
1067 retires_on_saturation_cxx . . $ testing/internal/ExpectationBase#retires_on_saturation_. = true;
1068
1069 // Now that no more action clauses can be specified, we check
1070 // whether their count makes sense.
1071 CheckActionCountIfNotDonecxx . . $ testing/internal/ExpectationBase#CheckActionCountIfNotDone(83f5f38750778ac8).();
1072 return *this;
1073 }
1074
1075 // Returns the matchers for the arguments as specified inside the
1076 // EXPECT_CALL() macro.
1077 const ArgumentMatcherTuplecxx . . $ testing/internal/TypedExpectation#ArgumentMatcherTuple#& matcherscxx . . $ testing/internal/TypedExpectation#matchers(e2321a7597d908ec).() const { return matchers_cxx . . $ testing/internal/TypedExpectation#matchers_.; }
1078
1079 // Returns the matcher specified by the .With() clause.
1080 const Matchercxx . . $ testing/Matcher#<const ArgumentTuplecxx . . $ testing/internal/TypedExpectation#ArgumentTuple#&>& extra_matchercxx . . $ testing/internal/TypedExpectation#extra_matcher(f0fc27705f73427c).() const {
1081 return extra_matcher_cxx . . $ testing/internal/TypedExpectation#extra_matcher_.;
1082 }
1083
1084 // Returns the action specified by the .WillRepeatedly() clause.
1085 const Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/TypedExpectation#F#>& repeated_actioncxx . . $ testing/internal/TypedExpectation#repeated_action(d2dccedc2fab2a51).() const { return repeated_action_cxx . . $ testing/internal/TypedExpectation#repeated_action_.; }
1086
1087 // If this mock method has an extra matcher (i.e. .With(matcher)),
1088 // describes it to the ostream.
1089 void MaybeDescribeExtraMatcherTocxx . . $ testing/internal/TypedExpectation#MaybeDescribeExtraMatcherTo(5d3481b062d90072).(::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os) override {
1090 if (extra_matcher_specified_cxx . . $ testing/internal/ExpectationBase#extra_matcher_specified_.) {
1091 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Expected args: ";
1092 extra_matcher_cxx . . $ testing/internal/TypedExpectation#extra_matcher_..DescribeTocxx . . $ testing/internal/MatcherBase#DescribeTo(7b1875f5045e6781).(os);
1093 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n";
1094 }
1095 }
1096
1097 private:
1098 template <typename Function>
1099 friend class FunctionMockercxx . . $ testing/internal/FunctionMocker#;
1100
1101 // An adaptor that turns a OneAction<F> into something compatible with
1102 // Action<F>. Must be called at most once.
1103 struct ActionAdaptorcxx . . $ testing/internal/TypedExpectation#ActionAdaptor# {
1104 stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<OnceActioncxx . . $ testing/OnceAction#<R(Args...)>> once_actioncxx . . $ testing/internal/TypedExpectation#ActionAdaptor#once_action.;
1105
1106 R operatorcxx . . $ testing/internal/TypedExpectation#ActionAdaptor#`operator()`(b486b8eaffe87236).()(Args&&... args) const {
1107 return stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(*once_actioncxx . . $ testing/internal/TypedExpectation#ActionAdaptor#once_action.).Call(stdcxx . . $ std/::forwardcxx . . $ std/forward(f56228ea88711827).<Args>(args)...);
1108 }
1109 };
1110
1111 // Returns an Expectation object that references and co-owns this
1112 // expectation.
1113 Expectationcxx . . $ testing/Expectation# GetHandlecxx . . $ testing/internal/TypedExpectation#GetHandle(664511b22ed2e5f6).() override { return owner_cxx . . $ testing/internal/TypedExpectation#owner_.->GetHandleOf(this); }
1114
1115 // The following methods will be called only after the EXPECT_CALL()
1116 // statement finishes and when the current thread holds
1117 // g_gmock_mutex.
1118
1119 // Returns true if and only if this expectation matches the given arguments.
1120 bool Matchescxx . . $ testing/internal/TypedExpectation#Matches(f0941a2391622e22).(const ArgumentTuplecxx . . $ testing/internal/TypedExpectation#ArgumentTuple#& args) const
1121 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
1122 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
1123 return TupleMatchescxx . . $ testing/internal/TupleMatches(acb94948942028a1).(matchers_cxx . . $ testing/internal/TypedExpectation#matchers_., args) && extra_matcher_cxx . . $ testing/internal/TypedExpectation#extra_matcher_..Matchescxx . . $ testing/internal/MatcherBase#Matches(8877ebe272b9620d).(args);
1124 }
1125
1126 // Returns true if and only if this expectation should handle the given
1127 // arguments.
1128 bool ShouldHandleArgumentscxx . . $ testing/internal/TypedExpectation#ShouldHandleArguments(f0941a2391622e22).(const ArgumentTuplecxx . . $ testing/internal/TypedExpectation#ArgumentTuple#& args) const
1129 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
1130 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
1131
1132 // In case the action count wasn't checked when the expectation
1133 // was defined (e.g. if this expectation has no WillRepeatedly()
1134 // or RetiresOnSaturation() clause), we check it when the
1135 // expectation is used for the first time.
1136 CheckActionCountIfNotDonecxx . . $ testing/internal/ExpectationBase#CheckActionCountIfNotDone(83f5f38750778ac8).();
1137 return !is_retiredcxx . . $ testing/internal/ExpectationBase#is_retired(50ce9a9e25b4a850).() && AllPrerequisitesAreSatisfiedcxx . . $ testing/internal/ExpectationBase#AllPrerequisitesAreSatisfied(50ce9a9e25b4a850).() && Matchescxx . . $ testing/internal/TypedExpectation#Matches(f0941a2391622e22).(args);
1138 }
1139
1140 // Describes the result of matching the arguments against this
1141 // expectation to the given ostream.
1142 void ExplainMatchResultTocxx . . $ testing/internal/TypedExpectation#ExplainMatchResultTo(6b6f6e8698cbda4f).(const ArgumentTuplecxx . . $ testing/internal/TypedExpectation#ArgumentTuple#& args, ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os) const
1143 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
1144 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
1145
1146 if (is_retiredcxx . . $ testing/internal/ExpectationBase#is_retired(50ce9a9e25b4a850).()) {
1147 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Expected: the expectation is active\n"
1148 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Actual: it is retired\n";
1149 } else if (!Matchescxx . . $ testing/internal/TypedExpectation#Matches(f0941a2391622e22).(args)) {
1150 if (!TupleMatchescxx . . $ testing/internal/TupleMatches(acb94948942028a1).(matchers_cxx . . $ testing/internal/TypedExpectation#matchers_., args)) {
1151 ExplainMatchFailureTupleTocxx . . $ testing/internal/ExplainMatchFailureTupleTo(15b9b6606344cea6).(matchers_cxx . . $ testing/internal/TypedExpectation#matchers_., args, os);
1152 }
1153 StringMatchResultListenercxx . . $ testing/StringMatchResultListener# listenercxx . . $ testing/StringMatchResultListener#StringMatchResultListener(49f6e7a06ebc5aa8).;
1154 if (!extra_matcher_cxx . . $ testing/internal/TypedExpectation#extra_matcher_..MatchAndExplaincxx . . $ testing/internal/MatcherBase#MatchAndExplain(c22d93ea9b61fc52).(args, &listener)) {
1155 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Expected args: ";
1156 extra_matcher_cxx . . $ testing/internal/TypedExpectation#extra_matcher_..DescribeTocxx . . $ testing/internal/MatcherBase#DescribeTo(7b1875f5045e6781).(os);
1157 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n Actual: don't match";
1158
1159 internalcxx . . $ testing/internal/::PrintIfNotEmptycxx . . $ testing/internal/PrintIfNotEmpty(9f263493b1796e5b).(listener.strcxx . . $ testing/StringMatchResultListener#str(219584694fe2b248).(), os);
1160 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n";
1161 }
1162 } else if (!AllPrerequisitesAreSatisfiedcxx . . $ testing/internal/ExpectationBase#AllPrerequisitesAreSatisfied(50ce9a9e25b4a850).()) {
1163 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Expected: all pre-requisites are satisfied\n"
1164 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Actual: the following immediate pre-requisites "
1165 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "are not satisfied:\n";
1166 ExpectationSetcxx . . $ testing/ExpectationSet# unsatisfied_prereqscxx . . $ testing/ExpectationSet#ExpectationSet(ced63f7c635d850d).;
1167 FindUnsatisfiedPrerequisitescxx . . $ testing/internal/ExpectationBase#FindUnsatisfiedPrerequisites(eca8dd495df6b951).(&unsatisfied_prereqs);
1168 int i = 0;
1169 for (ExpectationSetcxx . . $ testing/ExpectationSet#::const_iteratorcxx . . $ testing/ExpectationSet#const_iterator# it = unsatisfied_prereqs.begincxx . . $ testing/ExpectationSet#begin(993d89c9f833d74f).();
1170 it !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). unsatisfied_prereqs.endcxx . . $ testing/ExpectationSet#end(993d89c9f833d74f).(); ++cxx . . $ std/_Rb_tree_const_iterator#operator++(9cb79ab07bb244bf).it) {
1171 it->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).expectation_basecxx . . $ testing/Expectation#expectation_base(1ba548a909ff7ac8).()->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).DescribeLocationTocxx . . $ testing/internal/ExpectationBase#DescribeLocationTo(7b1875f5045e6781).(os);
1172 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "pre-requisite #" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). i++ <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n";
1173 }
1174 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " (end of pre-requisites)\n";
1175 } else {
1176 // This line is here just for completeness' sake. It will never
1177 // be executed as currently the ExplainMatchResultTo() function
1178 // is called only when the mock function call does NOT match the
1179 // expectation.
1180 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "The call matches the expectation.\n";
1181 }
1182 }
1183
1184 // Returns the action that should be taken for the current invocation.
1185 const Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/TypedExpectation#F#>& GetCurrentActioncxx . . $ testing/internal/TypedExpectation#GetCurrentAction(7fb9620e0ce34035).(const FunctionMockercxx . . $ testing/internal/FunctionMocker#<Fcxx . . $ testing/internal/TypedExpectation#F#>* mocker,
1186 const ArgumentTuplecxx . . $ testing/internal/TypedExpectation#ArgumentTuple#& args) const
1187 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
1188 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
1189 const int count = call_countcxx . . $ testing/internal/ExpectationBase#call_count(455f465bc33b4cdf).();
1190 Assertcxx . . $ testing/internal/Assert(f72e0045939ddf2e).(count >= 1, __FILE__, __LINE__,
1191 "call_count() is <= 0 when GetCurrentAction() is "cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).
1192 "called - this should never happen.");
1193
1194 const int action_count = static_cast<int>(untyped_actions_cxx . . $ testing/internal/ExpectationBase#untyped_actions_..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).());
1195 if (action_count > 0 && !repeated_action_specified_cxx . . $ testing/internal/ExpectationBase#repeated_action_specified_. &&
1196 count > action_count) {
1197 // If there is at least one WillOnce() and no WillRepeatedly(),
1198 // we warn the user when the WillOnce() clauses ran out.
1199 ::stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# sscxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).;
1200 DescribeLocationTocxx . . $ testing/internal/ExpectationBase#DescribeLocationTo(7b1875f5045e6781).(&ss);
1201 ss <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Actions ran out in " <<cxx . . $ testing/`operator<<`(7b2968f47657240a). source_textcxx . . $ testing/internal/ExpectationBase#source_text(a9f41ea0e82d88cf).() <<cxx . . $ testing/`operator<<`(5becdd4a2a15895b). "...\n"
1202 <<cxx . . $ testing/`operator<<`(7b2968f47657240a). "Called " <<cxx . . $ testing/`operator<<`(7b2968f47657240a). count <<cxx . . $ testing/`operator<<`(5becdd4a2a15895b). " times, but only " <<cxx . . $ testing/`operator<<`(7b2968f47657240a). action_count
1203 <<cxx . . $ testing/`operator<<`(73453723d68cb77e). " WillOnce()" <<cxx . . $ testing/`operator<<`(73453723d68cb77e). (action_count == 1 ? " is" : "s are")
1204 <<cxx . . $ testing/`operator<<`(7b2968f47657240a). " specified - ";
1205 mocker->DescribeDefaultActionTo(args, &ss);
1206 Logcxx . . $ testing/internal/Log(a998878292a3873a).(kWarningcxx . . $ testing/internal/kWarning., ss.strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).(), 1);
1207 }
1208
1209 return count <= action_count
1210 ? *static_cast<const Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/TypedExpectation#F#>*>(
1211 untyped_actions_cxx . . $ testing/internal/ExpectationBase#untyped_actions_.[static_cast<size_tcxx . . $ size_t#>(count - 1)])
1212 : repeated_actioncxx . . $ testing/internal/TypedExpectation#repeated_action(d2dccedc2fab2a51).();
1213 }
1214
1215 // Given the arguments of a mock function call, if the call will
1216 // over-saturate this expectation, returns the default action;
1217 // otherwise, returns the next action in this expectation. Also
1218 // describes *what* happened to 'what', and explains *why* Google
1219 // Mock does it to 'why'. This method is not const as it calls
1220 // IncrementCallCount(). A return value of NULL means the default
1221 // action.
1222 const Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/TypedExpectation#F#>* GetActionForArgumentscxx . . $ testing/internal/TypedExpectation#GetActionForArguments(86989e8154217b58).(const FunctionMockercxx . . $ testing/internal/FunctionMocker#<Fcxx . . $ testing/internal/TypedExpectation#F#>* mocker,
1223 const ArgumentTuplecxx . . $ testing/internal/TypedExpectation#ArgumentTuple#& args,
1224 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* what,
1225 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* why)
1226 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
1227 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
1228 const ::stdcxx . . $ std/::stringcxx . . $ std/string#& expectation_description = GetDescriptioncxx . . $ testing/internal/ExpectationBase#GetDescription(f4fff0029955a25f).();
1229 if (IsSaturatedcxx . . $ testing/internal/ExpectationBase#IsSaturated(50ce9a9e25b4a850).()) {
1230 // We have an excessive call.
1231 IncrementCallCountcxx . . $ testing/internal/ExpectationBase#IncrementCallCount(49f6e7a06ebc5aa8).();
1232 *what <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Mock function ";
1233 if (!expectation_description.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) {
1234 *what <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\"" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). expectation_description <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\" ";
1235 }
1236 *what <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "called more times than expected - ";
1237 mocker->DescribeDefaultActionTo(args, what);
1238 DescribeCallCountTocxx . . $ testing/internal/ExpectationBase#DescribeCallCountTo(7b1875f5045e6781).(why);
1239
1240 return nullptr;
1241 }
1242
1243 IncrementCallCountcxx . . $ testing/internal/ExpectationBase#IncrementCallCount(49f6e7a06ebc5aa8).();
1244 RetireAllPreRequisitescxx . . $ testing/internal/ExpectationBase#RetireAllPreRequisites(49f6e7a06ebc5aa8).();
1245
1246 if (retires_on_saturation_cxx . . $ testing/internal/ExpectationBase#retires_on_saturation_. && IsSaturatedcxx . . $ testing/internal/ExpectationBase#IsSaturated(50ce9a9e25b4a850).()) {
1247 Retirecxx . . $ testing/internal/ExpectationBase#Retire(49f6e7a06ebc5aa8).();
1248 }
1249
1250 // Must be done after IncrementCount()!
1251 *what <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Mock function ";
1252 if (!expectation_description.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) {
1253 *what <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\"" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). expectation_description <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\" ";
1254 }
1255 *what <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "call matches " <<cxx . . $ testing/`operator<<`(5becdd4a2a15895b). source_textcxx . . $ testing/internal/ExpectationBase#source_text(a9f41ea0e82d88cf).() <<cxx . . $ testing/`operator<<`(5becdd4a2a15895b). "...\n";
1256 return &(GetCurrentActioncxx . . $ testing/internal/TypedExpectation#GetCurrentAction(7fb9620e0ce34035).(mocker, args));
1257 }
1258
1259 // All the fields below won't change once the EXPECT_CALL()
1260 // statement finishes.
1261 FunctionMockercxx . . $ testing/internal/FunctionMocker#<Fcxx . . $ testing/internal/TypedExpectation#F#>* const owner_cxx . . $ testing/internal/TypedExpectation#owner_.;
1262 ArgumentMatcherTuplecxx . . $ testing/internal/TypedExpectation#ArgumentMatcherTuple# matchers_cxx . . $ testing/internal/TypedExpectation#matchers_.;
1263 Matchercxx . . $ testing/Matcher#<const ArgumentTuplecxx . . $ testing/internal/TypedExpectation#ArgumentTuple#&> extra_matcher_cxx . . $ testing/internal/TypedExpectation#extra_matcher_.;
1264 Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/TypedExpectation#F#> repeated_action_cxx . . $ testing/internal/TypedExpectation#repeated_action_.;
1265
1266 TypedExpectationcxx . . $ testing/internal/TypedExpectation#`TypedExpectation<R (Args...)>`(f21406fa76657b08).(const TypedExpectation&) = delete;
1267 TypedExpectation& operatorcxx . . $ testing/internal/TypedExpectation#`operator=`(d29b2f5eb7a6203d).=(const TypedExpectation&) = delete;
1268 }; // class TypedExpectation
1269
1270 // A MockSpec object is used by ON_CALL() or EXPECT_CALL() for
1271 // specifying the default behavior of, or expectation on, a mock
1272 // function.
1273
1274 // Note: class MockSpec really belongs to the ::testing namespace.
1275 // However if we define it in ::testing, MSVC will complain when
1276 // classes in ::testing::internal declare it as a friend class
1277 // template. To workaround this compiler bug, we define MockSpec in
1278 // ::testing::internal and import it into ::testing.
1279
1280 // Logs a message including file and line number information.
1281 GTEST_API_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:844:9`! void LogWithLocationcxx . . $ testing/internal/LogWithLocation(beb4b13fe18a560f).(testingcxx . . $ testing/::internalcxx . . $ testing/internal/::LogSeveritycxx . . $ testing/internal/LogSeverity# severity,
1282 const char* file, int line,
1283 const stdcxx . . $ std/::stringcxx . . $ std/string#& message);
1284
1285 template <typename F>
1286 class MockSpeccxx . . $ testing/internal/MockSpec# {
1287 public:
1288 typedef typename internalcxx . . $ testing/internal/::Functioncxx . . $ testing/internal/Function#<F>::ArgumentTuple ArgumentTuplecxx . . $ testing/internal/MockSpec#ArgumentTuple#;
1289 typedef
1290 typename internalcxx . . $ testing/internal/::Functioncxx . . $ testing/internal/Function#<F>::ArgumentMatcherTuple ArgumentMatcherTuplecxx . . $ testing/internal/MockSpec#ArgumentMatcherTuple#;
1291
1292 // Constructs a MockSpec object, given the function mocker object
1293 // that the spec is associated with.
1294 MockSpeccxx . . $ testing/internal/MockSpec#`MockSpec<F>`(9e5203fb87c85737).(internalcxx . . $ testing/internal/::FunctionMockercxx . . $ testing/internal/FunctionMocker#<F>* function_mocker,
1295 const ArgumentMatcherTuplecxx . . $ testing/internal/MockSpec#ArgumentMatcherTuple#& matchers)
1296 : function_mocker_cxx . . $ testing/internal/MockSpec#function_mocker_.(function_mocker), matchers_cxx . . $ testing/internal/MockSpec#matchers_.(matchers) {}
1297
1298 // Adds a new default action spec to the function mocker and returns
1299 // the newly created spec.
1300 internalcxx . . $ testing/internal/::OnCallSpeccxx . . $ testing/internal/OnCallSpec#<F>& InternalDefaultActionSetAtcxx . . $ testing/internal/MockSpec#InternalDefaultActionSetAt(8fa79414d855951e).(const char* file,
1301 int line, const char* obj,
1302 const char* call) {
1303 LogWithLocationcxx . . $ testing/internal/LogWithLocation(beb4b13fe18a560f).(internalcxx . . $ testing/internal/::kInfocxx . . $ testing/internal/kInfo., file, line,
1304 stdcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).::stringcxx . . $ std/string#("ON_CALL(") +cxx . . $ std/operator+(900ec9581c410ad9). obj +cxx . . $ std/operator+(900ec9581c410ad9). ", " +cxx . . $ std/operator+(900ec9581c410ad9). call +cxx . . $ std/operator+(900ec9581c410ad9). ") invoked");
1305 return function_mocker_cxx . . $ testing/internal/MockSpec#function_mocker_.->AddNewOnCallSpec(file, line, matchers_cxx . . $ testing/internal/MockSpec#matchers_.);
1306 }
1307
1308 // Adds a new expectation spec to the function mocker and returns
1309 // the newly created spec.
1310 internalcxx . . $ testing/internal/::TypedExpectationcxx . . $ testing/internal/TypedExpectation#<F>& InternalExpectedAtcxx . . $ testing/internal/MockSpec#InternalExpectedAt(f3b81cffab6d6430).(const char* file, int line,
1311 const char* obj,
1312 const char* call) {
1313 const stdcxx . . $ std/::stringcxx . . $ std/string# source_text(stdcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).::stringcxx . . $ std/string#("EXPECT_CALL(") +cxx . . $ std/operator+(900ec9581c410ad9). obj +cxx . . $ std/operator+(900ec9581c410ad9). ", " +cxx . . $ std/operator+(900ec9581c410ad9).
1314 call +cxx . . $ std/operator+(900ec9581c410ad9). ")");
1315 LogWithLocationcxx . . $ testing/internal/LogWithLocation(beb4b13fe18a560f).(internalcxx . . $ testing/internal/::kInfocxx . . $ testing/internal/kInfo., file, line, source_text +cxx . . $ std/operator+(40fc1db9226233c6). " invoked");
1316 return function_mocker_cxx . . $ testing/internal/MockSpec#function_mocker_.->AddNewExpectation(file, line, source_text,
1317 matchers_cxx . . $ testing/internal/MockSpec#matchers_.);
1318 }
1319
1320 // This operator overload is used to swallow the superfluous parameter list
1321 // introduced by the ON/EXPECT_CALL macros. See the macro comments for more
1322 // explanation.
1323 MockSpeccxx . . $ testing/internal/MockSpec#<F>& operatorcxx . . $ testing/internal/MockSpec#`operator()`(43e266ef3ef040b2).()(const internalcxx . . $ testing/internal/::WithoutMatcherscxx . . $ testing/internal/WithoutMatchers#&, void* const) {
1324 return *this;
1325 }
1326
1327 private:
1328 template <typename Function>
1329 friend class internalcxx . . $ testing/internal/::FunctionMockercxx . . $ testing/internal/FunctionMocker#;
1330
1331 // The function mocker that owns this spec.
1332 internalcxx . . $ testing/internal/::FunctionMockercxx . . $ testing/internal/FunctionMocker#<F>* const function_mocker_cxx . . $ testing/internal/MockSpec#function_mocker_.;
1333 // The argument matchers specified in the spec.
1334 ArgumentMatcherTuplecxx . . $ testing/internal/MockSpec#ArgumentMatcherTuple# matchers_cxx . . $ testing/internal/MockSpec#matchers_.;
1335 }; // class MockSpec
1336
1337 // Wrapper type for generically holding an ordinary value or lvalue reference.
1338 // If T is not a reference type, it must be copyable or movable.
1339 // ReferenceOrValueWrapper<T> is movable, and will also be copyable unless
1340 // T is a move-only value type (which means that it will always be copyable
1341 // if the current platform does not support move semantics).
1342 //
1343 // The primary template defines handling for values, but function header
1344 // comments describe the contract for the whole template (including
1345 // specializations).
1346 template <typename T>
1347 class ReferenceOrValueWrappercxx . . $ testing/internal/ReferenceOrValueWrapper# {
1348 public:
1349 // Constructs a wrapper from the given value/reference.
1350 explicit ReferenceOrValueWrappercxx . . $ testing/internal/ReferenceOrValueWrapper#`ReferenceOrValueWrapper<T>`(9b289cee16747614).(T value) : value_cxx . . $ testing/internal/ReferenceOrValueWrapper#value_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(value)) {}
1351
1352 // Unwraps and returns the underlying value/reference, exactly as
1353 // originally passed. The behavior of calling this more than once on
1354 // the same object is unspecified.
1355 T Unwrapcxx . . $ testing/internal/ReferenceOrValueWrapper#Unwrap(5f357b03ed472e5e).() { return stdcxx . . $ std/::movecxx . . $ std/move(88304b602929f6f4).(value_cxx . . $ testing/internal/ReferenceOrValueWrapper#value_.); }
1356
1357 // Provides nondestructive access to the underlying value/reference.
1358 // Always returns a const reference (more precisely,
1359 // const std::add_lvalue_reference<T>::type). The behavior of calling this
1360 // after calling Unwrap on the same object is unspecified.
1361 const T& Peekcxx . . $ testing/internal/ReferenceOrValueWrapper#Peek(ea465e50d690edfe).() const { return value_cxx . . $ testing/internal/ReferenceOrValueWrapper#value_.; }
1362
1363 private:
1364 T value_cxx . . $ testing/internal/ReferenceOrValueWrapper#value_.;
1365 };
1366
1367 // Specialization for lvalue reference types. See primary template
1368 // for documentation.
1369 template <typename T>
1370 class ReferenceOrValueWrappercxx . . $ testing/internal/ReferenceOrValueWrapper#<T&> {
1371 public:
1372 // Workaround for debatable pass-by-reference lint warning (c-library-team
1373 // policy precludes NOLINT in this context)
1374 typedef T& referencecxx . . $ testing/internal/ReferenceOrValueWrapper#reference#;
1375 explicit ReferenceOrValueWrappercxx . . $ testing/internal/ReferenceOrValueWrapper#`ReferenceOrValueWrapper<T &>`(8e935d9c2e576e3a).(referencecxx . . $ testing/internal/ReferenceOrValueWrapper#reference# ref) : value_ptr_cxx . . $ testing/internal/ReferenceOrValueWrapper#value_ptr_.(&ref) {}
1376 T& Unwrapcxx . . $ testing/internal/ReferenceOrValueWrapper#Unwrap(19b2b6f17af048b).() { return *value_ptr_cxx . . $ testing/internal/ReferenceOrValueWrapper#value_ptr_.; }
1377 const T& Peekcxx . . $ testing/internal/ReferenceOrValueWrapper#Peek(ea465e50d690edfe).() const { return *value_ptr_cxx . . $ testing/internal/ReferenceOrValueWrapper#value_ptr_.; }
1378
1379 private:
1380 T* value_ptr_cxx . . $ testing/internal/ReferenceOrValueWrapper#value_ptr_.;
1381 };
1382
1383 // Prints the held value as an action's result to os.
1384 template <typename T>
1385 void PrintAsActionResultcxx . . $ testing/internal/PrintAsActionResult(cd5921fea08118f1).(const T& result, stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) {
1386 os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n Returns: ";
1387 // T may be a reference type, so we don't use UniversalPrint().
1388 UniversalPrintercxx . . $ testing/internal/UniversalPrinter#<T>::Print(result, &os);
1389 }
1390
1391 // Reports an uninteresting call (whose description is in msg) in the
1392 // manner specified by 'reaction'.
1393 GTEST_API_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:844:9`! void ReportUninterestingCallcxx . . $ testing/internal/ReportUninterestingCall(597760e76b563fdf).(CallReactioncxx . . $ testing/internal/CallReaction# reaction,
1394 const stdcxx . . $ std/::stringcxx . . $ std/string#& msg);
1395
1396 // A generic RAII type that runs a user-provided function in its destructor.
1397 class Cleanupcxx . . $ testing/internal/Cleanup# final {
1398 public:
1399 explicit Cleanupcxx . . $ testing/internal/Cleanup#Cleanup(13411efb8aeb1b14).(stdcxx . . $ std/::functioncxx . . $ std/function#<void()> f) : f_cxx . . $ std/function#function(f869d4ee66f5babd).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(f)) {}
1400 ~cxx . . $ testing/internal/Cleanup#`~Cleanup`(ced63f7c635d850d).Cleanupcxx . . $ testing/internal/Cleanup#() { f_cxx . . $ testing/internal/Cleanup#f_.(cxx . . $ std/function#`operator()`(39e0826ffb540481).); }
1401
1402 private:
1403 stdcxx . . $ std/::functioncxx . . $ std/function#<void()> f_cxx . . $ testing/internal/Cleanup#f_.;
1404 };
1405
1406 struct UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase#::UninterestingCallCleanupHandlercxx . . $ testing/internal/UntypedFunctionMockerBase#UninterestingCallCleanupHandler# {
1407 CallReactioncxx . . $ testing/internal/CallReaction# reactioncxx . . $ testing/internal/UntypedFunctionMockerBase#UninterestingCallCleanupHandler#reaction.;
1408 stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream#& sscxx . . $ testing/internal/UntypedFunctionMockerBase#UninterestingCallCleanupHandler#ss.;
1409
1410 ~cxx . . $ testing/internal/UntypedFunctionMockerBase#UninterestingCallCleanupHandler#`~UninterestingCallCleanupHandler`(ced63f7c635d850d).UninterestingCallCleanupHandlercxx . . $ testing/internal/UntypedFunctionMockerBase#UninterestingCallCleanupHandler#() {
1411 ReportUninterestingCallcxx . . $ testing/internal/ReportUninterestingCall(597760e76b563fdf).(reactioncxx . . $ testing/internal/UntypedFunctionMockerBase#UninterestingCallCleanupHandler#reaction., sscxx . . $ testing/internal/UntypedFunctionMockerBase#UninterestingCallCleanupHandler#ss..strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).());
1412 }
1413 };
1414
1415 struct UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase#::FailureCleanupHandlercxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler# {
1416 stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream#& sscxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#ss.;
1417 stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream#& whycxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#why.;
1418 stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream#& loccxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#loc.;
1419 const ExpectationBasecxx . . $ testing/internal/ExpectationBase#* untyped_expectationcxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#untyped_expectation.;
1420 bool foundcxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#found.;
1421 bool is_excessivecxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#is_excessive.;
1422
1423 ~cxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#`~FailureCleanupHandler`(ced63f7c635d850d).FailureCleanupHandlercxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#() {
1424 sscxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#ss. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). whycxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#why..strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).();
1425
1426 if (!foundcxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#found.) {
1427 // No expectation matches this call - reports a failure.
1428 Expectcxx . . $ testing/internal/Expect(f72e0045939ddf2e).(false, nullptr, -1, sscxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#ss..strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).());
1429 } else if (is_excessivecxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#is_excessive.) {
1430 // We had an upper-bound violation and the failure message is in ss.
1431 Expectcxx . . $ testing/internal/Expect(f72e0045939ddf2e).(false, untyped_expectationcxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#untyped_expectation.->filecxx . . $ testing/internal/ExpectationBase#file(a9f41ea0e82d88cf).(), untyped_expectationcxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#untyped_expectation.->linecxx . . $ testing/internal/ExpectationBase#line(455f465bc33b4cdf).(),
1432 sscxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#ss..strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).());
1433 } else {
1434 // We had an expected call and the matching expectation is
1435 // described in ss.
1436 Logcxx . . $ testing/internal/Log(a998878292a3873a).(kInfocxx . . $ testing/internal/kInfo., loccxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#loc..strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).() +cxx . . $ std/operator+(aa1c00e85b87da6b). sscxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler#ss..strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).(), 2);
1437 }
1438 }
1439 };
1440
1441 template <typename F>
1442 class FunctionMockercxx . . $ testing/internal/FunctionMocker#;
1443
1444 template <typename R, typename... Args>
1445 class FunctionMockercxx . . $ testing/internal/FunctionMocker#<R(Args...)> final : public UntypedFunctionMockerBasecxx . . $ testing/internal/UntypedFunctionMockerBase# {
1446 using Fcxx . . $ testing/internal/FunctionMocker#F# = R(Args...);
1447
1448 public:
1449 using Resultcxx . . $ testing/internal/FunctionMocker#Result# = R;
1450 using ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple# = stdcxx . . $ std/::tuplecxx . . $ std/tuple#<Args...>;
1451 using ArgumentMatcherTuplecxx . . $ testing/internal/FunctionMocker#ArgumentMatcherTuple# = stdcxx . . $ std/::tuplecxx . . $ std/tuple#<Matchercxx . . $ testing/Matcher#<Args>...>;
1452
1453 FunctionMockercxx . . $ testing/internal/FunctionMocker#`FunctionMocker<R (Args...)>`(49f6e7a06ebc5aa8).() = default;
1454
1455 // There is no generally useful and implementable semantics of
1456 // copying a mock object, so copying a mock is usually a user error.
1457 // Thus we disallow copying function mockers. If the user really
1458 // wants to copy a mock object, they should implement their own copy
1459 // operation, for example:
1460 //
1461 // class MockFoo : public Foo {
1462 // public:
1463 // // Defines a copy constructor explicitly.
1464 // MockFoo(const MockFoo& src) {}
1465 // ...
1466 // };
1467 FunctionMockercxx . . $ testing/internal/FunctionMocker#`FunctionMocker<R (Args...)>`(2a5a848abaf5723c).(const FunctionMocker&) = delete;
1468 FunctionMocker& operatorcxx . . $ testing/internal/FunctionMocker#`operator=`(7b06a07cd2070e7f).=(const FunctionMocker&) = delete;
1469
1470 // The destructor verifies that all expectations on this mock
1471 // function have been satisfied. If not, it will report Google Test
1472 // non-fatal failures for the violations.
1473 ~cxx . . $ testing/internal/FunctionMocker#`~FunctionMocker<R (Args...)>`(49f6e7a06ebc5aa8).FunctionMocker() override GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex) {
1474 MutexLockcxx . . $ testing/internal/MutexLock# lcxx . . $ testing/internal/GTestMutexLock#GTestMutexLock(6c1d8b8db3bd6f5).(&g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex.);
1475 VerifyAndClearExpectationsLockedcxx . . $ testing/internal/UntypedFunctionMockerBase#VerifyAndClearExpectationsLocked(c9857a73d68e59ba).();
1476 Mockcxx . . $ testing/Mock#::UnregisterLockedcxx . . $ testing/Mock#UnregisterLocked(b9b61ea223a768f2).(this);
1477 ClearDefaultActionsLockedcxx . . $ testing/internal/FunctionMocker#ClearDefaultActionsLocked(49f6e7a06ebc5aa8).();
1478 }
1479
1480 // Returns the ON_CALL spec that matches this mock function with the
1481 // given arguments; returns NULL if no matching ON_CALL is found.
1482 // L = *
1483 const OnCallSpeccxx . . $ testing/internal/OnCallSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#>* FindOnCallSpeccxx . . $ testing/internal/FunctionMocker#FindOnCallSpec(6095e83b16e659f6).(const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#& args) const {
1484 for (UntypedOnCallSpecscxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedOnCallSpecs#::const_reverse_iteratorcxx . . $ std/vector#const_reverse_iterator# it =
1485 untyped_on_call_specs_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_on_call_specs_..rbegincxx . . $ std/vector#rbegin(7ffd9c4e53ea04dd).();
1486 it !=cxx . . $ testing/internal/`operator!=`(67d151cd10fc7f68). untyped_on_call_specs_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_on_call_specs_..rendcxx . . $ std/vector#rend(4f1ab9f89f58444d).(); ++cxx . . $ std/reverse_iterator#operator++(b4fad7494eaaab68).it) {
1487 const OnCallSpeccxx . . $ testing/internal/OnCallSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#>* spec = static_cast<const OnCallSpeccxx . . $ testing/internal/OnCallSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#>*>(*cxx . . $ std/reverse_iterator#`operator*`(c076846f881f3e7e).it);
1488 if (spec->Matchescxx . . $ testing/internal/OnCallSpec#Matches(a63ebbabfeaea7c5).(args)) return spec;
1489 }
1490
1491 return nullptr;
1492 }
1493
1494 // Performs the default action of this mock function on the given
1495 // arguments and returns the result. Asserts (or throws if
1496 // exceptions are enabled) with a helpful call description if there
1497 // is no valid return value. This method doesn't depend on the
1498 // mutable state of this object, and thus can be called concurrently
1499 // without locking.
1500 // L = *
1501 Resultcxx . . $ testing/internal/FunctionMocker#Result# PerformDefaultActioncxx . . $ testing/internal/FunctionMocker#PerformDefaultAction(f62234fb081c5c30).(ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#&& args,
1502 const stdcxx . . $ std/::stringcxx . . $ std/string#& call_description) const {
1503 const OnCallSpeccxx . . $ testing/internal/OnCallSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#>* const spec = this->FindOnCallSpeccxx . . $ testing/internal/FunctionMocker#FindOnCallSpec(6095e83b16e659f6).(args);
1504 if (spec !=cxx . . $ testing/internal/`operator!=`(67d151cd10fc7f68). nullptr) {
1505 return spec->GetActioncxx . . $ testing/internal/OnCallSpec#GetAction(3798827440f9e338).().Perform(stdcxx . . $ std/::movecxx . . $ std/move(7316eb2979bdd03c).(args));
1506 }
1507 const stdcxx . . $ std/::stringcxx . . $ std/string# message =
1508 call_description +cxx . . $ std/operator+(40fc1db9226233c6).
1509 "\n The mock function has no default action "
1510 "set, and its return type has no default value set.";
1511 #if GTEST_HAS_EXCEPTIONScxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:483:9`!
1512 if (!DefaultValuecxx . . $ testing/DefaultValue#<Result>::Exists()) {
1513 throw stdcxx . . $ std/runtime_error#runtime_error(9c546c94e5fcce4e).::runtime_errorcxx . . $ std/runtime_error#(message);
1514 }
1515 #else
1516 Assert(DefaultValue<Result>::Exists(), "", -1, message);
1517 #endif
1518 return DefaultValuecxx . . $ testing/DefaultValue#<Result>::Get();
1519 }
1520
1521 // Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
1522 // clears the ON_CALL()s set on this mock function.
1523 void ClearDefaultActionsLockedcxx . . $ testing/internal/FunctionMocker#ClearDefaultActionsLocked(49f6e7a06ebc5aa8).() override
1524 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
1525 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
1526
1527 // Deleting our default actions may trigger other mock objects to be
1528 // deleted, for example if an action contains a reference counted smart
1529 // pointer to that mock object, and that is the last reference. So if we
1530 // delete our actions within the context of the global mutex we may deadlock
1531 // when this method is called again. Instead, make a copy of the set of
1532 // actions to delete, clear our set within the mutex, and then delete the
1533 // actions outside of the mutex.
1534 UntypedOnCallSpecscxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedOnCallSpecs# specs_to_deletecxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
1535 untyped_on_call_specs_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_on_call_specs_..swapcxx . . $ std/vector#swap(319777021b21d7dd).(specs_to_delete);
1536
1537 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..Unlockcxx . . $ testing/internal/MutexBase#Unlock(49f6e7a06ebc5aa8).();
1538 for (UntypedOnCallSpecscxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedOnCallSpecs#::const_iteratorcxx . . $ std/vector#const_iterator# it = specs_to_deletecxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(459a7e7b9fbe7640)..begincxx . . $ std/vector#begin(55a6de06420d4903).();
1539 it !=cxx . . $ __gnu_cxx/`operator!=`(835b2e373b0459fa). specs_to_delete.endcxx . . $ std/vector#end(55a6de06420d4903).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(1613faa01bc3d014).it) {
1540 delete static_cast<const OnCallSpeccxx . . $ testing/internal/OnCallSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#>*>(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(f9c37c6e427d43d6).it);
1541 }
1542
1543 // Lock the mutex again, since the caller expects it to be locked when we
1544 // return.
1545 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..Lockcxx . . $ testing/internal/MutexBase#Lock(49f6e7a06ebc5aa8).();
1546 }
1547
1548 // Returns the result of invoking this mock function with the given
1549 // arguments. This function can be safely called from multiple
1550 // threads concurrently.
1551 Resultcxx . . $ testing/internal/FunctionMocker#Result# Invokecxx . . $ testing/internal/FunctionMocker#Invoke(3f8709b945c588e8).(Args... args) GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex) {
1552 return InvokeWithcxx . . $ testing/internal/FunctionMocker#InvokeWith(5344bf5853cf4a0f).(ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#(stdcxx . . $ std/::forwardcxx . . $ std/forward(2d11db7e2d3d358e).<Args>(args)...));
1553 }
1554
1555 MockSpeccxx . . $ testing/internal/MockSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#> Withcxx . . $ testing/internal/FunctionMocker#With(cf68f14086cc3a66).(Matchercxx . . $ testing/Matcher#<Args>... m) {
1556 return MockSpeccxx . . $ testing/internal/MockSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#>(this, ::stdcxx . . $ std/::make_tuplecxx . . $ std/make_tuple(3964edbfd7e8599f).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(m)...));
1557 }
1558
1559 protected:
1560 template <typename Function>
1561 friend class MockSpeccxx . . $ testing/internal/MockSpec#;
1562
1563 // Adds and returns a default action spec for this mock function.
1564 OnCallSpeccxx . . $ testing/internal/OnCallSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#>& AddNewOnCallSpeccxx . . $ testing/internal/FunctionMocker#AddNewOnCallSpec(3804ec2f55e3250b).(const char* file, int line,
1565 const ArgumentMatcherTuplecxx . . $ testing/internal/FunctionMocker#ArgumentMatcherTuple#& m)
1566 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex) {
1567 Mockcxx . . $ testing/Mock#::RegisterUseByOnCallOrExpectCallcxx . . $ testing/Mock#RegisterUseByOnCallOrExpectCall(9e2fdd24afadf9a9).(MockObjectcxx . . $ testing/internal/UntypedFunctionMockerBase#MockObject(3a8ef3fdc6e817ef).(), file, line);
1568 OnCallSpeccxx . . $ testing/internal/OnCallSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#>* const on_call_spec = new OnCallSpeccxx . . $ testing/internal/OnCallSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#>(file, line, m);
1569 untyped_on_call_specs_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_on_call_specs_..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(on_call_spec);
1570 return *on_call_spec;
1571 }
1572
1573 // Adds and returns an expectation spec for this mock function.
1574 TypedExpectationcxx . . $ testing/internal/TypedExpectation#<Fcxx . . $ testing/internal/FunctionMocker#F#>& AddNewExpectationcxx . . $ testing/internal/FunctionMocker#AddNewExpectation(1eb4fd5437ee34).(const char* file, int line,
1575 const stdcxx . . $ std/::stringcxx . . $ std/string#& source_text,
1576 const ArgumentMatcherTuplecxx . . $ testing/internal/FunctionMocker#ArgumentMatcherTuple#& m)
1577 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex) {
1578 Mockcxx . . $ testing/Mock#::RegisterUseByOnCallOrExpectCallcxx . . $ testing/Mock#RegisterUseByOnCallOrExpectCall(9e2fdd24afadf9a9).(MockObjectcxx . . $ testing/internal/UntypedFunctionMockerBase#MockObject(3a8ef3fdc6e817ef).(), file, line);
1579 TypedExpectationcxx . . $ testing/internal/TypedExpectation#<Fcxx . . $ testing/internal/FunctionMocker#F#>* const expectation =
1580 new TypedExpectationcxx . . $ testing/internal/TypedExpectation#<Fcxx . . $ testing/internal/FunctionMocker#F#>(this, file, line, source_text, m);
1581 const stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<ExpectationBasecxx . . $ testing/internal/ExpectationBase#> untyped_expectation(expectation);
1582 // See the definition of untyped_expectations_ for why access to
1583 // it is unprotected here.
1584 untyped_expectations_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_expectations_..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(untyped_expectation);
1585
1586 // Adds this expectation into the implicit sequence if there is one.
1587 Sequencecxx . . $ testing/Sequence#* const implicit_sequence = g_gmock_implicit_sequencecxx . . $ testing/internal/g_gmock_implicit_sequence..getcxx . . $ testing/internal/ThreadLocal#get(ea465e50d690edfe).();
1588 if (implicit_sequence != nullptr) {
1589 implicit_sequence->AddExpectationcxx . . $ testing/Sequence#AddExpectation(eaeee4810625b545).(Expectationcxx . . $ testing/Expectation#Expectation(403a5e975b8e64b5).(untyped_expectation));
1590 }
1591
1592 return *expectation;
1593 }
1594
1595 private:
1596 template <typename Func>
1597 friend class TypedExpectationcxx . . $ testing/internal/TypedExpectation#;
1598
1599 // Some utilities needed for implementing UntypedInvokeWith().
1600
1601 // Describes what default action will be performed for the given
1602 // arguments.
1603 // L = *
1604 void DescribeDefaultActionTocxx . . $ testing/internal/FunctionMocker#DescribeDefaultActionTo(9ad2a6b629e1823d).(const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#& args,
1605 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os) const {
1606 const OnCallSpeccxx . . $ testing/internal/OnCallSpec#<Fcxx . . $ testing/internal/FunctionMocker#F#>* const spec = FindOnCallSpeccxx . . $ testing/internal/FunctionMocker#FindOnCallSpec(6095e83b16e659f6).(args);
1607
1608 if (spec ==cxx . . $ testing/internal/`operator==`(67d151cd10fc7f68). nullptr) {
1609 *os <<cxx . . $ testing/`operator<<`(73453723d68cb77e). (stdcxx . . $ std/::is_void<Result>::value ? "returning directly.\n"
1610 : "returning default value.\n");
1611 } else {
1612 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "taking default action specified at:\n"
1613 <<cxx . . $ testing/`operator<<`(7b2968f47657240a). FormatFileLocationcxx . . $ testing/internal/FormatFileLocation(a4045e16862dad42).(spec->filecxx . . $ testing/internal/UntypedOnCallSpecBase#file(a9f41ea0e82d88cf).(), spec->linecxx . . $ testing/internal/UntypedOnCallSpecBase#line(455f465bc33b4cdf).()) <<cxx . . $ testing/`operator<<`(7b2968f47657240a). "\n";
1614 }
1615 }
1616
1617 // Writes a message that the call is uninteresting (i.e. neither
1618 // explicitly expected nor explicitly unexpected) to the given
1619 // ostream.
1620 void UntypedDescribeUninterestingCallcxx . . $ testing/internal/FunctionMocker#UntypedDescribeUninterestingCall(a94ecf7da2f13db4).(const void* untyped_args,
1621 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os) const override
1622 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex) {
1623 const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#& args =
1624 *static_cast<const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#*>(untyped_args);
1625 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Uninteresting mock function call - ";
1626 DescribeDefaultActionTocxx . . $ testing/internal/FunctionMocker#DescribeDefaultActionTo(9ad2a6b629e1823d).(args, os);
1627 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Function call: " <<cxx . . $ testing/`operator<<`(7b2968f47657240a). Namecxx . . $ testing/internal/UntypedFunctionMockerBase#Name(a9f41ea0e82d88cf).();
1628 UniversalPrintcxx . . $ testing/internal/UniversalPrint(931868cbe6a2ea88).(args, os);
1629 }
1630
1631 // Returns the expectation that matches the given function arguments
1632 // (or NULL is there's no match); when a match is found,
1633 // untyped_action is set to point to the action that should be
1634 // performed (or NULL if the action is "do default"), and
1635 // is_excessive is modified to indicate whether the call exceeds the
1636 // expected number.
1637 //
1638 // Critical section: We must find the matching expectation and the
1639 // corresponding action that needs to be taken in an ATOMIC
1640 // transaction. Otherwise another thread may call this mock
1641 // method in the middle and mess up the state.
1642 //
1643 // However, performing the action has to be left out of the critical
1644 // section. The reason is that we have no control on what the
1645 // action does (it can invoke an arbitrary user function or even a
1646 // mock function) and excessive locking could cause a dead lock.
1647 const ExpectationBasecxx . . $ testing/internal/ExpectationBase#* UntypedFindMatchingExpectationcxx . . $ testing/internal/FunctionMocker#UntypedFindMatchingExpectation(43a714f85d03c494).(
1648 const void* untyped_args, const void** untyped_action, bool* is_excessive,
1649 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* what, ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* why) override
1650 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex) {
1651 const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#& args =
1652 *static_cast<const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#*>(untyped_args);
1653 MutexLockcxx . . $ testing/internal/MutexLock# lcxx . . $ testing/internal/GTestMutexLock#GTestMutexLock(6c1d8b8db3bd6f5).(&g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex.);
1654 TypedExpectationcxx . . $ testing/internal/TypedExpectation#<Fcxx . . $ testing/internal/FunctionMocker#F#>* exp = this->FindMatchingExpectationLockedcxx . . $ testing/internal/FunctionMocker#FindMatchingExpectationLocked(8df703fabd9385e).(args);
1655 if (exp ==cxx . . $ testing/internal/`operator==`(67d151cd10fc7f68). nullptr) { // A match wasn't found.
1656 this->FormatUnexpectedCallMessageLockedcxx . . $ testing/internal/FunctionMocker#FormatUnexpectedCallMessageLocked(f07edd11cf5648b).(args, what, why);
1657 return nullptr;
1658 }
1659
1660 // This line must be done before calling GetActionForArguments(),
1661 // which will increment the call count for *exp and thus affect
1662 // its saturation status.
1663 *is_excessive = exp->IsSaturated();
1664 const Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/FunctionMocker#F#>* action = exp->GetActionForArguments(this, args, what, why);
1665 if (action !=cxx . . $ testing/internal/`operator!=`(67d151cd10fc7f68). nullptr && action->IsDoDefault())
1666 action = nullptr; // Normalize "do default" to NULL.
1667 *untyped_action = action;
1668 return exp;
1669 }
1670
1671 // Prints the given function arguments to the ostream.
1672 void UntypedPrintArgscxx . . $ testing/internal/FunctionMocker#UntypedPrintArgs(a94ecf7da2f13db4).(const void* untyped_args,
1673 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os) const override {
1674 const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#& args =
1675 *static_cast<const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#*>(untyped_args);
1676 UniversalPrintcxx . . $ testing/internal/UniversalPrint(931868cbe6a2ea88).(args, os);
1677 }
1678
1679 // Returns the expectation that matches the arguments, or NULL if no
1680 // expectation matches them.
1681 TypedExpectationcxx . . $ testing/internal/TypedExpectation#<Fcxx . . $ testing/internal/FunctionMocker#F#>* FindMatchingExpectationLockedcxx . . $ testing/internal/FunctionMocker#FindMatchingExpectationLocked(8df703fabd9385e).(const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#& args)
1682 const GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
1683 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
1684 // See the definition of untyped_expectations_ for why access to
1685 // it is unprotected here.
1686 for (typename UntypedExpectationscxx . . $ testing/internal/UntypedFunctionMockerBase#UntypedExpectations#::const_reverse_iteratorcxx . . $ std/vector#const_reverse_iterator# it =
1687 untyped_expectations_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_expectations_..rbegincxx . . $ std/vector#rbegin(7ffd9c4e53ea04dd).();
1688 it !=cxx . . $ testing/internal/`operator!=`(67d151cd10fc7f68). untyped_expectations_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_expectations_..rendcxx . . $ std/vector#rend(4f1ab9f89f58444d).(); ++cxx . . $ std/reverse_iterator#operator++(b4fad7494eaaab68).it) {
1689 TypedExpectationcxx . . $ testing/internal/TypedExpectation#<Fcxx . . $ testing/internal/FunctionMocker#F#>* const exp =
1690 static_cast<TypedExpectationcxx . . $ testing/internal/TypedExpectation#<Fcxx . . $ testing/internal/FunctionMocker#F#>*>(it->cxx . . $ std/reverse_iterator#`operator->`(a68f0626e749d9f6).getcxx . . $ std/__shared_ptr#get(68fd140ff244f535).());
1691 if (exp->ShouldHandleArguments(args)) {
1692 return exp;
1693 }
1694 }
1695 return nullptr;
1696 }
1697
1698 // Returns a message that the arguments don't match any expectation.
1699 void FormatUnexpectedCallMessageLockedcxx . . $ testing/internal/FunctionMocker#FormatUnexpectedCallMessageLocked(f07edd11cf5648b).(const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#& args,
1700 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* os,
1701 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* why) const
1702 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
1703 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
1704 *os <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nUnexpected mock function call - ";
1705 DescribeDefaultActionTocxx . . $ testing/internal/FunctionMocker#DescribeDefaultActionTo(9ad2a6b629e1823d).(args, os);
1706 PrintTriedExpectationsLockedcxx . . $ testing/internal/FunctionMocker#PrintTriedExpectationsLocked(9ad2a6b629e1823d).(args, why);
1707 }
1708
1709 // Prints a list of expectations that have been tried against the
1710 // current mock function call.
1711 void PrintTriedExpectationsLockedcxx . . $ testing/internal/FunctionMocker#PrintTriedExpectationsLocked(9ad2a6b629e1823d).(const ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#& args,
1712 ::stdcxx . . $ std/::ostreamcxx . . $ std/ostream#* why) const
1713 GTEST_EXCLUSIVE_LOCK_REQUIRED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2318:9`!(g_gmock_mutex) {
1714 g_gmock_mutexcxx . . $ testing/internal/g_gmock_mutex..AssertHeldcxx . . $ testing/internal/MutexBase#AssertHeld(83f5f38750778ac8).();
1715 const size_tcxx . . $ size_t# count = untyped_expectations_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_expectations_..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();
1716 *why <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Google Mock tried the following " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). count <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " "
1717 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (count == 1 ? "expectation, but it didn't match"
1718 : "expectations, but none matched")
1719 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ":\n";
1720 for (size_tcxx . . $ size_t# i = 0; i < count; i++) {
1721 TypedExpectationcxx . . $ testing/internal/TypedExpectation#<Fcxx . . $ testing/internal/FunctionMocker#F#>* const expectation =
1722 static_cast<TypedExpectationcxx . . $ testing/internal/TypedExpectation#<Fcxx . . $ testing/internal/FunctionMocker#F#>*>(untyped_expectations_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_expectations_.[i].get());
1723 *why <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n";
1724 expectation->DescribeLocationTo(why);
1725 if (count > 1) {
1726 *why <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "tried expectation #" <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). i <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ": ";
1727 }
1728 *why <<cxx . . $ testing/`operator<<`(5becdd4a2a15895b). expectation->source_text() <<cxx . . $ testing/`operator<<`(73453723d68cb77e). "...\n";
1729 expectation->ExplainMatchResultTo(args, why);
1730 expectation->DescribeCallCountTo(why);
1731 }
1732 }
1733
1734 // Performs the given action (or the default if it's null) with the given
1735 // arguments and returns the action's result.
1736 // L = *
1737 R PerformActioncxx . . $ testing/internal/FunctionMocker#PerformAction(a221910bf825f4d).(const void* untyped_action, ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#&& args,
1738 const stdcxx . . $ std/::stringcxx . . $ std/string#& call_description) const {
1739 if (untyped_action == nullptr) {
1740 return PerformDefaultActioncxx . . $ testing/internal/FunctionMocker#PerformDefaultAction(f62234fb081c5c30).(stdcxx . . $ std/::movecxx . . $ std/move(7316eb2979bdd03c).(args), call_description);
1741 }
1742
1743 // Make a copy of the action before performing it, in case the
1744 // action deletes the mock object (and thus deletes itself).
1745 const Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/FunctionMocker#F#> action = *static_cast<const Actioncxx . . $ testing/Action#<Fcxx . . $ testing/internal/FunctionMocker#F#>*>(untyped_action);
1746 return action.Perform(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(args));
1747 }
1748
1749 // Is it possible to store an object of the supplied type in a local variable
1750 // for the sake of printing it, then return it on to the caller?
1751 template <typename T>
1752 using can_print_resultcxx . . $ testing/internal/FunctionMocker#can_print_result# = internalcxx . . $ testing/internal/::conjunctioncxx . . $ testing/internal/conjunction#<
1753 // void can't be stored as an object (and we also don't need to print it).
1754 internalcxx . . $ testing/internal/::negationcxx . . $ testing/internal/negation#<stdcxx . . $ std/::is_void<T>>,
1755 // Non-moveable types can't be returned on to the user, so there's no way
1756 // for us to intercept and print them.
1757 stdcxx . . $ std/::is_move_constructible<T>>;
1758
1759 // Perform the supplied action, printing the result to os.
1760 template <typename T = R,
1761 typename stdcxx . . $ std/::enable_if<can_print_result<T>::value, int>::type = 0>
1762 R PerformActionAndPrintResultcxx . . $ testing/internal/FunctionMocker#PerformActionAndPrintResult(5e5bac5f7535af1b).(const void* const untyped_action,
1763 ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#&& args,
1764 const stdcxx . . $ std/::stringcxx . . $ std/string#& call_description,
1765 stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& os) {
1766 R result = PerformActioncxx . . $ testing/internal/FunctionMocker#PerformAction(a221910bf825f4d).(untyped_action, stdcxx . . $ std/::movecxx . . $ std/move(7316eb2979bdd03c).(args), call_description);
1767
1768 PrintAsActionResultcxx . . $ testing/internal/PrintAsActionResult(cd5921fea08118f1).(result, os);
1769 return stdcxx . . $ std/::forwardcxx . . $ std/forward(f56228ea88711827).<R>(result);
1770 }
1771
1772 // An overload for when it's not possible to print the result. In this case we
1773 // simply perform the action.
1774 template <typename T = R,
1775 typename stdcxx . . $ std/::enable_if<
1776 internal::negation<can_print_result<T>>::value, int>::type = 0>
1777 R PerformActionAndPrintResultcxx . . $ testing/internal/FunctionMocker#PerformActionAndPrintResult(5e5bac5f7535af1b).(const void* const untyped_action,
1778 ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#&& args,
1779 const stdcxx . . $ std/::stringcxx . . $ std/string#& call_description,
1780 stdcxx . . $ std/::ostreamcxx . . $ std/ostream#&) {
1781 return PerformActioncxx . . $ testing/internal/FunctionMocker#PerformAction(a221910bf825f4d).(untyped_action, stdcxx . . $ std/::movecxx . . $ std/move(7316eb2979bdd03c).(args), call_description);
1782 }
1783
1784 // Returns the result of invoking this mock function with the given
1785 // arguments. This function can be safely called from multiple
1786 // threads concurrently.
1787 R InvokeWithcxx . . $ testing/internal/FunctionMocker#InvokeWith(5344bf5853cf4a0f).(ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#&& args) GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex);
1788 }; // class FunctionMocker
1789
1790 // Calculates the result of invoking this mock function with the given
1791 // arguments, prints it, and returns it.
1792 template <typename R, typename... Args>
1793 R FunctionMockercxx . . $ testing/internal/FunctionMocker#<R(Args...)>::InvokeWithcxx . . $ testing/internal/FunctionMocker#InvokeWith(5344bf5853cf4a0f).(ArgumentTuplecxx . . $ testing/internal/FunctionMocker#ArgumentTuple#&& args)
1794 GTEST_LOCK_EXCLUDED_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:2319:9`!(g_gmock_mutex) {
1795 // See the definition of untyped_expectations_ for why access to it
1796 // is unprotected here.
1797 if (untyped_expectations_cxx . . $ testing/internal/UntypedFunctionMockerBase#untyped_expectations_..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() ==cxx . . $ testing/internal/`operator==`(67d151cd10fc7f68). 0) {
1798 // No expectation is set on this mock method - we have an
1799 // uninteresting call.
1800
1801 // We must get Google Mock's reaction on uninteresting calls
1802 // made on this mock object BEFORE performing the action,
1803 // because the action may DELETE the mock object and make the
1804 // following expression meaningless.
1805 const CallReactioncxx . . $ testing/internal/CallReaction# reaction =
1806 Mockcxx . . $ testing/Mock#::GetReactionOnUninterestingCallscxx . . $ testing/Mock#GetReactionOnUninterestingCalls(1c357ff12bdefb06).(MockObjectcxx . . $ testing/internal/UntypedFunctionMockerBase#MockObject(3a8ef3fdc6e817ef).());
1807
1808 // True if and only if we need to print this call's arguments and return
1809 // value. This definition must be kept in sync with
1810 // the behavior of ReportUninterestingCall().
1811 const bool need_to_report_uninteresting_call =
1812 // If the user allows this uninteresting call, we print it
1813 // only when they want informational messages.
1814 reaction == kAllowcxx . . $ testing/internal/kAllow. ? LogIsVisiblecxx . . $ testing/internal/LogIsVisible(1aef9e18b3950c63).(kInfocxx . . $ testing/internal/kInfo.) :
1815 // If the user wants this to be a warning, we print
1816 // it only when they want to see warnings.
1817 reaction == kWarncxx . . $ testing/internal/kWarn.
1818 ? LogIsVisiblecxx . . $ testing/internal/LogIsVisible(1aef9e18b3950c63).(kWarningcxx . . $ testing/internal/kWarning.)
1819 :
1820 // Otherwise, the user wants this to be an error, and we
1821 // should always print detailed information in the error.
1822 true;
1823
1824 if (!need_to_report_uninteresting_call) {
1825 // Perform the action without printing the call information.
1826 return this->PerformDefaultActioncxx . . $ testing/internal/FunctionMocker#PerformDefaultAction(f62234fb081c5c30).(
1827 stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(args), "Function call: " +cxx . . $ std/operator+(39ed2c165380f78e). stdcxx . . $ std/::stringcxx . . $ std/string#(Namecxx . . $ testing/internal/UntypedFunctionMockerBase#Name(a9f41ea0e82d88cf).()));
1828 }
1829
1830 // Warns about the uninteresting call.
1831 ::stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# sscxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).;
1832 this->UntypedDescribeUninterestingCallcxx . . $ testing/internal/FunctionMocker#UntypedDescribeUninterestingCall(a94ecf7da2f13db4).(&args, &ss);
1833
1834 // Perform the action, print the result, and then report the uninteresting
1835 // call.
1836 //
1837 // We use RAII to do the latter in case R is void or a non-moveable type. In
1838 // either case we can't assign it to a local variable.
1839 //
1840 // Note that std::bind() is essential here.
1841 // We *don't* use any local callback types (like lambdas).
1842 // Doing so slows down compilation dramatically because the *constructor* of
1843 // std::function<T> is re-instantiated with different template
1844 // parameters each time.
1845 const UninterestingCallCleanupHandlercxx . . $ testing/internal/UntypedFunctionMockerBase#UninterestingCallCleanupHandler# report_uninteresting_call = {reaction,
1846 ss};
1847
1848 return PerformActionAndPrintResult(nullptr, stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(args), ss.strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).(), ss);
1849 }
1850
1851 bool is_excessive = false;
1852 ::stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# sscxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).;
1853 ::stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# whycxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).;
1854 ::stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# loccxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).;
1855 const void* untyped_action = nullptr;
1856
1857 // The UntypedFindMatchingExpectation() function acquires and
1858 // releases g_gmock_mutex.
1859
1860 const ExpectationBasecxx . . $ testing/internal/ExpectationBase#* const untyped_expectation =
1861 this->UntypedFindMatchingExpectationcxx . . $ testing/internal/FunctionMocker#UntypedFindMatchingExpectation(43a714f85d03c494).(&args, &untyped_action,
1862 &is_excessive, &ss, &why);
1863 const bool found = untyped_expectation != nullptr;
1864
1865 // True if and only if we need to print the call's arguments
1866 // and return value.
1867 // This definition must be kept in sync with the uses of Expect()
1868 // and Log() in this function.
1869 const bool need_to_report_call =
1870 !found || is_excessive || LogIsVisiblecxx . . $ testing/internal/LogIsVisible(1aef9e18b3950c63).(kInfocxx . . $ testing/internal/kInfo.);
1871 if (!need_to_report_call) {
1872 // Perform the action without printing the call information.
1873 return PerformActioncxx . . $ testing/internal/FunctionMocker#PerformAction(a221910bf825f4d).(untyped_action, stdcxx . . $ std/::movecxx . . $ std/move(7316eb2979bdd03c).(args), "");
1874 }
1875
1876 ss <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Function call: " <<cxx . . $ testing/`operator<<`(73453723d68cb77e). Namecxx . . $ testing/internal/UntypedFunctionMockerBase#Name(a9f41ea0e82d88cf).();
1877 this->UntypedPrintArgscxx . . $ testing/internal/FunctionMocker#UntypedPrintArgs(a94ecf7da2f13db4).(&args, &ss);
1878
1879 // In case the action deletes a piece of the expectation, we
1880 // generate the message beforehand.
1881 if (found && !is_excessive) {
1882 untyped_expectation->DescribeLocationTocxx . . $ testing/internal/ExpectationBase#DescribeLocationTo(7b1875f5045e6781).(&loc);
1883 }
1884
1885 // Perform the action, print the result, and then fail or log in whatever way
1886 // is appropriate.
1887 //
1888 // We use RAII to do the latter in case R is void or a non-moveable type. In
1889 // either case we can't assign it to a local variable.
1890 //
1891 // Note that we *don't* use any local callback types (like lambdas) here.
1892 // Doing so slows down compilation dramatically because the *constructor* of
1893 // std::function<T> is re-instantiated with different template
1894 // parameters each time.
1895 const FailureCleanupHandlercxx . . $ testing/internal/UntypedFunctionMockerBase#FailureCleanupHandler# handle_failures = {
1896 ss, why, loc, untyped_expectation, found, is_excessive};
1897
1898 return PerformActionAndPrintResult(untyped_action, stdcxx . . $ std/::movecxx . . $ std/move(7316eb2979bdd03c).(args), ss.strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).(),
1899 ss);
1900 }
1901
1902 } // namespace internal
1903
1904 namespace internalcxx . . $ testing/internal/ {
1905
1906 template <typename F>
1907 class MockFunctioncxx . . $ testing/internal/MockFunction#;
1908
1909 template <typename R, typename... Args>
1910 class MockFunctioncxx . . $ testing/internal/MockFunction#<R(Args...)> {
1911 public:
1912 MockFunctioncxx . . $ testing/internal/MockFunction#`MockFunction<R (Args...)>`(f0110c2eddaf5fc3).(const MockFunction&) = delete;
1913 MockFunction& operatorcxx . . $ testing/internal/MockFunction#`operator=`(bf2fa835c52ee0f9).=(const MockFunction&) = delete;
1914
1915 stdcxx . . $ std/::functioncxx . . $ std/function#<R(Args...)> AsStdFunctioncxx . . $ testing/internal/MockFunction#AsStdFunction(683bf7b4eaf159b3).() {
1916 return [this](Args... args) -> R {
1917 return this->Callcxx . . $ testing/internal/MockFunction#Call(3f8709b945c588e8).(stdcxx . . $ std/::forwardcxx . . $ std/forward(f56228ea88711827).<Args>(args)...);
1918 };
1919 }
1920
1921 // Implementation detail: the expansion of the MOCK_METHOD macro.
1922 R Callcxx . . $ testing/internal/MockFunction#Call(3f8709b945c588e8).(Args... args) {
1923 mock_cxx . . $ testing/internal/MockFunction#mock_..SetOwnerAndName(this, "Call");
1924 return mock_cxx . . $ testing/internal/MockFunction#mock_..Invoke(stdcxx . . $ std/::forwardcxx . . $ std/forward(f56228ea88711827).<Args>(args)...);
1925 }
1926
1927 MockSpeccxx . . $ testing/internal/MockSpec#<R(Args...)> gmock_Callcxx . . $ testing/internal/MockFunction#gmock_Call(cf68f14086cc3a66).(Matchercxx . . $ testing/Matcher#<Args>... m) {
1928 mock_cxx . . $ testing/internal/MockFunction#mock_..RegisterOwner(this);
1929 return mock_cxx . . $ testing/internal/MockFunction#mock_..With(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(m)...);
1930 }
1931
1932 MockSpeccxx . . $ testing/internal/MockSpec#<R(Args...)> gmock_Callcxx . . $ testing/internal/MockFunction#gmock_Call(85557084e4a6b241).(const WithoutMatcherscxx . . $ testing/internal/WithoutMatchers#&, R (*)(Args...)) {
1933 return this->gmock_Call(::testingcxx . . $ testing/::Acxx . . $ testing/A(7149edf3a1255e15).<Args>()...);
1934 }
1935
1936 protected:
1937 MockFunctioncxx . . $ testing/internal/MockFunction#`MockFunction<R (Args...)>`(49f6e7a06ebc5aa8).() = default;
1938 ~cxx . . $ testing/internal/MockFunction#`~MockFunction<R (Args...)>`(49f6e7a06ebc5aa8).MockFunction() = default;
1939
1940 private:
1941 FunctionMockercxx . . $ testing/internal/FunctionMocker#<R(Args...)> mock_cxx . . $ testing/internal/MockFunction#mock_.;
1942 };
1943
1944 /*
1945 The SignatureOf<F> struct is a meta-function returning function signature
1946 corresponding to the provided F argument.
1947
1948 It makes use of MockFunction easier by allowing it to accept more F arguments
1949 than just function signatures.
1950
1951 Specializations provided here cover a signature type itself and any template
1952 that can be parameterized with a signature, including std::function and
1953 boost::function.
1954 */
1955
1956 template <typename F, typename = void>
1957 struct SignatureOfcxx . . $ testing/internal/SignatureOf#;
1958
1959 template <typename R, typename... Args>
1960 struct SignatureOfcxx . . $ testing/internal/SignatureOf#<R(Args...)> {
1961 using typecxx . . $ testing/internal/SignatureOf#type# = R(Args...);
1962 };
1963
1964 template <template <typename> class C, typename F>
1965 struct SignatureOfcxx . . $ testing/internal/SignatureOf#<C<F>,
1966 typename stdcxx . . $ std/::enable_if<std::is_function<F>::value>::type>
1967 : SignatureOfcxx . . $ testing/internal/SignatureOf#<F> {};
1968
1969 template <typename F>
1970 using SignatureOfTcxx . . $ testing/internal/SignatureOfT# = typename SignatureOfcxx . . $ testing/internal/SignatureOf#<F>::type;
1971
1972 } // namespace internal
1973
1974 // A MockFunction<F> type has one mock method whose type is
1975 // internal::SignatureOfT<F>. It is useful when you just want your
1976 // test code to emit some messages and have Google Mock verify the
1977 // right messages are sent (and perhaps at the right times). For
1978 // example, if you are exercising code:
1979 //
1980 // Foo(1);
1981 // Foo(2);
1982 // Foo(3);
1983 //
1984 // and want to verify that Foo(1) and Foo(3) both invoke
1985 // mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
1986 //
1987 // TEST(FooTest, InvokesBarCorrectly) {
1988 // MyMock mock;
1989 // MockFunction<void(string check_point_name)> check;
1990 // {
1991 // InSequence s;
1992 //
1993 // EXPECT_CALL(mock, Bar("a"));
1994 // EXPECT_CALL(check, Call("1"));
1995 // EXPECT_CALL(check, Call("2"));
1996 // EXPECT_CALL(mock, Bar("a"));
1997 // }
1998 // Foo(1);
1999 // check.Call("1");
2000 // Foo(2);
2001 // check.Call("2");
2002 // Foo(3);
2003 // }
2004 //
2005 // The expectation spec says that the first Bar("a") must happen
2006 // before check point "1", the second Bar("a") must happen after check
2007 // point "2", and nothing should happen between the two check
2008 // points. The explicit check points make it easy to tell which
2009 // Bar("a") is called by which call to Foo().
2010 //
2011 // MockFunction<F> can also be used to exercise code that accepts
2012 // std::function<internal::SignatureOfT<F>> callbacks. To do so, use
2013 // AsStdFunction() method to create std::function proxy forwarding to
2014 // original object's Call. Example:
2015 //
2016 // TEST(FooTest, RunsCallbackWithBarArgument) {
2017 // MockFunction<int(string)> callback;
2018 // EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
2019 // Foo(callback.AsStdFunction());
2020 // }
2021 //
2022 // The internal::SignatureOfT<F> indirection allows to use other types
2023 // than just function signature type. This is typically useful when
2024 // providing a mock for a predefined std::function type. Example:
2025 //
2026 // using FilterPredicate = std::function<bool(string)>;
2027 // void MyFilterAlgorithm(FilterPredicate predicate);
2028 //
2029 // TEST(FooTest, FilterPredicateAlwaysAccepts) {
2030 // MockFunction<FilterPredicate> predicateMock;
2031 // EXPECT_CALL(predicateMock, Call(_)).WillRepeatedly(Return(true));
2032 // MyFilterAlgorithm(predicateMock.AsStdFunction());
2033 // }
2034 template <typename F>
2035 class MockFunctioncxx . . $ testing/MockFunction# : public internalcxx . . $ testing/internal/::MockFunctioncxx . . $ testing/internal/MockFunction#<internalcxx . . $ testing/internal/::SignatureOfTcxx . . $ testing/internal/SignatureOfT#<F>> {
2036 using Basecxx . . $ testing/MockFunction#Base# = internalcxx . . $ testing/internal/::MockFunctioncxx . . $ testing/internal/MockFunction#<internalcxx . . $ testing/internal/::SignatureOfTcxx . . $ testing/internal/SignatureOfT#<F>>;
2037
2038 public:
2039 using Basecxx . . $ testing/MockFunction#Base#::Basecxx . . $ testing/MockFunction#Base#;
2040 };
2041
2042 // The style guide prohibits "using" statements in a namespace scope
2043 // inside a header file. However, the MockSpec class template is
2044 // meant to be defined in the ::testing namespace. The following line
2045 // is just a trick for working around a bug in MSVC 8.0, which cannot
2046 // handle it if we define MockSpec in ::testing.
2047 using internalcxx . . $ testing/internal/::MockSpeccxx . . $ testing/MockSpec#;
2048
2049 // Const(x) is a convenient function for obtaining a const reference
2050 // to x. This is useful for setting expectations on an overloaded
2051 // const mock method, e.g.
2052 //
2053 // class MockFoo : public FooInterface {
2054 // public:
2055 // MOCK_METHOD0(Bar, int());
2056 // MOCK_CONST_METHOD0(Bar, int&());
2057 // };
2058 //
2059 // MockFoo foo;
2060 // // Expects a call to non-const MockFoo::Bar().
2061 // EXPECT_CALL(foo, Bar());
2062 // // Expects a call to const MockFoo::Bar().
2063 // EXPECT_CALL(Const(foo), Bar());
2064 template <typename T>
2065 inline const T& Constcxx . . $ testing/Const(975d6b1eaf7f4b97).(const T& x) {
2066 return x;
2067 }
2068
2069 // Constructs an Expectation object that references and co-owns exp.
2070 inline Expectationcxx . . $ testing/Expectation#::Expectationcxx . . $ testing/Expectation#Expectation(707f32d011ded14c).(internalcxx . . $ testing/internal/::ExpectationBasecxx . . $ testing/internal/ExpectationBase#& exp) // NOLINT
2071 : expectation_base_cxx . . $ testing/Expectation#expectation_base_.(exp.GetHandlecxx . . $ testing/internal/ExpectationBase#GetHandle(664511b22ed2e5f6).().expectation_basecxx . . $ testing/Expectation#expectation_base(1ba548a909ff7ac8).()) {}
2072
2073 } // namespace testing
2074
2075 GTEST_DISABLE_MSC_WARNINGS_POP_cxx . . $ `src/external/googletest/googletest/include/gtest/internal/gtest-port.h:376:9`!() // 4251
2076
2077 // Implementation for ON_CALL and EXPECT_CALL macros. A separate macro is
2078 // required to avoid compile errors when the name of the method used in call is
2079 // a result of macro expansion. See CompilesWithMethodNameExpandedFromMacro
2080 // tests in internal/gmock-spec-builders_test.cc for more details.
2081 //
2082 // This macro supports statements both with and without parameter matchers. If
2083 // the parameter list is omitted, gMock will accept any parameters, which allows
2084 // tests to be written that don't need to encode the number of method
2085 // parameter. This technique may only be used for non-overloaded methods.
2086 //
2087 // // These are the same:
2088 // ON_CALL(mock, NoArgsMethod()).WillByDefault(...);
2089 // ON_CALL(mock, NoArgsMethod).WillByDefault(...);
2090 //
2091 // // As are these:
2092 // ON_CALL(mock, TwoArgsMethod(_, _)).WillByDefault(...);
2093 // ON_CALL(mock, TwoArgsMethod).WillByDefault(...);
2094 //
2095 // // Can also specify args if you want, of course:
2096 // ON_CALL(mock, TwoArgsMethod(_, 45)).WillByDefault(...);
2097 //
2098 // // Overloads work as long as you specify parameters:
2099 // ON_CALL(mock, OverloadedMethod(_)).WillByDefault(...);
2100 // ON_CALL(mock, OverloadedMethod(_, _)).WillByDefault(...);
2101 //
2102 // // Oops! Which overload did you want?
2103 // ON_CALL(mock, OverloadedMethod).WillByDefault(...);
2104 // => ERROR: call to member function 'gmock_OverloadedMethod' is ambiguous
2105 //
2106 // How this works: The mock class uses two overloads of the gmock_Method
2107 // expectation setter method plus an operator() overload on the MockSpec object.
2108 // In the matcher list form, the macro expands to:
2109 //
2110 // // This statement:
2111 // ON_CALL(mock, TwoArgsMethod(_, 45))...
2112 //
2113 // // ...expands to:
2114 // mock.gmock_TwoArgsMethod(_, 45)(WithoutMatchers(), nullptr)...
2115 // |-------------v---------------||------------v-------------|
2116 // invokes first overload swallowed by operator()
2117 //
2118 // // ...which is essentially:
2119 // mock.gmock_TwoArgsMethod(_, 45)...
2120 //
2121 // Whereas the form without a matcher list:
2122 //
2123 // // This statement:
2124 // ON_CALL(mock, TwoArgsMethod)...
2125 //
2126 // // ...expands to:
2127 // mock.gmock_TwoArgsMethod(WithoutMatchers(), nullptr)...
2128 // |-----------------------v--------------------------|
2129 // invokes second overload
2130 //
2131 // // ...which is essentially:
2132 // mock.gmock_TwoArgsMethod(_, _)...
2133 //
2134 // The WithoutMatchers() argument is used to disambiguate overloads and to
2135 // block the caller from accidentally invoking the second overload directly. The
2136 // second argument is an internal type derived from the method signature. The
2137 // failure to disambiguate two overloads of this method in the ON_CALL statement
2138 // is how we block callers from setting expectations on overloaded methods.
2139 #define GMOCK_ON_CALL_IMPL_cxx . . $ `src/external/googletest/googlemock/include/gmock/gmock-spec-builders.h:2139:9`!(mock_expr, Setter, call) \
2140 ((mock_expr).gmock_##call)(::testing::internal::GetWithoutMatchers(), \
2141 nullptr) \
2142 .Setter(__FILE__, __LINE__, #mock_expr, #call)
2143
2144 #define ON_CALLcxx . . $ `src/external/googletest/googlemock/include/gmock/gmock-spec-builders.h:2144:9`!(obj, call) \
2145 GMOCK_ON_CALL_IMPL_(obj, InternalDefaultActionSetAt, call)
2146
2147 #define EXPECT_CALLcxx . . $ `src/external/googletest/googlemock/include/gmock/gmock-spec-builders.h:2147:9`!(obj, call) \
2148 GMOCK_ON_CALL_IMPL_(obj, InternalExpectedAt, call)
2149
2150 #endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_