| OLD | NEW |
| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 PaymentRequestMockFunctionScope::~PaymentRequestMockFunctionScope() { | 180 PaymentRequestMockFunctionScope::~PaymentRequestMockFunctionScope() { |
| 181 v8::MicrotasksScope::PerformCheckpoint(m_scriptState->isolate()); | 181 v8::MicrotasksScope::PerformCheckpoint(m_scriptState->isolate()); |
| 182 for (MockFunction* mockFunction : m_mockFunctions) { | 182 for (MockFunction* mockFunction : m_mockFunctions) { |
| 183 testing::Mock::VerifyAndClearExpectations(mockFunction); | 183 testing::Mock::VerifyAndClearExpectations(mockFunction); |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 | 186 |
| 187 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall( | 187 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall( |
| 188 String* captor) { | 188 String* captor) { |
| 189 m_mockFunctions.append(new MockFunction(m_scriptState, captor)); | 189 m_mockFunctions.push_back(new MockFunction(m_scriptState, captor)); |
| 190 EXPECT_CALL(*m_mockFunctions.back(), call(testing::_)); | 190 EXPECT_CALL(*m_mockFunctions.back(), call(testing::_)); |
| 191 return m_mockFunctions.back()->bind(); | 191 return m_mockFunctions.back()->bind(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall() { | 194 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall() { |
| 195 m_mockFunctions.append(new MockFunction(m_scriptState)); | 195 m_mockFunctions.push_back(new MockFunction(m_scriptState)); |
| 196 EXPECT_CALL(*m_mockFunctions.back(), call(testing::_)); | 196 EXPECT_CALL(*m_mockFunctions.back(), call(testing::_)); |
| 197 return m_mockFunctions.back()->bind(); | 197 return m_mockFunctions.back()->bind(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectNoCall() { | 200 v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectNoCall() { |
| 201 m_mockFunctions.append(new MockFunction(m_scriptState)); | 201 m_mockFunctions.push_back(new MockFunction(m_scriptState)); |
| 202 EXPECT_CALL(*m_mockFunctions.back(), call(testing::_)).Times(0); | 202 EXPECT_CALL(*m_mockFunctions.back(), call(testing::_)).Times(0); |
| 203 return m_mockFunctions.back()->bind(); | 203 return m_mockFunctions.back()->bind(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 ACTION_P(SaveValueIn, captor) { | 206 ACTION_P(SaveValueIn, captor) { |
| 207 *captor = toCoreString(arg0.v8Value() | 207 *captor = toCoreString(arg0.v8Value() |
| 208 ->ToString(arg0.getScriptState()->context()) | 208 ->ToString(arg0.getScriptState()->context()) |
| 209 .ToLocalChecked()); | 209 .ToLocalChecked()); |
| 210 } | 210 } |
| 211 | 211 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 222 ON_CALL(*this, call(testing::_)) | 222 ON_CALL(*this, call(testing::_)) |
| 223 .WillByDefault( | 223 .WillByDefault( |
| 224 testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>())); | 224 testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>())); |
| 225 } | 225 } |
| 226 | 226 |
| 227 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() { | 227 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() { |
| 228 return bindToV8Function(); | 228 return bindToV8Function(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace blink | 231 } // namespace blink |
| OLD | NEW |