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

Unified Diff: Source/core/editing/VisiblePositionTest.cpp

Issue 1204953002: Introduce EditingTestBase to share code among test files for editing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-06-24T15:31:52 Rebase for chaning bot(?) 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 | « Source/core/editing/EditingTestBase.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisiblePositionTest.cpp
diff --git a/Source/core/editing/VisiblePositionTest.cpp b/Source/core/editing/VisiblePositionTest.cpp
index bd80a3a0a08c7dcd677e7cd7f30bd8a9b2a3e309..ad5145d184769f629f524caff4eec6fdcf6af177 100644
--- a/Source/core/editing/VisiblePositionTest.cpp
+++ b/Source/core/editing/VisiblePositionTest.cpp
@@ -5,67 +5,13 @@
#include "config.h"
#include "core/editing/VisiblePosition.h"
-#include "core/dom/Document.h"
-#include "core/dom/Range.h"
-#include "core/dom/Text.h"
-#include "core/html/HTMLElement.h"
-#include "core/testing/CoreTestHelpers.h"
-#include "core/testing/DummyPageHolder.h"
-#include <gtest/gtest.h>
+#include "core/editing/EditingTestBase.h"
namespace blink {
-namespace {
-
-Position positionInDOMTree(Node& anchor, int offset)
-{
- return Position(&anchor, offset, Position::PositionIsOffsetInAnchor);
-}
-
-PositionInComposedTree positionInComposedTree(Node& anchor, int offset)
-{
- return PositionInComposedTree(&anchor, offset, PositionInComposedTree::PositionIsOffsetInAnchor);
-}
-
-} // namespace
-
-class VisiblePositionTest : public ::testing::Test {
-protected:
- void SetUp() override;
-
- Document& document() const { return m_dummyPageHolder->document(); }
-
- static PassRefPtrWillBeRawPtr<ShadowRoot> createShadowRootForElementWithIDAndSetInnerHTML(TreeScope&, const char* hostElementID, const char* shadowRootContent);
-
- void setBodyContent(const char*);
- PassRefPtrWillBeRawPtr<ShadowRoot> setShadowContent(const char*);
-
-private:
- OwnPtr<DummyPageHolder> m_dummyPageHolder;
+class VisiblePositionTest : public EditingTestBase {
};
-void VisiblePositionTest::SetUp()
-{
- m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
-}
-
-PassRefPtrWillBeRawPtr<ShadowRoot> VisiblePositionTest::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();
-}
-
-void VisiblePositionTest::setBodyContent(const char* bodyContent)
-{
- document().body()->setInnerHTML(String::fromUTF8(bodyContent), ASSERT_NO_EXCEPTION);
-}
-
-PassRefPtrWillBeRawPtr<ShadowRoot> VisiblePositionTest::setShadowContent(const char* shadowContent)
-{
- return createShadowRootForElementWithIDAndSetInnerHTML(document(), "host", shadowContent);
-}
-
TEST_F(VisiblePositionTest, ShadowDistributedNodes)
{
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
« no previous file with comments | « Source/core/editing/EditingTestBase.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698