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

Unified Diff: Source/core/dom/PositionTest.cpp

Issue 1202263004: Use EditingTestBase for PositionTest (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review Created 5 years, 6 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
« no previous file with comments | « no previous file | Source/core/editing/EditingTestBase.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/PositionTest.cpp
diff --git a/Source/core/dom/PositionTest.cpp b/Source/core/dom/PositionTest.cpp
index 40a78e4c65590313919f55ab220c1de5e465154d..f1e4ef9092636f51ca133325d8611645de93cfe6 100644
--- a/Source/core/dom/PositionTest.cpp
+++ b/Source/core/dom/PositionTest.cpp
@@ -5,60 +5,13 @@
#include "config.h"
#include "core/dom/Position.h"
-#include "core/html/HTMLBodyElement.h"
-#include "core/html/HTMLDocument.h"
-#include "core/html/HTMLElement.h"
-#include "core/html/HTMLHtmlElement.h"
-#include "core/testing/CoreTestHelpers.h"
-#include "wtf/RefPtr.h"
-#include <gtest/gtest.h>
+#include "core/editing/EditingTestBase.h"
namespace blink {
-class PositionTest : public ::testing::Test {
-protected:
- void SetUp() override;
-
- HTMLDocument& document() const;
- void setBodyContent(const char*);
- PassRefPtrWillBeRawPtr<ShadowRoot> setShadowContent(const char*);
-
-private:
- RefPtrWillBePersistent<HTMLDocument> m_document;
+class PositionTest : public EditingTestBase {
};
-void PositionTest::SetUp()
-{
- m_document = HTMLDocument::create();
- RefPtrWillBeRawPtr<HTMLHtmlElement> html = HTMLHtmlElement::create(*m_document);
- html->appendChild(HTMLBodyElement::create(*m_document));
- m_document->appendChild(html.release());
-}
-
-HTMLDocument& PositionTest::document() const
-{
- return *m_document;
-}
-
-void PositionTest::setBodyContent(const char* bodyContent)
-{
- document().body()->setInnerHTML(String::fromUTF8(bodyContent), ASSERT_NO_EXCEPTION);
-}
-
-static PassRefPtrWillBeRawPtr<ShadowRoot> createShadowRootForElementWithIDAndSetInnerHTML(TreeScope& scope, const char* hostElementID, const char* shadowRootContent)
-{
- RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = scope.getElementById(AtomicString::fromUTF8(hostElementID))->createShadowRoot(ASSERT_NO_EXCEPTION);
- shadowRoot->setInnerHTML(String::fromUTF8(shadowRootContent), ASSERT_NO_EXCEPTION);
- return shadowRoot.release();
-}
-
-PassRefPtrWillBeRawPtr<ShadowRoot> PositionTest::setShadowContent(const char* shadowContent)
-{
- RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = createShadowRootForElementWithIDAndSetInnerHTML(document(), "host", shadowContent);
- document().recalcDistribution();
- return shadowRoot;
-}
-
TEST_F(PositionTest, NodeAsRangeLastNodeNull)
{
EXPECT_EQ(nullptr, Position().nodeAsRangeLastNode());
« no previous file with comments | « no previous file | Source/core/editing/EditingTestBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698