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

Unified 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: fixing integration test failures 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 side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698