summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-29 00:48:41 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-29 00:48:41 +0000
commit6a86a8e320782a0cb35b18dac3d803e09015aaee (patch)
tree2fdbc17f5befe515ddb2331fff89612839826a07 /content
parent54b92514f78f8af633e86f7bcf7bf446aeffc5cc (diff)
downloadchromium_src-6a86a8e320782a0cb35b18dac3d803e09015aaee.zip
chromium_src-6a86a8e320782a0cb35b18dac3d803e09015aaee.tar.gz
chromium_src-6a86a8e320782a0cb35b18dac3d803e09015aaee.tar.bz2
Make accessibility interactive_ui_tests less brittle
The accessibility interactive_ui_tests were miraculously surviving on the bots - but when run locally they failed flakily for me. With this patch I can't make them fail. 1. Fix potential race/flakiness condition by finishing loading the page first, then loading the accessibility tree - rather than allowing these to interleave. 2. Add multiple accessibility notifications for tests to listen to so that tests aren't sensitive to WebKit sending additional unrelated notifications. 3. Tiny change to the html of one test; it was assuming that focusable divs don't get an accessible title, but this won't be true anymore when WebKit bug 94302 lands. This patch should have no effect in isolation (other than reducing flakiness), but landing it will make it possible for WebKit bug 94302 to land without breaking any tests. BUG=144952 Review URL: https://chromiumcodereview.appspot.com/10870097 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153813 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/accessibility/cross_platform_accessibility_browsertest.cc2
-rw-r--r--content/browser/accessibility/dump_accessibility_tree_browsertest.cc2
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc40
-rw-r--r--content/browser/renderer_host/render_view_host_impl.h8
-rw-r--r--content/public/browser/notification_types.h20
-rw-r--r--content/public/test/test_renderer_host.cc7
-rw-r--r--content/public/test/test_renderer_host.h5
7 files changed, 35 insertions, 49 deletions
diff --git a/content/browser/accessibility/cross_platform_accessibility_browsertest.cc b/content/browser/accessibility/cross_platform_accessibility_browsertest.cc
index a97039a..2b52e613 100644
--- a/content/browser/accessibility/cross_platform_accessibility_browsertest.cc
+++ b/content/browser/accessibility/cross_platform_accessibility_browsertest.cc
@@ -33,7 +33,7 @@ class CrossPlatformAccessibilityBrowserTest : public ContentBrowserTest {
const AccessibilityNodeData& GetAccessibilityNodeDataTree(
AccessibilityMode accessibility_mode = AccessibilityModeComplete) {
WindowedNotificationObserver tree_updated_observer(
- NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED,
+ NOTIFICATION_ACCESSIBILITY_LAYOUT_COMPLETE,
NotificationService::AllSources());
RenderWidgetHostView* host_view =
shell()->web_contents()->GetRenderWidgetHostView();
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
index b5a4eeb..2fda329 100644
--- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
+++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -156,7 +156,7 @@ void DumpAccessibilityTreeTest::RunTest(const FilePath::CharType* file_path) {
// Load the page.
WindowedNotificationObserver tree_updated_observer(
- NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED,
+ NOTIFICATION_ACCESSIBILITY_LOAD_COMPLETE,
NotificationService::AllSources());
string16 html_contents16;
html_contents16 = UTF8ToUTF16(html_contents);
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 65036d9..8ad9eed 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -171,7 +171,6 @@ RenderViewHostImpl::RenderViewHostImpl(
session_storage_namespace_(
static_cast<SessionStorageNamespaceImpl*>(session_storage)),
save_accessibility_tree_for_testing_(false),
- send_accessibility_updated_notifications_(false),
render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) {
DCHECK(session_storage_namespace_);
DCHECK(instance_);
@@ -1741,30 +1740,27 @@ void RenderViewHostImpl::OnAccessibilityNotifications(
if (view_ && !is_swapped_out_)
view_->OnAccessibilityNotifications(params);
- if (!params.empty()) {
- for (unsigned i = 0; i < params.size(); i++) {
- const AccessibilityHostMsg_NotificationParams& param = params[i];
-
- if ((param.notification_type == AccessibilityNotificationLayoutComplete ||
- param.notification_type == AccessibilityNotificationLoadComplete) &&
- save_accessibility_tree_for_testing_) {
- accessibility_tree_ = param.acc_tree;
-
- // Only notify for non-blank pages.
- if (accessibility_tree_.children.size() > 0)
- content::NotificationService::current()->Notify(
- content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED,
- content::Source<RenderViewHost>(this),
- content::NotificationService::NoDetails());
- }
+ for (unsigned i = 0; i < params.size(); i++) {
+ const AccessibilityHostMsg_NotificationParams& param = params[i];
+ AccessibilityNotification src_type = param.notification_type;
+
+ if ((src_type == AccessibilityNotificationLayoutComplete ||
+ src_type == AccessibilityNotificationLoadComplete) &&
+ save_accessibility_tree_for_testing_) {
+ accessibility_tree_ = param.acc_tree;
}
- }
- if (send_accessibility_updated_notifications_) {
+ NotificationType dst_type;
+ if (src_type == AccessibilityNotificationLoadComplete)
+ dst_type = content::NOTIFICATION_ACCESSIBILITY_LOAD_COMPLETE;
+ else if (src_type == AccessibilityNotificationLayoutComplete)
+ dst_type = content::NOTIFICATION_ACCESSIBILITY_LAYOUT_COMPLETE;
+ else
+ dst_type = content::NOTIFICATION_ACCESSIBILITY_OTHER;
content::NotificationService::current()->Notify(
- content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED,
- content::Source<RenderViewHost>(this),
- content::NotificationService::NoDetails());
+ dst_type,
+ content::Source<RenderViewHost>(this),
+ content::NotificationService::NoDetails());
}
Send(new AccessibilityMsg_Notifications_ACK(GetRoutingID()));
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index 991b8db..940ba02 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -408,10 +408,6 @@ class CONTENT_EXPORT RenderViewHostImpl
save_accessibility_tree_for_testing_ = save;
}
- void set_send_accessibility_updated_notifications(bool send) {
- send_accessibility_updated_notifications_ = send;
- }
-
const AccessibilityNodeData& accessibility_tree_for_testing() {
return accessibility_tree_;
}
@@ -645,10 +641,6 @@ class CONTENT_EXPORT RenderViewHostImpl
// Whether the accessibility tree should be saved, for unit testing.
bool save_accessibility_tree_for_testing_;
- // Whether accessibility notifications are sent for all WebKit notifications
- // for unit testing.
- bool send_accessibility_updated_notifications_;
-
// A JSON serialized representation of the frame tree for the current document
// in the render view. For more details, see the comments on
// ViewHostMsg_FrameTreeUpdated.
diff --git a/content/public/browser/notification_types.h b/content/public/browser/notification_types.h
index b2a162f..9f78bfa 100644
--- a/content/public/browser/notification_types.h
+++ b/content/public/browser/notification_types.h
@@ -252,11 +252,6 @@ enum NotificationType {
// std::pair::<old RenderViewHost, new RenderViewHost>).
NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
- // Indicates that the render view host has received an accessibility tree
- // update, either partial or full, from the render view. The source is the
- // RenderViewHost, the details are not used.
- NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED,
-
// This is sent when a RenderWidgetHost is being destroyed. The source is
// the RenderWidgetHost, the details are not used.
NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
@@ -321,6 +316,21 @@ enum NotificationType {
// the RenderViewHost, and the details is a DomOperationNotificationDetails.
NOTIFICATION_DOM_OPERATION_RESPONSE,
+ // Indicates that the render view host has received a "load complete"
+ // accessibility notification. The source is the RenderViewHost,
+ // the details are not used.
+ NOTIFICATION_ACCESSIBILITY_LOAD_COMPLETE,
+
+ // Indicates that the render view host has received a "layout complete"
+ // accessibility notification. The source is the RenderViewHost,
+ // the details are not used.
+ NOTIFICATION_ACCESSIBILITY_LAYOUT_COMPLETE,
+
+ // Indicates that the render view host has received an accessibility
+ // notification. other than the ones covered above.
+ // The source is the RenderViewHost, the details are not used.
+ NOTIFICATION_ACCESSIBILITY_OTHER,
+
// Child Processes ---------------------------------------------------------
// This notification is sent when a child process host has connected to a
diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc
index 81d1d1a..67a00f3 100644
--- a/content/public/test/test_renderer_host.cc
+++ b/content/public/test/test_renderer_host.cc
@@ -27,13 +27,6 @@ RenderViewHostTester* RenderViewHostTester::For(RenderViewHost* host) {
}
// static
-void RenderViewHostTester::EnableAccessibilityUpdatedNotifications(
- RenderViewHost* host) {
- static_cast<RenderViewHostImpl*>(
- host)->set_send_accessibility_updated_notifications(true);
-}
-
-// static
RenderViewHost* RenderViewHostTester::GetPendingForController(
NavigationController* controller) {
WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
diff --git a/content/public/test/test_renderer_host.h b/content/public/test/test_renderer_host.h
index c4b1c5b..a580cf6 100644
--- a/content/public/test/test_renderer_host.h
+++ b/content/public/test/test_renderer_host.h
@@ -41,11 +41,6 @@ class RenderViewHostTester {
// RenderViewHostTestEnabler instance (see below) to do this.
static RenderViewHostTester* For(RenderViewHost* host);
- // This removes the need to expose
- // RenderViewHostImpl::set_send_accessibility_updated_notifications()
- // outside of content.
- static void EnableAccessibilityUpdatedNotifications(RenderViewHost* host);
-
// If the given WebContentsImpl has a pending RVH, returns it, otherwise NULL.
static RenderViewHost* GetPendingForController(
NavigationController* controller);