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

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

Issue 2701083002: Preserve handles visibility when modifying selection (Closed)
Patch Set: Removed redundant EXPECTs in test Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 .setIsHandleVisible(true) 286 .setIsHandleVisible(true)
287 .build()); 287 .build());
288 EXPECT_TRUE(selection().isHandleVisible()); 288 EXPECT_TRUE(selection().isHandleVisible());
289 selection().selectAll(); 289 selection().selectAll();
290 EXPECT_TRUE(selection().isHandleVisible()) 290 EXPECT_TRUE(selection().isHandleVisible())
291 << "If handles were present before" 291 << "If handles were present before"
292 "selectAll. Then they should be present" 292 "selectAll. Then they should be present"
293 "after it."; 293 "after it.";
294 } 294 }
295 295
296 TEST_F(FrameSelectionTest, SetSelectedRangePreservesHandle) {
297 Text* text = appendTextNode("Hello, World!");
298 document().view()->updateAllLifecyclePhases();
299 selection().setSelection(
300 SelectionInDOMTree::Builder()
301 .setBaseAndExtent(Position(text, 0), Position(text, 5))
302 .setIsHandleVisible(false)
303 .build());
304
305 selection().setSelectedRange(
306 EphemeralRange(Position(text, 0), Position(text, 12)),
307 VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, 0);
308
309 EXPECT_FALSE(selection().isHandleVisible())
310 << "If handles weren't present before"
311 "setSelectedRange they shouldn't be present"
312 "after it.";
313
314 selection().setSelection(
315 SelectionInDOMTree::Builder()
316 .setBaseAndExtent(Position(text, 0), Position(text, 5))
317 .setIsHandleVisible(true)
318 .build());
319
320 selection().setSelectedRange(
321 EphemeralRange(Position(text, 0), Position(text, 12)),
322 VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, 0);
323
324 EXPECT_TRUE(selection().isHandleVisible())
325 << "If handles were present before"
326 "selectSetSelectedRange they should be present after it.";
327 }
328
296 } // namespace blink 329 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698