summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/accessibility/cross_platform_accessibility_browsertest.cc8
-rw-r--r--content/browser/accessibility/dump_accessibility_tree_browsertest.cc24
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc26
-rw-r--r--content/browser/renderer_host/render_view_host_impl.h10
-rw-r--r--content/public/browser/notification_types.h15
5 files changed, 41 insertions, 42 deletions
diff --git a/content/browser/accessibility/cross_platform_accessibility_browsertest.cc b/content/browser/accessibility/cross_platform_accessibility_browsertest.cc
index 7135283..fd3c4bd 100644
--- a/content/browser/accessibility/cross_platform_accessibility_browsertest.cc
+++ b/content/browser/accessibility/cross_platform_accessibility_browsertest.cc
@@ -33,17 +33,17 @@ class CrossPlatformAccessibilityBrowserTest : public ContentBrowserTest {
// notification that it's been received.
const AccessibilityNodeData& GetAccessibilityNodeDataTree(
AccessibilityMode accessibility_mode = AccessibilityModeComplete) {
- WindowedNotificationObserver tree_updated_observer(
- NOTIFICATION_ACCESSIBILITY_LAYOUT_COMPLETE,
- NotificationService::AllSources());
+ scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner);
RenderWidgetHostView* host_view =
shell()->web_contents()->GetRenderWidgetHostView();
RenderWidgetHostImpl* host =
RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost());
RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host);
+ view_host->SetAccessibilityLayoutCompleteCallbackForTesting(
+ loop_runner->QuitClosure());
view_host->set_save_accessibility_tree_for_testing(true);
view_host->SetAccessibilityMode(accessibility_mode);
- tree_updated_observer.Wait();
+ loop_runner->Run();
return view_host->accessibility_tree_for_testing();
}
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
index 9b47dfb..b1c7d98 100644
--- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
+++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -18,8 +18,6 @@
#include "content/browser/accessibility/dump_accessibility_tree_helper.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/port/browser/render_widget_host_view_port.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_paths.h"
#include "content/public/test/test_utils.h"
@@ -28,14 +26,16 @@
#include "content/shell/shell.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace content {
+
namespace {
- static const char kCommentToken = '#';
- static const char* kMarkSkipFile = "#<skip";
- static const char* kMarkEndOfFile = "<-- End-of-file -->";
- static const char* kSignalDiff = "*";
-} // namespace
-namespace content {
+const char kCommentToken = '#';
+const char kMarkSkipFile[] = "#<skip";
+const char kMarkEndOfFile[] = "<-- End-of-file -->";
+const char kSignalDiff[] = "*";
+
+} // namespace
typedef DumpAccessibilityTreeHelper::Filter Filter;
@@ -166,17 +166,17 @@ void DumpAccessibilityTreeTest::RunTest(
}
// Load the page.
- WindowedNotificationObserver tree_updated_observer(
- NOTIFICATION_ACCESSIBILITY_LOAD_COMPLETE,
- NotificationService::AllSources());
string16 html_contents16;
html_contents16 = UTF8ToUTF16(html_contents);
GURL url = GetTestUrl("accessibility",
html_file.BaseName().MaybeAsASCII().c_str());
+ scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner);
+ view_host->SetAccessibilityLoadCompleteCallbackForTesting(
+ loop_runner->QuitClosure());
NavigateToURL(shell(), url);
// Wait for the tree.
- tree_updated_observer.Wait();
+ loop_runner->Run();
// Perform a diff (or write the initial baseline).
string16 actual_contents_utf16;
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index b9c2a29..4ff3c54 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -1786,6 +1786,16 @@ void RenderViewHostImpl::UpdateFrameTree(
frame_tree_));
}
+void RenderViewHostImpl::SetAccessibilityLayoutCompleteCallbackForTesting(
+ const base::Closure& callback) {
+ accessibility_layout_callback_ = callback;
+}
+
+void RenderViewHostImpl::SetAccessibilityLoadCompleteCallbackForTesting(
+ const base::Closure& callback) {
+ accessibility_load_callback_ = callback;
+}
+
void RenderViewHostImpl::UpdateWebkitPreferences(
const webkit_glue::WebPreferences& prefs) {
Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs));
@@ -1892,17 +1902,11 @@ void RenderViewHostImpl::OnAccessibilityNotifications(
accessibility_tree_ = param.acc_tree;
}
- NotificationType dst_type;
- if (src_type == AccessibilityNotificationLoadComplete)
- dst_type = NOTIFICATION_ACCESSIBILITY_LOAD_COMPLETE;
- else if (src_type == AccessibilityNotificationLayoutComplete)
- dst_type = NOTIFICATION_ACCESSIBILITY_LAYOUT_COMPLETE;
- else
- dst_type = NOTIFICATION_ACCESSIBILITY_OTHER;
- NotificationService::current()->Notify(
- dst_type,
- Source<RenderViewHost>(this),
- NotificationService::NoDetails());
+ if (src_type == AccessibilityNotificationLayoutComplete) {
+ accessibility_layout_callback_.Run();
+ } else if (src_type == AccessibilityNotificationLoadComplete) {
+ accessibility_load_callback_.Run();
+ }
}
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 7d57852..0a79634 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -414,6 +414,12 @@ class CONTENT_EXPORT RenderViewHostImpl
int route_id,
const std::string& frame_tree);
+ // Set accessibility callbacks.
+ void SetAccessibilityLayoutCompleteCallbackForTesting(
+ const base::Closure& callback);
+ void SetAccessibilityLoadCompleteCallbackForTesting(
+ const base::Closure& callback);
+
void set_save_accessibility_tree_for_testing(bool save) {
save_accessibility_tree_for_testing_ = save;
}
@@ -652,6 +658,10 @@ class CONTENT_EXPORT RenderViewHostImpl
// callbacks.
std::map<int, JavascriptResultCallback> javascript_callbacks_;
+ // Accessibility callbacks.
+ base::Closure accessibility_layout_callback_;
+ base::Closure accessibility_load_callback_;
+
// True if the render view can be shut down suddenly.
bool sudden_termination_allowed_;
diff --git a/content/public/browser/notification_types.h b/content/public/browser/notification_types.h
index cfaafd5..de035c0 100644
--- a/content/public/browser/notification_types.h
+++ b/content/public/browser/notification_types.h
@@ -250,21 +250,6 @@ 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