| 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 "platform/wtf/StringExtras.h" | 9 #include "platform/wtf/StringExtras.h" |
| 10 #include "public/platform/WebEditingCommandType.h" | 10 #include "public/platform/WebEditingCommandType.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 TEST_F(EditingCommandTest, CreateCommandFromStringCaseFolding) { | 53 TEST_F(EditingCommandTest, CreateCommandFromStringCaseFolding) { |
| 54 Editor& dummy_editor = GetDocument().GetFrame()->GetEditor(); | 54 Editor& dummy_editor = GetDocument().GetFrame()->GetEditor(); |
| 55 for (const auto& entry : kCommandNameEntries) { | 55 for (const auto& entry : kCommandNameEntries) { |
| 56 Editor::Command command = | 56 Editor::Command command = |
| 57 dummy_editor.CreateCommand(String(entry.name).DeprecatedLower()); | 57 dummy_editor.CreateCommand(String(entry.name).DeprecatedLower()); |
| 58 EXPECT_EQ(static_cast<int>(entry.type), command.IdForHistogram()) | 58 EXPECT_EQ(static_cast<int>(entry.type), command.IdForHistogram()) |
| 59 << entry.name; | 59 << entry.name; |
| 60 command = dummy_editor.CreateCommand(String(entry.name).DeprecatedUpper()); | 60 command = dummy_editor.CreateCommand(String(entry.name).UpperASCII()); |
| 61 EXPECT_EQ(static_cast<int>(entry.type), command.IdForHistogram()) | 61 EXPECT_EQ(static_cast<int>(entry.type), command.IdForHistogram()) |
| 62 << entry.name; | 62 << entry.name; |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 TEST_F(EditingCommandTest, CreateCommandFromInvalidString) { | 66 TEST_F(EditingCommandTest, CreateCommandFromInvalidString) { |
| 67 const String kInvalidCommandName[] = { | 67 const String kInvalidCommandName[] = { |
| 68 "", "iNvAlId", "12345", | 68 "", "iNvAlId", "12345", |
| 69 }; | 69 }; |
| 70 Editor& dummy_editor = GetDocument().GetFrame()->GetEditor(); | 70 Editor& dummy_editor = GetDocument().GetFrame()->GetEditor(); |
| 71 for (const auto& command_name : kInvalidCommandName) { | 71 for (const auto& command_name : kInvalidCommandName) { |
| 72 Editor::Command command = dummy_editor.CreateCommand(command_name); | 72 Editor::Command command = dummy_editor.CreateCommand(command_name); |
| 73 EXPECT_EQ(0, command.IdForHistogram()); | 73 EXPECT_EQ(0, command.IdForHistogram()); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace blink | 77 } // namespace blink |
| OLD | NEW |