Chromium Code Reviews| Index: content/test/content_browser_test_utils.h |
| =================================================================== |
| --- content/test/content_browser_test_utils.h (revision 256801) |
| +++ content/test/content_browser_test_utils.h (working copy) |
| @@ -5,6 +5,7 @@ |
| #ifndef CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
| #define CONTENT_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" |
| @@ -24,8 +25,10 @@ |
| namespace content { |
| class MessageLoopRunner; |
| +class RenderViewCreatedObserver; |
| +class RenderViewHost; |
|
jam
2014/05/15 19:30:19
nit: not needed
Jimmy Jo
2014/05/16 01:15:47
Done.
|
| class Shell; |
| - |
| +class WebContents; |
| // Generate the file path for testing a particular test. |
| // The file for the tests is all located in |
| // content/test/data/dir/<file> |
| @@ -71,6 +74,28 @@ |
| 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(); |
| + |
| + WebContents* GetWebContents(); |
| + bool RenderViewCreatedCalled(); |
|
jam
2014/05/15 19:30:19
nit: please document these two methods
Jimmy Jo
2014/05/16 01:15:47
Done.
|
| + private: |
|
jam
2014/05/15 19:30:19
nit: blank line above this per style guide
Jimmy Jo
2014/05/16 01:15:47
Done.
|
| + void WebContentsCreated(WebContents* web_contents); |
| + |
| + public: |
|
jam
2014/05/15 19:30:19
nit: put a public section and then private, and do
Jimmy Jo
2014/05/16 01:15:47
Done.
|
| + // Callback invoked on WebContents creation. |
| + WebContents* web_contents_; |
| + RenderViewCreatedObserver* child_observer_; |
|
jam
2014/05/15 19:30:19
nit: put this in a scoped_ptr so it doesn't leak
Jimmy Jo
2014/05/16 01:15:47
Done.
|
| + scoped_refptr<MessageLoopRunner> runner_; |
| + base::Callback<void(WebContents*)> web_contents_created_callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebContentsAddedObserver); |
| +}; |
| + |
| #if defined OS_MACOSX |
| void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); |
| #endif |