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

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

Issue 2680943004: Make FrameSelection to hold non-canonicalized positions (Closed)
Patch Set: 2014-02-14T23:34:22 Update TestExpectation to include extend-{0,2,4}0.html and selectAllChildren.html Created 3 years, 10 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/FrameSelection.h" 5 #include "core/editing/FrameSelection.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/Element.h" 10 #include "core/dom/Element.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 TEST_F(FrameSelectionTest, updateIfNeededAndFrameCaret) { 259 TEST_F(FrameSelectionTest, updateIfNeededAndFrameCaret) {
260 setBodyContent("<style id=sample></style>"); 260 setBodyContent("<style id=sample></style>");
261 document().setDesignMode("on"); 261 document().setDesignMode("on");
262 updateAllLifecyclePhases(); 262 updateAllLifecyclePhases();
263 Element* sample = document().getElementById("sample"); 263 Element* sample = document().getElementById("sample");
264 selection().setSelection( 264 selection().setSelection(
265 SelectionInDOMTree::Builder().collapse(Position(sample, 0)).build()); 265 SelectionInDOMTree::Builder().collapse(Position(sample, 0)).build());
266 EXPECT_EQ(Position(document().body(), 0), selection().start()); 266 EXPECT_EQ(Position(document().body(), 0), selection().start());
267 EXPECT_EQ(selection().start(), caretPosition().position()); 267 EXPECT_EQ(selection().start(), caretPosition().position());
268 document().body()->remove(); 268 document().body()->remove();
269 // TODO(yosin): Once lazy canonicalization implemented, selection.start 269 EXPECT_EQ(Position(), selection().start())
270 // should be Position(HTML, 0). 270 << "Selection has been removed by BODY.remove().";
271 EXPECT_EQ(Position(document().documentElement(), 1), selection().start());
272 EXPECT_EQ(selection().start(), caretPosition().position()); 271 EXPECT_EQ(selection().start(), caretPosition().position());
273 document().updateStyleAndLayout(); 272 document().updateStyleAndLayout();
274 selection().updateIfNeeded(); 273 selection().updateIfNeeded();
275 274
276 // TODO(yosin): Once lazy canonicalization implemented, selection.start
277 // should be Position(HTML, 0).
278 EXPECT_EQ(Position(), selection().start()) 275 EXPECT_EQ(Position(), selection().start())
279 << "updateIfNeeded() makes selection to null."; 276 << "selection().updateIfNeeded() does nothing.";
280 EXPECT_EQ(selection().start(), caretPosition().position()); 277 EXPECT_EQ(selection().start(), caretPosition().position());
281 } 278 }
282 279
283 } // namespace blink 280 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | third_party/WebKit/Source/core/editing/SelectionEditor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698