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

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

Issue 196283013: Make to call WebContentsImpl::RenderViewCreated() when we create child window. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: remove "ax_event_notification_details.h" in web_contents_impl.h Created 6 years, 7 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/public/test/content_browser_test_utils.h
===================================================================
--- content/public/test/content_browser_test_utils.h (revision 270988)
+++ content/public/test/content_browser_test_utils.h (working copy)
@@ -5,6 +5,7 @@
#ifndef CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_
#define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_
+#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "ui/gfx/native_widget_types.h"
#include "url/gurl.h"
@@ -25,7 +26,9 @@
namespace content {
class MessageLoopRunner;
+class RenderViewCreatedObserver;
class Shell;
+class WebContents;
// Generate the file path for testing a particular test.
// The file for the tests is all located in
@@ -76,6 +79,33 @@
DISALLOW_COPY_AND_ASSIGN(ShellAddedObserver);
};
+// 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();
+
+ base::Callback<void(WebContents*)> web_contents_created_callback_;
+
+ private:
+ void WebContentsCreated(WebContents* web_contents);
+
+ // Callback invoked on WebContents creation.
+ WebContents* web_contents_;
+ scoped_ptr<RenderViewCreatedObserver> child_observer_;
+ scoped_refptr<MessageLoopRunner> runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebContentsAddedObserver);
+};
+
#if defined OS_MACOSX
void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds);
#endif
« no previous file with comments | « content/browser/web_contents/web_contents_impl_browsertest.cc ('k') | content/public/test/content_browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698