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 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 class InputMethodControllerTest : public ::testing::Test { | 20 class InputMethodControllerTest : public ::testing::Test { |
21 protected: | 21 protected: |
22 InputMethodController& controller() { return frame().inputMethodController()
; } | 22 InputMethodController& controller() { return frame().inputMethodController()
; } |
23 HTMLDocument& document() const { return *m_document; } | 23 HTMLDocument& document() const { return *m_document; } |
24 LocalFrame& frame() const { return m_dummyPageHolder->frame(); } | 24 LocalFrame& frame() const { return m_dummyPageHolder->frame(); } |
25 Element* insertHTMLElement(const char* elementCode, const char* elementId); | 25 Element* insertHTMLElement(const char* elementCode, const char* elementId); |
26 | 26 |
27 private: | 27 private: |
28 virtual void SetUp() OVERRIDE; | 28 virtual void SetUp() override; |
29 | 29 |
30 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 30 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
31 HTMLDocument* m_document; | 31 HTMLDocument* m_document; |
32 }; | 32 }; |
33 | 33 |
34 void InputMethodControllerTest::SetUp() | 34 void InputMethodControllerTest::SetUp() |
35 { | 35 { |
36 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 36 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
37 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 37 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
38 ASSERT(m_document); | 38 ASSERT(m_document); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 insertHTMLElement("<div id='sample' contenteditable='true'>test</div>", "sam
ple"); | 133 insertHTMLElement("<div id='sample' contenteditable='true'>test</div>", "sam
ple"); |
134 | 134 |
135 Vector<CompositionUnderline> underlines; | 135 Vector<CompositionUnderline> underlines; |
136 underlines.append(CompositionUnderline(7, 8, Color(255, 0, 0), false, 0)); | 136 underlines.append(CompositionUnderline(7, 8, Color(255, 0, 0), false, 0)); |
137 controller().setCompositionFromExistingText(underlines, 7, 8); | 137 controller().setCompositionFromExistingText(underlines, 7, 8); |
138 | 138 |
139 EXPECT_FALSE(controller().compositionRange()); | 139 EXPECT_FALSE(controller().compositionRange()); |
140 } | 140 } |
141 | 141 |
142 } // namespace | 142 } // namespace |
OLD | NEW |