OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/editing/EditingTestBase.h" | 5 #include "core/editing/EditingTestBase.h" |
6 #include "core/editing/Editor.h" | 6 #include "core/editing/Editor.h" |
7 #include "core/editing/commands/EditorCommandNames.h" | 7 #include "core/editing/commands/EditorCommandNames.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "public/platform/WebEditingCommandType.h" | 9 #include "public/platform/WebEditingCommandType.h" |
10 #include "wtf/StringExtras.h" | 10 #include "wtf/StringExtras.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 arraysize(kCommandNameEntries) + 1 == | 28 arraysize(kCommandNameEntries) + 1 == |
29 static_cast<size_t>(WebEditingCommandType::NumberOfCommandTypes), | 29 static_cast<size_t>(WebEditingCommandType::NumberOfCommandTypes), |
30 "must test all valid WebEditingCommandType"); | 30 "must test all valid WebEditingCommandType"); |
31 | 31 |
32 } // anonymous namespace | 32 } // anonymous namespace |
33 | 33 |
34 class EditingCommandTest : public EditingTestBase {}; | 34 class EditingCommandTest : public EditingTestBase {}; |
35 | 35 |
36 TEST_F(EditingCommandTest, EditorCommandOrder) { | 36 TEST_F(EditingCommandTest, EditorCommandOrder) { |
37 for (size_t i = 1; i < arraysize(kCommandNameEntries); ++i) | 37 for (size_t i = 1; i < arraysize(kCommandNameEntries); ++i) |
38 EXPECT_GT(0, strcasecmp(kCommandNameEntries[i - 1].name, | 38 EXPECT_GT(0, |
39 kCommandNameEntries[i].name)) | 39 strcasecmp(kCommandNameEntries[i - 1].name, |
| 40 kCommandNameEntries[i].name)) |
40 << "EDITOR_COMMAND_MAP must be case-folding ordered. Incorrect index:" | 41 << "EDITOR_COMMAND_MAP must be case-folding ordered. Incorrect index:" |
41 << i; | 42 << i; |
42 } | 43 } |
43 | 44 |
44 TEST_F(EditingCommandTest, CreateCommandFromString) { | 45 TEST_F(EditingCommandTest, CreateCommandFromString) { |
45 Editor& dummyEditor = document().frame()->editor(); | 46 Editor& dummyEditor = document().frame()->editor(); |
46 for (const auto& entry : kCommandNameEntries) { | 47 for (const auto& entry : kCommandNameEntries) { |
47 Editor::Command command = dummyEditor.createCommand(entry.name); | 48 Editor::Command command = dummyEditor.createCommand(entry.name); |
48 EXPECT_EQ(static_cast<int>(entry.type), command.idForHistogram()) | 49 EXPECT_EQ(static_cast<int>(entry.type), command.idForHistogram()) |
49 << entry.name; | 50 << entry.name; |
(...skipping 18 matching lines...) Expand all Loading... |
68 "", "iNvAlId", "12345", | 69 "", "iNvAlId", "12345", |
69 }; | 70 }; |
70 Editor& dummyEditor = document().frame()->editor(); | 71 Editor& dummyEditor = document().frame()->editor(); |
71 for (const auto& commandName : kInvalidCommandName) { | 72 for (const auto& commandName : kInvalidCommandName) { |
72 Editor::Command command = dummyEditor.createCommand(commandName); | 73 Editor::Command command = dummyEditor.createCommand(commandName); |
73 EXPECT_EQ(0, command.idForHistogram()); | 74 EXPECT_EQ(0, command.idForHistogram()); |
74 } | 75 } |
75 } | 76 } |
76 | 77 |
77 } // namespace blink | 78 } // namespace blink |
OLD | NEW |