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/InputMethodController.h" | 6 #include "core/editing/InputMethodController.h" |
7 | 7 |
8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
9 #include "core/dom/Range.h" | 9 #include "core/dom/Range.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
11 #include "core/html/HTMLDocument.h" | 11 #include "core/html/HTMLDocument.h" |
12 #include "core/html/HTMLInputElement.h" | 12 #include "core/html/HTMLInputElement.h" |
13 #include "core/testing/DummyPageHolder.h" | 13 #include "core/testing/DummyPageHolder.h" |
14 #include <gtest/gtest.h> | 14 #include <gtest/gtest.h> |
15 | 15 |
16 using namespace blink; | 16 using namespace blink; |
17 using namespace blink; | |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 class InputMethodControllerTest : public ::testing::Test { | 20 class InputMethodControllerTest : public ::testing::Test { |
22 protected: | 21 protected: |
23 InputMethodController& controller() { return frame().inputMethodController()
; } | 22 InputMethodController& controller() { return frame().inputMethodController()
; } |
24 HTMLDocument& document() const { return *m_document; } | 23 HTMLDocument& document() const { return *m_document; } |
25 LocalFrame& frame() const { return m_dummyPageHolder->frame(); } | 24 LocalFrame& frame() const { return m_dummyPageHolder->frame(); } |
26 Element* insertHTMLElement(const char* elementCode, const char* elementId); | 25 Element* insertHTMLElement(const char* elementCode, const char* elementId); |
27 | 26 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 RefPtrWillBeRawPtr<Range> range = controller().compositionRange(); | 122 RefPtrWillBeRawPtr<Range> range = controller().compositionRange(); |
124 EXPECT_EQ(1, range->startOffset()); | 123 EXPECT_EQ(1, range->startOffset()); |
125 EXPECT_EQ(6, range->endOffset()); | 124 EXPECT_EQ(6, range->endOffset()); |
126 | 125 |
127 PlainTextRange plainTextRange(PlainTextRange::create(*div, *range.get())); | 126 PlainTextRange plainTextRange(PlainTextRange::create(*div, *range.get())); |
128 EXPECT_EQ(0u, plainTextRange.start()); | 127 EXPECT_EQ(0u, plainTextRange.start()); |
129 EXPECT_EQ(5u, plainTextRange.end()); | 128 EXPECT_EQ(5u, plainTextRange.end()); |
130 } | 129 } |
131 | 130 |
132 } // namespace | 131 } // namespace |
OLD | NEW |