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

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

Issue 12210082: content: convert accessibility notifications to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trybots 2 Created 7 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
Index: content/browser/accessibility/dump_accessibility_tree_browsertest.cc
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
index 9b47dfb408bcbcd55aa88a43bd3ef8bb01f57a67..0c65faf43269c4d13d0a9b50c36a0f769591d16f 100644
--- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
+++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -18,8 +18,7 @@
#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/render_view_host_observer.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_paths.h"
#include "content/public/test/test_utils.h"
@@ -28,14 +27,34 @@
#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[] = "*";
+
+class TestRenderViewHostObserver : public RenderViewHostObserver {
+ public:
+ explicit TestRenderViewHostObserver(RenderViewHost* rvh,
+ const base::Closure& callback)
+ : RenderViewHostObserver(rvh),
+ callback_(callback) {
+ }
+
+ virtual void AccessibilityLoadComplete() OVERRIDE {
+ callback_.Run();
+ }
+
+ private:
+ base::Closure callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestRenderViewHostObserver);
+};
+
+} // namespace
typedef DumpAccessibilityTreeHelper::Filter Filter;
@@ -166,17 +185,16 @@ 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);
+ TestRenderViewHostObserver observer(view_host, 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;

Powered by Google App Engine
This is Rietveld 408576698