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

Unified Diff: content/browser/accessibility/browser_accessibility_win_unittest.cc

Issue 1388593002: Revert of Fixes for contenteditable caret and selection handling in Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/accessibility/browser_accessibility_win_unittest.cc
diff --git a/content/browser/accessibility/browser_accessibility_win_unittest.cc b/content/browser/accessibility/browser_accessibility_win_unittest.cc
index c1d99b2c6a83792477277c269085f89c0bc2272b..898e5dced782e214bfcf9203450cd1850477b74f 100644
--- a/content/browser/accessibility/browser_accessibility_win_unittest.cc
+++ b/content/browser/accessibility/browser_accessibility_win_unittest.cc
@@ -876,10 +876,10 @@
HRESULT hr = combo_box_accessible->get_caretOffset(&caret_offset);;
EXPECT_EQ(S_OK, hr);
EXPECT_EQ(1L, caret_offset);
- // The caret should be at the end of the selection.
+ // The caret should be at the start of the selection.
hr = text_field_accessible->get_caretOffset(&caret_offset);;
EXPECT_EQ(S_OK, hr);
- EXPECT_EQ(2L, caret_offset);
+ EXPECT_EQ(1L, caret_offset);
// Move the focus to the text field.
combo_box.state &= ~(1 << ui::AX_STATE_FOCUSED);
@@ -891,7 +891,7 @@
// The caret should not have moved.
hr = text_field_accessible->get_caretOffset(&caret_offset);;
EXPECT_EQ(S_OK, hr);
- EXPECT_EQ(2L, caret_offset);
+ EXPECT_EQ(1L, caret_offset);
// Test get_nSelections.
hr = combo_box_accessible->get_nSelections(&n_selections);;
@@ -981,15 +981,9 @@
// -2 is never a valid offset.
LONG caret_offset = -2;
- LONG n_selections = -2;
-
- // No selection should be present.
- HRESULT hr = div_editable_accessible->get_nSelections(&n_selections);
- EXPECT_EQ(S_OK, hr);
- EXPECT_EQ(0L, n_selections);
// The caret should be on the embedded object character.
- hr = div_editable_accessible->get_caretOffset(&caret_offset);
+ HRESULT hr = div_editable_accessible->get_caretOffset(&caret_offset);;
EXPECT_EQ(S_OK, hr);
EXPECT_EQ(6L, caret_offset);
@@ -1012,19 +1006,9 @@
ASSERT_NE(nullptr, link_text_accessible);
// The caret should not have moved.
- hr = div_editable_accessible->get_nSelections(&n_selections);
- EXPECT_EQ(S_OK, hr);
- EXPECT_EQ(0L, n_selections);
hr = div_editable_accessible->get_caretOffset(&caret_offset);;
EXPECT_EQ(S_OK, hr);
EXPECT_EQ(6L, caret_offset);
-
- hr = link_accessible->get_nSelections(&n_selections);
- EXPECT_EQ(S_OK, hr);
- EXPECT_EQ(0L, n_selections);
- hr = link_text_accessible->get_nSelections(&n_selections);
- EXPECT_EQ(S_OK, hr);
- EXPECT_EQ(0L, n_selections);
hr = link_accessible->get_caretOffset(&caret_offset);;
EXPECT_EQ(S_OK, hr);
@@ -1037,7 +1021,7 @@
ASSERT_EQ(0, CountedBrowserAccessibility::num_instances());
}
-TEST_F(BrowserAccessibilityTest, TestSelectionInContentEditables) {
+TEST_F(BrowserAccessibilityTest, DISABLED_TestSelectionInContentEditables) {
ui::AXNodeData root;
root.id = 1;
root.role = ui::AX_ROLE_ROOT_WEB_AREA;
@@ -1151,10 +1135,10 @@
EXPECT_EQ(0L, selection_start);
EXPECT_EQ(4L, selection_end);
- // The caret should be at the focus (the end) of the selection.
+ // The caret should be at the anchor (the start) of the selection.
hr = div_editable_accessible->get_caretOffset(&caret_offset);;
EXPECT_EQ(S_OK, hr);
- EXPECT_EQ(7L, caret_offset);
+ EXPECT_EQ(1L, caret_offset);
// Move the focus to the content editable.
div_editable.state |= 1 << ui::AX_STATE_FOCUSED;
@@ -1165,16 +1149,15 @@
// The caret should not have moved.
hr = div_editable_accessible->get_caretOffset(&caret_offset);;
EXPECT_EQ(S_OK, hr);
- EXPECT_EQ(7L, caret_offset);
-
- // The caret offset should reflect the position of the selection's focus in
- // any given object.
+ EXPECT_EQ(1L, caret_offset);
+
+ // The HRESULT should be S_FALSE if the caret is not in the given object.
hr = link_accessible->get_caretOffset(&caret_offset);;
- EXPECT_EQ(S_OK, hr);
- EXPECT_EQ(4L, caret_offset);
+ EXPECT_EQ(S_FALSE, hr);
+ EXPECT_EQ(-1L, caret_offset);
hr = link_text_accessible->get_caretOffset(&caret_offset);;
- EXPECT_EQ(S_OK, hr);
- EXPECT_EQ(4L, caret_offset);
+ EXPECT_EQ(S_FALSE, hr);
+ EXPECT_EQ(-1L, caret_offset);
hr = div_editable_accessible->get_selection(
0L /* selection_index */, &selection_start, &selection_end);;
« no previous file with comments | « content/browser/accessibility/browser_accessibility_win.cc ('k') | content/renderer/accessibility/blink_ax_tree_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698