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 eb3dd6e08184d4f5b133b8328db94350ea1b323f..a0f4902953f4b27a32088ed4a8d2ebbb8980b089 100644 |
--- a/content/public/test/browser_test_utils.h |
+++ b/content/public/test/browser_test_utils.h |
@@ -223,6 +223,24 @@ class TitleWatcher : public WebContentsObserver { |
DISALLOW_COPY_AND_ASSIGN(TitleWatcher); |
}; |
+// Watches a WebContents and blocks until it is destroyed. |
+class WebContentsDestroyedWatcher : public WebContentsObserver { |
jam
2013/10/15 16:50:52
i'm curious why this API isn't just a method? i.e.
Avi (use Gerrit)
2013/10/15 16:57:24
Er... yeah. Good point, I hadn't thought about sim
Avi (use Gerrit)
2013/10/15 20:16:32
Actually, no, that's not a good design. That just
jam
2013/10/15 20:47:15
Yes I understand why we use that pattern in other
jam
2013/10/15 20:48:04
also, in this situation, if the WC is destroyed be
|
+ public: |
+ explicit WebContentsDestroyedWatcher(WebContents* web_contents); |
+ virtual ~WebContentsDestroyedWatcher(); |
+ |
+ // Waits until the WebContents is destroyed. |
+ void Wait(); |
+ |
+ private: |
+ // Overridden WebContentsObserver methods. |
+ virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; |
+ |
+ scoped_refptr<MessageLoopRunner> message_loop_runner_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(WebContentsDestroyedWatcher); |
+}; |
+ |
// Watches for responses from the DOMAutomationController and keeps them in a |
// queue. Useful for waiting for a message to be received. |
class DOMMessageQueue : public NotificationObserver { |