| 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 "core/dom/Range.h" | 5 #include "core/dom/Range.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/V8BindingForTesting.h" | 8 #include "bindings/core/v8/V8BindingForTesting.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/NodeList.h" | 10 #include "core/dom/NodeList.h" |
| 11 #include "core/dom/Text.h" | 11 #include "core/dom/Text.h" |
| 12 #include "core/editing/EditingTestBase.h" | 12 #include "core/editing/EditingTestBase.h" |
| 13 #include "core/frame/Settings.h" | 13 #include "core/frame/Settings.h" |
| 14 #include "core/html/HTMLBodyElement.h" | 14 #include "core/html/HTMLBodyElement.h" |
| 15 #include "core/html/HTMLDivElement.h" | 15 #include "core/html/HTMLDivElement.h" |
| 16 #include "core/html/HTMLDocument.h" | 16 #include "core/html/HTMLDocument.h" |
| 17 #include "core/html/HTMLElement.h" | 17 #include "core/html/HTMLElement.h" |
| 18 #include "core/html/HTMLHtmlElement.h" | 18 #include "core/html/HTMLHtmlElement.h" |
| 19 #include "core/html/HTMLTextAreaElement.h" | 19 #include "core/html/HTMLTextAreaElement.h" |
| 20 #include "platform/heap/Handle.h" | 20 #include "platform/heap/Handle.h" |
| 21 #include "platform/wtf/Compiler.h" |
| 22 #include "platform/wtf/RefPtr.h" |
| 23 #include "platform/wtf/text/AtomicString.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "wtf/Compiler.h" | |
| 23 #include "wtf/RefPtr.h" | |
| 24 #include "wtf/text/AtomicString.h" | |
| 25 | 25 |
| 26 namespace blink { | 26 namespace blink { |
| 27 | 27 |
| 28 class RangeTest : public EditingTestBase {}; | 28 class RangeTest : public EditingTestBase {}; |
| 29 | 29 |
| 30 TEST_F(RangeTest, createAdjustedToTreeScopeWithPositionInShadowTree) { | 30 TEST_F(RangeTest, createAdjustedToTreeScopeWithPositionInShadowTree) { |
| 31 GetDocument().body()->setInnerHTML("<div><select><option>012</option></div>"); | 31 GetDocument().body()->setInnerHTML("<div><select><option>012</option></div>"); |
| 32 Element* const select_element = GetDocument().QuerySelector("select"); | 32 Element* const select_element = GetDocument().QuerySelector("select"); |
| 33 const Position& position = | 33 const Position& position = |
| 34 Position::AfterNode(select_element->UserAgentShadowRoot()); | 34 Position::AfterNode(select_element->UserAgentShadowRoot()); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 TEST_F(RangeTest, ToPosition) { | 257 TEST_F(RangeTest, ToPosition) { |
| 258 Node& textarea = *HTMLTextAreaElement::Create(GetDocument()); | 258 Node& textarea = *HTMLTextAreaElement::Create(GetDocument()); |
| 259 Range& range = *Range::Create(GetDocument()); | 259 Range& range = *Range::Create(GetDocument()); |
| 260 const Position position = Position(&textarea, 0); | 260 const Position position = Position(&textarea, 0); |
| 261 range.setStart(position, ASSERT_NO_EXCEPTION); | 261 range.setStart(position, ASSERT_NO_EXCEPTION); |
| 262 EXPECT_EQ(position, range.StartPosition()); | 262 EXPECT_EQ(position, range.StartPosition()); |
| 263 EXPECT_EQ(position, range.EndPosition()); | 263 EXPECT_EQ(position, range.EndPosition()); |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace blink | 266 } // namespace blink |
| OLD | NEW |