OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 #include "core/editing/FrameSelection.h" | 6 #include "core/editing/FrameSelection.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 RawPtr<HTMLDocument> m_document; | 37 RawPtr<HTMLDocument> m_document; |
38 RefPtrWillBePersistent<Text> m_textNode; | 38 RefPtrWillBePersistent<Text> m_textNode; |
39 }; | 39 }; |
40 | 40 |
41 void FrameSelectionTest::SetUp() | 41 void FrameSelectionTest::SetUp() |
42 { | 42 { |
43 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 43 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
44 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 44 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
45 ASSERT(m_document); | 45 ASSERT(m_document); |
46 m_textNode = m_document->createTextNode("Hello, World!"); | 46 m_textNode = m_document->createTextNode("Hello, World!"); |
47 m_document->body()->appendChild(m_textNode); | 47 m_document->body()->appendChild(m_textNode.get()); |
48 } | 48 } |
49 | 49 |
50 HTMLDocument& FrameSelectionTest::document() const | 50 HTMLDocument& FrameSelectionTest::document() const |
51 { | 51 { |
52 return *m_document; | 52 return *m_document; |
53 } | 53 } |
54 | 54 |
55 void FrameSelectionTest::setSelection(const VisibleSelection& newSelection) | 55 void FrameSelectionTest::setSelection(const VisibleSelection& newSelection) |
56 { | 56 { |
57 m_dummyPageHolder->frame().selection().setSelection(newSelection); | 57 m_dummyPageHolder->frame().selection().setSelection(newSelection); |
(...skipping 25 matching lines...) Expand all Loading... |
83 // Create a new VisibleSelection for the new document without frame and | 83 // Create a new VisibleSelection for the new document without frame and |
84 // update FrameSelection with the selection. | 84 // update FrameSelection with the selection. |
85 VisibleSelection invalidSelection; | 85 VisibleSelection invalidSelection; |
86 invalidSelection.setWithoutValidation(Position(anotherText, 0), Position(ano
therText, 5)); | 86 invalidSelection.setWithoutValidation(Position(anotherText, 0), Position(ano
therText, 5)); |
87 setSelection(invalidSelection); | 87 setSelection(invalidSelection); |
88 | 88 |
89 EXPECT_TRUE(selection().isNone()); | 89 EXPECT_TRUE(selection().isNone()); |
90 } | 90 } |
91 | 91 |
92 } | 92 } |
OLD | NEW |