Index: third_party/WebKit/Source/modules/payments/PaymentRequestTestBase.cpp |
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestTestBase.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestTestBase.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b9f7e6a1cf50bd4198a99c58244f5dbe93726099 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequestTestBase.cpp |
@@ -0,0 +1,34 @@ |
+// 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. |
+ |
+#include "modules/payments/PaymentRequestTestBase.h" |
+ |
+#include "bindings/core/v8/ScriptState.h" |
+#include "core/testing/DummyPageHolder.h" |
+ |
+namespace blink { |
+ |
+PaymentRequestTestBase::PaymentRequestTestBase() |
+ : m_page(DummyPageHolder::create()) |
+{ |
+ setSecurityOrigin("https://www.example.com/"); |
+} |
+ |
+PaymentRequestTestBase::~PaymentRequestTestBase() {} |
+ |
+ScriptState* PaymentRequestTestBase::getScriptState() |
+{ |
+ return ScriptState::forMainWorld(m_page->document().frame()); |
+} |
+ |
+ExceptionState& PaymentRequestTestBase::getExceptionState() |
+{ |
+ return m_exceptionState; |
+} |
+ |
+void PaymentRequestTestBase::setSecurityOrigin(const String& securityOrigin) |
+{ |
+ m_page->document().setSecurityOrigin(SecurityOrigin::create(KURL(KURL(), securityOrigin))); |
+} |
+} // namespace blink |