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

Unified Diff: ui/views/accessibility/native_view_accessibility_win_unittest.cc

Issue 949333002: Revert of Implement NativeViewAccessibilityWin using AXPlatformNodeWin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/accessibility/native_view_accessibility_win.cc ('k') | ui/views/controls/webview/webview.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/accessibility/native_view_accessibility_win_unittest.cc
diff --git a/ui/views/accessibility/native_view_accessibility_win_unittest.cc b/ui/views/accessibility/native_view_accessibility_win_unittest.cc
index e30a15c56c73c04fdd368df281a852b09eadc9a9..3edab8e258e963ed39408b42f0f292a3f64b5e96 100644
--- a/ui/views/accessibility/native_view_accessibility_win_unittest.cc
+++ b/ui/views/accessibility/native_view_accessibility_win_unittest.cc
@@ -81,6 +81,35 @@
ASSERT_STREQ(L"New value", textfield->text().c_str());
}
+TEST_F(NativeViewAcccessibilityWinTest, UnattachedWebView) {
+ // This is a regression test. Calling get_accChild on the native accessible
+ // object for a WebView with no attached WebContents was causing an
+ // infinite loop and crash. This test simulates that with an ordinary
+ // View that registers itself as a web view with NativeViewAcccessibility.
+
+ Widget widget;
+ Widget::InitParams init_params =
+ CreateParams(Widget::InitParams::TYPE_POPUP);
+ init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ widget.Init(init_params);
+
+ View* content = new View;
+ widget.SetContentsView(content);
+
+ View* web_view = new View;
+ content->AddChildView(web_view);
+ NativeViewAccessibility::RegisterWebView(web_view);
+
+ ScopedComPtr<IAccessible> web_view_accessible(
+ web_view->GetNativeViewAccessible());
+ ScopedComPtr<IDispatch> result_dispatch;
+ ScopedVariant child_index(-999);
+ ASSERT_EQ(E_FAIL, web_view_accessible->get_accChild(
+ child_index, result_dispatch.Receive()));
+
+ NativeViewAccessibility::UnregisterWebView(web_view);
+}
+
TEST_F(NativeViewAcccessibilityWinTest, AuraOwnedWidgets) {
Widget widget;
Widget::InitParams init_params =
@@ -94,14 +123,6 @@
LONG child_count = 0;
ASSERT_EQ(S_OK, root_view_accessible->get_accChildCount(&child_count));
ASSERT_EQ(1L, child_count);
-
- ScopedComPtr<IDispatch> child_view_dispatch;
- ScopedComPtr<IAccessible> child_view_accessible;
- ScopedVariant child_index_1(1);
- ASSERT_EQ(S_OK, root_view_accessible->get_accChild(
- child_index_1, child_view_dispatch.Receive()));
- ASSERT_EQ(S_OK, child_view_dispatch.QueryInterface(
- child_view_accessible.Receive()));
Widget owned_widget;
Widget::InitParams owned_init_params =
@@ -113,34 +134,6 @@
ASSERT_EQ(S_OK, root_view_accessible->get_accChildCount(&child_count));
ASSERT_EQ(2L, child_count);
-
- ScopedComPtr<IDispatch> child_widget_dispatch;
- ScopedComPtr<IAccessible> child_widget_accessible;
- ScopedVariant child_index_2(2);
- ASSERT_EQ(S_OK, root_view_accessible->get_accChild(
- child_index_2, child_widget_dispatch.Receive()));
- ASSERT_EQ(S_OK, child_widget_dispatch.QueryInterface(
- child_widget_accessible.Receive()));
-
- ScopedComPtr<IDispatch> child_widget_sibling_dispatch;
- ScopedComPtr<IAccessible> child_widget_sibling_accessible;
- ScopedVariant childid_self(CHILDID_SELF);
- ScopedVariant result;
- ASSERT_EQ(S_OK, child_widget_accessible->accNavigate(
- NAVDIR_PREVIOUS, childid_self, result.Receive()));
- ASSERT_EQ(VT_DISPATCH, V_VT(&result));
- child_widget_sibling_dispatch = V_DISPATCH(&result);
- ASSERT_EQ(S_OK, child_widget_sibling_dispatch.QueryInterface(
- child_widget_sibling_accessible.Receive()));
- ASSERT_EQ(child_view_accessible.get(), child_widget_sibling_accessible.get());
-
- ScopedComPtr<IDispatch> child_widget_parent_dispatch;
- ScopedComPtr<IAccessible> child_widget_parent_accessible;
- ASSERT_EQ(S_OK, child_widget_accessible->get_accParent(
- child_widget_parent_dispatch.Receive()));
- ASSERT_EQ(S_OK, child_widget_parent_dispatch.QueryInterface(
- child_widget_parent_accessible.Receive()));
- ASSERT_EQ(root_view_accessible.get(), child_widget_parent_accessible.get());
}
TEST_F(NativeViewAcccessibilityWinTest, RetrieveAllAlerts) {
« no previous file with comments | « ui/views/accessibility/native_view_accessibility_win.cc ('k') | ui/views/controls/webview/webview.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698