Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommandTest.cpp

Issue 2508793002: Make exceptionState parameter of Document::createElement() to have default value (Closed)
Patch Set: 2016-11-16T15:26:06 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ReplaceSelectionCommand.h" 5 #include "core/editing/commands/ReplaceSelectionCommand.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/DocumentFragment.h" 10 #include "core/dom/DocumentFragment.h"
(...skipping 17 matching lines...) Expand all
28 TEST_F(ReplaceSelectionCommandTest, pastingEmptySpan) { 28 TEST_F(ReplaceSelectionCommandTest, pastingEmptySpan) {
29 document().setDesignMode("on"); 29 document().setDesignMode("on");
30 setBodyContent("foo"); 30 setBodyContent("foo");
31 31
32 LocalFrame* frame = document().frame(); 32 LocalFrame* frame = document().frame();
33 frame->selection().setSelection(SelectionInDOMTree::Builder() 33 frame->selection().setSelection(SelectionInDOMTree::Builder()
34 .collapse(Position(document().body(), 0)) 34 .collapse(Position(document().body(), 0))
35 .build()); 35 .build());
36 36
37 DocumentFragment* fragment = document().createDocumentFragment(); 37 DocumentFragment* fragment = document().createDocumentFragment();
38 fragment->appendChild(document().createElement("span", ASSERT_NO_EXCEPTION)); 38 fragment->appendChild(document().createElement("span"));
39 39
40 // |options| are taken from |Editor::replaceSelectionWithFragment()| with 40 // |options| are taken from |Editor::replaceSelectionWithFragment()| with
41 // |selectReplacement| and |smartReplace|. 41 // |selectReplacement| and |smartReplace|.
42 ReplaceSelectionCommand::CommandOptions options = 42 ReplaceSelectionCommand::CommandOptions options =
43 ReplaceSelectionCommand::PreventNesting | 43 ReplaceSelectionCommand::PreventNesting |
44 ReplaceSelectionCommand::SanitizeFragment | 44 ReplaceSelectionCommand::SanitizeFragment |
45 ReplaceSelectionCommand::SelectReplacement | 45 ReplaceSelectionCommand::SelectReplacement |
46 ReplaceSelectionCommand::SmartReplace; 46 ReplaceSelectionCommand::SmartReplace;
47 ReplaceSelectionCommand* command = 47 ReplaceSelectionCommand* command =
48 ReplaceSelectionCommand::create(document(), fragment, options); 48 ReplaceSelectionCommand::create(document(), fragment, options);
(...skipping 24 matching lines...) Expand all
73 73
74 EXPECT_EQ( 74 EXPECT_EQ(
75 "<head><style>foo { bar: baz; }</style></head>" 75 "<head><style>foo { bar: baz; }</style></head>"
76 "<body><p>Text</p></body>", 76 "<body><p>Text</p></body>",
77 document().body()->innerHTML()) 77 document().body()->innerHTML())
78 << "the STYLE and P elements should have been pasted into the body " 78 << "the STYLE and P elements should have been pasted into the body "
79 << "of the document"; 79 << "of the document";
80 } 80 }
81 81
82 } // namespace blink 82 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698