OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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/commands/DeleteSelectionCommand.h" | 5 #include "core/editing/commands/DeleteSelectionCommand.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/editing/EditingTestBase.h" | 9 #include "core/editing/EditingTestBase.h" |
10 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 const bool kNoSmartDelete = false; | 45 const bool kNoSmartDelete = false; |
46 const bool kMergeBlocksAfterDelete = true; | 46 const bool kMergeBlocksAfterDelete = true; |
47 const bool kNoExpandForSpecialElements = false; | 47 const bool kNoExpandForSpecialElements = false; |
48 const bool kSanitizeMarkup = true; | 48 const bool kSanitizeMarkup = true; |
49 DeleteSelectionCommand* command = DeleteSelectionCommand::create( | 49 DeleteSelectionCommand* command = DeleteSelectionCommand::create( |
50 document(), kNoSmartDelete, kMergeBlocksAfterDelete, | 50 document(), kNoSmartDelete, kMergeBlocksAfterDelete, |
51 kNoExpandForSpecialElements, kSanitizeMarkup, | 51 kNoExpandForSpecialElements, kSanitizeMarkup, |
52 InputEvent::InputType::DeleteByCut); | 52 InputEvent::InputType::DeleteByCut); |
53 | 53 |
54 EXPECT_TRUE(command->apply(EditCommandSource::kMenuOrKeyBinding)) | 54 EXPECT_TRUE(command->apply()) << "the delete command should have succeeded"; |
55 << "the delete command should have succeeded"; | |
56 EXPECT_EQ("<div contenteditable=\"true\"><br></div>", | 55 EXPECT_EQ("<div contenteditable=\"true\"><br></div>", |
57 document().body()->innerHTML()); | 56 document().body()->innerHTML()); |
58 EXPECT_TRUE(frame->selection().isCaret()); | 57 EXPECT_TRUE(frame->selection().isCaret()); |
59 EXPECT_EQ(Position(div, 0), frame->selection().base().toOffsetInAnchor()); | 58 EXPECT_EQ(Position(div, 0), frame->selection().base().toOffsetInAnchor()); |
60 } | 59 } |
61 | 60 |
62 } // namespace blink | 61 } // namespace blink |
OLD | NEW |