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

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

Issue 1202863003: Use EditingTestBase for VisibleSelectionTest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisibleSelectionTest.cpp
diff --git a/Source/core/editing/VisibleSelectionTest.cpp b/Source/core/editing/VisibleSelectionTest.cpp
index a1a198589657b4b458b79589c552cd6913206d6e..2282d6da596b227247c81e18e34fc5c164377da0 100644
--- a/Source/core/editing/VisibleSelectionTest.cpp
+++ b/Source/core/editing/VisibleSelectionTest.cpp
@@ -5,13 +5,8 @@
#include "config.h"
#include "core/editing/VisibleSelection.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"
#define LOREM_IPSUM \
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor " \
@@ -23,17 +18,8 @@
namespace blink {
-class VisibleSelectionTest : public ::testing::Test {
+class VisibleSelectionTest : public EditingTestBase {
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*);
-
// Helper function to set the VisibleSelection base/extent.
void setSelection(VisibleSelection& selection, int base) { setSelection(selection, base, base); }
@@ -47,33 +33,8 @@ protected:
static bool equalPositions(const Position&, const PositionInComposedTree&);
static void testComposedTreePositionsToEqualToDOMTreePositions(const VisibleSelection&);
-
-private:
- OwnPtr<DummyPageHolder> m_dummyPageHolder;
};
-void VisibleSelectionTest::SetUp()
-{
- m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
-}
-
-PassRefPtrWillBeRawPtr<ShadowRoot> VisibleSelectionTest::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 VisibleSelectionTest::setBodyContent(const char* bodyContent)
-{
- document().body()->setInnerHTML(String::fromUTF8(bodyContent), ASSERT_NO_EXCEPTION);
-}
-
-PassRefPtrWillBeRawPtr<ShadowRoot> VisibleSelectionTest::setShadowContent(const char* shadowContent)
-{
- return createShadowRootForElementWithIDAndSetInnerHTML(document(), "host", shadowContent);
-}
-
bool VisibleSelectionTest::equalPositions(const Position& positionInDOMTree, const PositionInComposedTree& positionInComposedTree)
{
// Since DOM tree positions can't be map to composed tree version, e.g.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698