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

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

Issue 2502413004: WTF/std normalization: replace WTF::Vector::last with ::back (Closed)
Patch Set: rebase Created 4 years, 1 month 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 PaymentRequestMockFunctionScope::~PaymentRequestMockFunctionScope() { 182 PaymentRequestMockFunctionScope::~PaymentRequestMockFunctionScope() {
183 v8::MicrotasksScope::PerformCheckpoint(m_scriptState->isolate()); 183 v8::MicrotasksScope::PerformCheckpoint(m_scriptState->isolate());
184 for (MockFunction* mockFunction : m_mockFunctions) { 184 for (MockFunction* mockFunction : m_mockFunctions) {
185 testing::Mock::VerifyAndClearExpectations(mockFunction); 185 testing::Mock::VerifyAndClearExpectations(mockFunction);
186 } 186 }
187 } 187 }
188 188
189 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall( 189 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall(
190 String* captor) { 190 String* captor) {
191 m_mockFunctions.append(new MockFunction(m_scriptState, captor)); 191 m_mockFunctions.append(new MockFunction(m_scriptState, captor));
192 EXPECT_CALL(*m_mockFunctions.last(), call(testing::_)); 192 EXPECT_CALL(*m_mockFunctions.back(), call(testing::_));
193 return m_mockFunctions.last()->bind(); 193 return m_mockFunctions.back()->bind();
194 } 194 }
195 195
196 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall() { 196 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall() {
197 m_mockFunctions.append(new MockFunction(m_scriptState)); 197 m_mockFunctions.append(new MockFunction(m_scriptState));
198 EXPECT_CALL(*m_mockFunctions.last(), call(testing::_)); 198 EXPECT_CALL(*m_mockFunctions.back(), call(testing::_));
199 return m_mockFunctions.last()->bind(); 199 return m_mockFunctions.back()->bind();
200 } 200 }
201 201
202 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectNoCall() { 202 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectNoCall() {
203 m_mockFunctions.append(new MockFunction(m_scriptState)); 203 m_mockFunctions.append(new MockFunction(m_scriptState));
204 EXPECT_CALL(*m_mockFunctions.last(), call(testing::_)).Times(0); 204 EXPECT_CALL(*m_mockFunctions.back(), call(testing::_)).Times(0);
205 return m_mockFunctions.last()->bind(); 205 return m_mockFunctions.back()->bind();
206 } 206 }
207 207
208 ACTION_P(SaveValueIn, captor) { 208 ACTION_P(SaveValueIn, captor) {
209 *captor = toCoreString(arg0.v8Value() 209 *captor = toCoreString(arg0.v8Value()
210 ->ToString(arg0.getScriptState()->context()) 210 ->ToString(arg0.getScriptState()->context())
211 .ToLocalChecked()); 211 .ToLocalChecked());
212 } 212 }
213 213
214 PaymentRequestMockFunctionScope::MockFunction::MockFunction( 214 PaymentRequestMockFunctionScope::MockFunction::MockFunction(
215 ScriptState* scriptState) 215 ScriptState* scriptState)
216 : ScriptFunction(scriptState) { 216 : ScriptFunction(scriptState) {
217 ON_CALL(*this, call(testing::_)).WillByDefault(testing::ReturnArg<0>()); 217 ON_CALL(*this, call(testing::_)).WillByDefault(testing::ReturnArg<0>());
218 } 218 }
219 219
220 PaymentRequestMockFunctionScope::MockFunction::MockFunction( 220 PaymentRequestMockFunctionScope::MockFunction::MockFunction(
221 ScriptState* scriptState, 221 ScriptState* scriptState,
222 String* captor) 222 String* captor)
223 : ScriptFunction(scriptState), m_value(captor) { 223 : ScriptFunction(scriptState), m_value(captor) {
224 ON_CALL(*this, call(testing::_)) 224 ON_CALL(*this, call(testing::_))
225 .WillByDefault( 225 .WillByDefault(
226 testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>())); 226 testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>()));
227 } 227 }
228 228
229 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() { 229 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() {
230 return bindToV8Function(); 230 return bindToV8Function();
231 } 231 }
232 232
233 } // namespace blink 233 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698