Index: third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp |
diff --git a/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp b/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp |
index 1d2293ef7873e3b0d35642af25933e4ff78a6c85..fec7b0d5353bc6a9ad4ede6f650f63a9e8d0cfe6 100644 |
--- a/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp |
+++ b/third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp |
@@ -153,6 +153,12 @@ PaymentRequestMockFunctionScope::~PaymentRequestMockFunctionScope() |
} |
} |
+v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall(String* captor) |
+{ |
+ m_mockFunctions.append(new MockFunction(m_scriptState, captor)); |
+ return m_mockFunctions.last()->bind(); |
+} |
+ |
v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectCall() |
{ |
m_mockFunctions.append(new MockFunction(m_scriptState)); |
@@ -167,12 +173,25 @@ v8::Local<v8::Function> PaymentRequestMockFunctionScope::expectNoCall() |
return m_mockFunctions.last()->bind(); |
} |
+ACTION_P(SaveValueIn, captor) |
+{ |
+ *captor = toCoreString(arg0.v8Value()->ToString(arg0.getScriptState()->context()).ToLocalChecked()); |
+} |
+ |
PaymentRequestMockFunctionScope::MockFunction::MockFunction(ScriptState* scriptState) |
: ScriptFunction(scriptState) |
{ |
ON_CALL(*this, call(testing::_)).WillByDefault(testing::ReturnArg<0>()); |
} |
+PaymentRequestMockFunctionScope::MockFunction::MockFunction(ScriptState* scriptState, String* captor) |
+ : ScriptFunction(scriptState) |
+ , m_value(captor) |
+{ |
+ ON_CALL(*this, call(testing::_)).WillByDefault( |
+ testing::DoAll(SaveValueIn(m_value), testing::ReturnArg<0>())); |
+} |
+ |
v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::bind() |
{ |
return bindToV8Function(); |