OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "webkit/tools/test_shell/text_input_controller.h" | |
6 | |
7 #include "testing/gtest/include/gtest/gtest.h" | |
8 | |
9 // Test class to let us check TextInputController's method table. | |
10 class TestTextInputController : public TextInputController { | |
11 public: | |
12 TestTextInputController() : TextInputController(NULL) {} | |
13 | |
14 size_t MethodCount() { | |
15 return methods_.size(); | |
16 } | |
17 }; | |
18 | |
19 | |
20 TEST(TextInputControllerTest, MethodMapIsInitialized) { | |
21 TestTextInputController text_input_controller; | |
22 | |
23 EXPECT_EQ(14U, text_input_controller.MethodCount()); | |
24 | |
25 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
26 "insertText")); | |
27 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
28 "doCommand")); | |
29 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
30 "setMarkedText")); | |
31 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
32 "unmarkText")); | |
33 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
34 "hasMarkedText")); | |
35 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
36 "conversationIdentifier")); | |
37 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
38 "substringFromRange")); | |
39 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
40 "attributedSubstringFromRange")); | |
41 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
42 "markedRange")); | |
43 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
44 "selectedRange")); | |
45 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
46 "firstRectForCharacterRange")); | |
47 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
48 "characterIndexForPoint")); | |
49 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
50 "validAttributesForMarkedText")); | |
51 EXPECT_TRUE(text_input_controller.IsMethodRegistered( | |
52 "makeAttributedString")); | |
53 | |
54 // Negative test. | |
55 EXPECT_FALSE(text_input_controller.IsMethodRegistered( | |
56 "momeRathsOutgrabe")); | |
57 } | |
OLD | NEW |