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

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp

Issue 2145553002: Parameterize OnError method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Parameterize OnError method. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/payments/PaymentTestHelper.h" 5 #include "modules/payments/PaymentTestHelper.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "modules/payments/PaymentCurrencyAmount.h" 9 #include "modules/payments/PaymentCurrencyAmount.h"
10 #include "modules/payments/PaymentMethodData.h" 10 #include "modules/payments/PaymentMethodData.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 PaymentRequestMockFunctionScope::~PaymentRequestMockFunctionScope() 148 PaymentRequestMockFunctionScope::~PaymentRequestMockFunctionScope()
149 { 149 {
150 v8::MicrotasksScope::PerformCheckpoint(m_scriptState->isolate()); 150 v8::MicrotasksScope::PerformCheckpoint(m_scriptState->isolate());
151 for (MockFunction* mockFunction : m_mockFunctions) { 151 for (MockFunction* mockFunction : m_mockFunctions) {
152 testing::Mock::VerifyAndClearExpectations(mockFunction); 152 testing::Mock::VerifyAndClearExpectations(mockFunction);
153 } 153 }
154 } 154 }
155 155
156 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall(String* capt or)
157 {
158 m_mockFunctions.append(new MockFunction(m_scriptState, captor));
159 return m_mockFunctions.last()->bind();
160 }
161
156 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall() 162 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall()
157 { 163 {
158 m_mockFunctions.append(new MockFunction(m_scriptState)); 164 m_mockFunctions.append(new MockFunction(m_scriptState));
159 EXPECT_CALL(*m_mockFunctions.last(), call(testing::_)); 165 // EXPECT_CALL(*m_mockFunctions.last(), call(testing::_));
pals 2016/07/12 11:42:56 As we have overridden the "call" method, EXPECT_CA
pals 2016/07/12 11:45:01 [1] https://cs.chromium.org/chromium/src/third_par
please use gerrit instead 2016/07/12 15:57:35 Uncomment
pals 2016/07/13 05:54:27 Done.
160 return m_mockFunctions.last()->bind(); 166 return m_mockFunctions.last()->bind();
161 } 167 }
162 168
163 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectNoCall() 169 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectNoCall()
164 { 170 {
165 m_mockFunctions.append(new MockFunction(m_scriptState)); 171 m_mockFunctions.append(new MockFunction(m_scriptState));
166 EXPECT_CALL(*m_mockFunctions.last(), call(testing::_)).Times(0); 172 // EXPECT_CALL(*m_mockFunctions.last(), call(testing::_)).Times(0);
please use gerrit instead 2016/07/12 15:57:35 Uncomment
pals 2016/07/13 05:54:28 Done.
167 return m_mockFunctions.last()->bind(); 173 return m_mockFunctions.last()->bind();
168 } 174 }
169 175
please use gerrit instead 2016/07/12 15:57:35 Put the following code before MockFunction() const
pals 2016/07/13 05:54:28 Nice. Thank you. Done. Thanks
170 PaymentRequestMockFunctionScope::MockFunction::MockFunction(ScriptState* scriptS tate) 176 PaymentRequestMockFunctionScope::MockFunction::MockFunction(ScriptState* scriptS tate)
171 : ScriptFunction(scriptState) 177 : ScriptFunction(scriptState)
172 { 178 {
173 ON_CALL(*this, call(testing::_)).WillByDefault(testing::ReturnArg<0>()); 179 // ON_CALL(*this, call(testing::_)).WillByDefault(testing::ReturnArg<0>());
please use gerrit instead 2016/07/12 15:57:35 Change this line to the following: ON_CALL(*this,
pals 2016/07/13 05:54:27 Done.
180 }
181
182 PaymentRequestMockFunctionScope::MockFunction::MockFunction(ScriptState* scriptS tate, String* captor)
183 : ScriptFunction(scriptState)
184 , m_value(captor)
185 {
174 } 186 }
175 187
176 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() 188 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind()
177 { 189 {
178 return bindToV8Function(); 190 return bindToV8Function();
179 } 191 }
180 192
181 } // namespace blink 193 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698