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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 929213004: Plumb selection bounds as a single unit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix copyright Created 5 years, 9 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
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index be36e74015bec14ea6162f9648f58ab5f7a387a7..aca6d3f688749181b1b0b95bc0675a56d4776235 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -4207,16 +4207,14 @@ public:
virtual void setNeedsAnimate() override { }
virtual bool commitRequested() const override { return false; }
virtual void finishAllRendering() override { }
- virtual void registerSelection(const WebSelectionBound& start, const WebSelectionBound& end) override
+ virtual void registerSelection(const WebSelectionBounds& bounds) override
{
- m_start = adoptPtr(new WebSelectionBound(start));
- m_end = adoptPtr(new WebSelectionBound(end));
+ m_bounds = adoptPtr(new WebSelectionBounds(bounds));
}
virtual void clearSelection() override
{
m_selectionCleared = true;
- m_start.clear();
- m_end.clear();
+ m_bounds.clear();
}
bool getAndResetSelectionCleared()
@@ -4226,13 +4224,13 @@ public:
return selectionCleared;
}
- const WebSelectionBound* start() const { return m_start.get(); }
- const WebSelectionBound* end() const { return m_end.get(); }
+ const WebSelectionBounds* bounds() const { return m_bounds.get(); }
+ const WebSelectionBound* start() const { return m_bounds ? &m_bounds->start : nullptr; }
+ const WebSelectionBound* end() const { return m_bounds ? &m_bounds->end: nullptr; }
private:
bool m_selectionCleared;
- OwnPtr<WebSelectionBound> m_start;
- OwnPtr<WebSelectionBound> m_end;
+ OwnPtr<WebSelectionBounds> m_bounds;
};
class CompositedSelectionBoundsTestWebViewClient : public FrameTestHelpers::TestWebViewClient {
@@ -4282,7 +4280,7 @@ protected:
ASSERT_TRUE((*result)->IsArray());
v8::Array& expectedResult = *v8::Array::Cast(*result);
- ASSERT_EQ(10u, expectedResult.Length());
+ ASSERT_GE(expectedResult.Length(), 10u);
blink::Node* layerOwnerNodeForStart = blink::V8Node::toImplWithTypeCheck(v8::Isolate::GetCurrent(), expectedResult.Get(0));
ASSERT_TRUE(layerOwnerNodeForStart);
@@ -4299,6 +4297,11 @@ protected:
EXPECT_EQ(expectedResult.Get(7)->Int32Value(), selectEnd->edgeTopInLayer.y);
EXPECT_EQ(expectedResult.Get(8)->Int32Value(), selectEnd->edgeBottomInLayer.x);
EXPECT_EQ(expectedResult.Get(9)->Int32Value(), selectEnd->edgeBottomInLayer.y);
+
+ if (expectedResult.Length() == 12) {
+ EXPECT_EQ(expectedResult.Get(10)->BooleanValue(), m_fakeSelectionLayerTreeView.bounds()->isEditable);
+ EXPECT_EQ(expectedResult.Get(11)->BooleanValue(), m_fakeSelectionLayerTreeView.bounds()->isEditableRegionEmpty);
+ }
}
void runTestWithMultipleFiles(const char* testFile, ...)
@@ -4324,6 +4327,8 @@ TEST_F(CompositedSelectionBoundsTest, SplitLayer) { runTest("composited_selectio
TEST_F(CompositedSelectionBoundsTest, EmptyLayer) { runTest("composited_selection_bounds_empty_layer.html"); }
TEST_F(CompositedSelectionBoundsTest, Iframe) { runTestWithMultipleFiles("composited_selection_bounds_iframe.html", "composited_selection_bounds_basic.html", nullptr); }
TEST_F(CompositedSelectionBoundsTest, DetachedFrame) { runTest("composited_selection_bounds_detached_frame.html"); }
+TEST_F(CompositedSelectionBoundsTest, Editable) { runTest("composited_selection_bounds_editable.html"); }
+TEST_F(CompositedSelectionBoundsTest, EmptyEditable) { runTest("composited_selection_bounds_empty_editable.html"); }
TEST_F(WebFrameTest, CompositedSelectionBoundsCleared)

Powered by Google App Engine
This is Rietveld 408576698