Chromium Code Reviews| Index: third_party/WebKit/Source/modules/payments/PaymentRequestTestBase.h |
| diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestTestBase.h b/third_party/WebKit/Source/modules/payments/PaymentRequestTestBase.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7a91be7681ea0d6c002c5898b270211d76944b25 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestTestBase.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PaymentRequestTestBase_h |
| +#define PaymentRequestTestBase_h |
| + |
| +#include "bindings/core/v8/ExceptionState.h" |
| +#include "bindings/core/v8/ScriptFunction.h" |
| +#include "bindings/core/v8/V8BindingForTesting.h" |
| +#include "platform/heap/Persistent.h" |
| +#include "testing/gmock/include/gmock/gmock.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| +#include "wtf/Vector.h" |
| +#include "wtf/text/WTFString.h" |
| + |
| +namespace blink { |
| + |
| +class ScriptState; |
| + |
| +// A base fixture for PaymentRequest tests. |
| +class PaymentRequestTestBase : public testing::Test { |
| +public: |
| + PaymentRequestTestBase(); |
| + ~PaymentRequestTestBase() override; |
| + |
| + ScriptState* getScriptState(); |
| + ExceptionState& getExceptionState(); |
| + |
| + void setSecurityOrigin(const String&); |
| + |
| + v8::Local<v8::Function> expectCall(); |
| + v8::Local<v8::Function> expectNoCall(); |
| + void firePromiseCallbacks(); |
| + |
| +private: |
| + class MockFunction : public ScriptFunction { |
| + public: |
| + explicit MockFunction(ScriptState*); |
| + v8::Local<v8::Function> bind(); |
| + MOCK_METHOD1(call, ScriptValue(ScriptValue)); |
| + }; |
| + |
| + ScriptStateForTestingWithPage m_scriptState; |
| + TrackExceptionState m_exceptionState; |
|
haraken
2016/06/13 01:31:10
V8TestingScope is an abstraction class that encaps
please use gerrit instead
2016/06/14 05:12:40
Done.
|
| + Vector<Persistent<MockFunction>> m_mockFunctions; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // PaymentRequestTestBase_h |