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

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/editing/FrameSelection.h" 5 #include "core/editing/FrameSelection.h"
6 6
7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/Text.h" 10 #include "core/dom/Text.h"
11 #include "core/editing/EditingTestBase.h" 11 #include "core/editing/EditingTestBase.h"
12 #include "core/frame/FrameView.h" 12 #include "core/frame/FrameView.h"
13 #include "core/html/HTMLBodyElement.h" 13 #include "core/html/HTMLBodyElement.h"
14 #include "core/html/HTMLDocument.h" 14 #include "core/html/HTMLDocument.h"
15 #include "core/layout/LayoutView.h" 15 #include "core/layout/LayoutView.h"
16 #include "core/paint/PaintInfo.h" 16 #include "core/paint/PaintInfo.h"
17 #include "core/paint/PaintLayer.h" 17 #include "core/paint/PaintLayer.h"
18 #include "core/testing/DummyPageHolder.h" 18 #include "core/testing/DummyPageHolder.h"
19 #include "platform/graphics/paint/DrawingRecorder.h" 19 #include "platform/graphics/paint/DrawingRecorder.h"
20 #include "platform/graphics/paint/PaintController.h" 20 #include "platform/graphics/paint/PaintController.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 #include "wtf/OwnPtr.h"
23 #include "wtf/PassRefPtr.h" 22 #include "wtf/PassRefPtr.h"
24 #include "wtf/RefPtr.h" 23 #include "wtf/RefPtr.h"
25 #include "wtf/StdLibExtras.h" 24 #include "wtf/StdLibExtras.h"
25 #include <memory>
26 26
27 namespace blink { 27 namespace blink {
28 28
29 class FrameSelectionTest : public EditingTestBase { 29 class FrameSelectionTest : public EditingTestBase {
30 protected: 30 protected:
31 void setSelection(const VisibleSelection&); 31 void setSelection(const VisibleSelection&);
32 FrameSelection& selection() const; 32 FrameSelection& selection() const;
33 const VisibleSelection& visibleSelectionInDOMTree() const { return selection ().selection(); } 33 const VisibleSelection& visibleSelectionInDOMTree() const { return selection ().selection(); }
34 const VisibleSelectionInFlatTree& visibleSelectionInFlatTree() const { retur n selection().selectionInFlatTree(); } 34 const VisibleSelectionInFlatTree& visibleSelectionInFlatTree() const { retur n selection().selectionInFlatTree(); }
35 35
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 int startCount = layoutCount(); 107 int startCount = layoutCount();
108 { 108 {
109 // To force layout in next updateLayout calling, widen view. 109 // To force layout in next updateLayout calling, widen view.
110 FrameView& frameView = dummyPageHolder().frameView(); 110 FrameView& frameView = dummyPageHolder().frameView();
111 IntRect frameRect = frameView.frameRect(); 111 IntRect frameRect = frameView.frameRect();
112 frameRect.setWidth(frameRect.width() + 1); 112 frameRect.setWidth(frameRect.width() + 1);
113 frameRect.setHeight(frameRect.height() + 1); 113 frameRect.setHeight(frameRect.height() + 1);
114 dummyPageHolder().frameView().setFrameRect(frameRect); 114 dummyPageHolder().frameView().setFrameRect(frameRect);
115 } 115 }
116 OwnPtr<PaintController> paintController = PaintController::create(); 116 std::unique_ptr<PaintController> paintController = PaintController::create() ;
117 { 117 {
118 GraphicsContext context(*paintController); 118 GraphicsContext context(*paintController);
119 DrawingRecorder drawingRecorder(context, *dummyPageHolder().frameView(). layoutView(), DisplayItem::Caret, LayoutRect::infiniteIntRect()); 119 DrawingRecorder drawingRecorder(context, *dummyPageHolder().frameView(). layoutView(), DisplayItem::Caret, LayoutRect::infiniteIntRect());
120 selection().paintCaret(context, LayoutPoint()); 120 selection().paintCaret(context, LayoutPoint());
121 } 121 }
122 paintController->commitNewDisplayItems(); 122 paintController->commitNewDisplayItems();
123 EXPECT_EQ(startCount, layoutCount()); 123 EXPECT_EQ(startCount, layoutCount());
124 } 124 }
125 125
126 TEST_F(FrameSelectionTest, InvalidatePreviousCaretAfterRemovingLastCharacter) 126 TEST_F(FrameSelectionTest, InvalidatePreviousCaretAfterRemovingLastCharacter)
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 TEST_F(FrameSelectionTest, SelectAllWithUnselectableRoot) 268 TEST_F(FrameSelectionTest, SelectAllWithUnselectableRoot)
269 { 269 {
270 Element* select = document().createElement("select", ASSERT_NO_EXCEPTION); 270 Element* select = document().createElement("select", ASSERT_NO_EXCEPTION);
271 document().replaceChild(select, document().documentElement()); 271 document().replaceChild(select, document().documentElement());
272 selection().selectAll(); 272 selection().selectAll();
273 EXPECT_TRUE(selection().isNone()) << "Nothing should be selected if the cont ent of the documentElement is not selctable."; 273 EXPECT_TRUE(selection().isNone()) << "Nothing should be selected if the cont ent of the documentElement is not selctable.";
274 } 274 }
275 275
276 } // namespace blink 276 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698