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

Unified Diff: content/public/test/browser_test_utils.h

Issue 818263004: Add a test that is a repro case for bug 444945. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill_crash'
Patch Set: Nasko's fixes Created 6 years 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 | « chrome/browser/task_manager/task_manager_browsertest.cc ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_utils.h
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h
index 60b19c730c72be568e0aeb11a267ce9ec551833f..8bb877acd6e617e1cb209e64b83dce06e2c0bbee 100644
--- a/content/public/test/browser_test_utils.h
+++ b/content/public/test/browser_test_utils.h
@@ -351,6 +351,35 @@ class DOMMessageQueue : public NotificationObserver {
DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue);
};
+// Used to wait for a new WebContents to be created. Instantiate this object
+// before the operation that will create the window.
+class WebContentsAddedObserver {
+ public:
+ WebContentsAddedObserver();
+ ~WebContentsAddedObserver();
+
+ // Will run a message loop to wait for the new window if it hasn't been
+ // created since the constructor
+ WebContents* GetWebContents();
+
+ // Will tell whether RenderViewCreated Callback has invoked
+ bool RenderViewCreatedCalled();
+
+ private:
+ class RenderViewCreatedObserver;
+
+ void WebContentsCreated(WebContents* web_contents);
+
+ // Callback to WebContentCreated(). Cached so that we can unregister it.
+ base::Callback<void(WebContents*)> web_contents_created_callback_;
+
+ WebContents* web_contents_;
+ scoped_ptr<RenderViewCreatedObserver> child_observer_;
+ scoped_refptr<MessageLoopRunner> runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebContentsAddedObserver);
+};
+
} // namespace content
#endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
« no previous file with comments | « chrome/browser/task_manager/task_manager_browsertest.cc ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698