| 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 83ea128e9c5f8a1c7bb6faea38b374be7b770563..b807e3194aab4be867adf93569dd1a7048a1a30a 100644
|
| --- a/content/public/test/browser_test_utils.h
|
| +++ b/content/public/test/browser_test_utils.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
|
| #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
|
|
|
| +#include <queue>
|
| #include <string>
|
| #include <vector>
|
|
|
| @@ -212,6 +213,37 @@ class TestWebSocketServer {
|
| DISALLOW_COPY_AND_ASSIGN(TestWebSocketServer);
|
| };
|
|
|
| +// 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 {
|
| + public:
|
| + // Constructs a DOMMessageQueue and begins listening for messages from the
|
| + // DOMAutomationController. Do not construct this until the browser has
|
| + // started.
|
| + DOMMessageQueue();
|
| + virtual ~DOMMessageQueue();
|
| +
|
| + // Removes all messages in the message queue.
|
| + void ClearQueue();
|
| +
|
| + // Wait for the next message to arrive. |message| will be set to the next
|
| + // message, if not null. Returns true on success.
|
| + bool WaitForMessage(std::string* message) WARN_UNUSED_RESULT;
|
| +
|
| + // Overridden NotificationObserver methods.
|
| + virtual void Observe(int type,
|
| + const NotificationSource& source,
|
| + const NotificationDetails& details) OVERRIDE;
|
| +
|
| + private:
|
| + NotificationRegistrar registrar_;
|
| + std::queue<std::string> message_queue_;
|
| + bool waiting_for_message_;
|
| + scoped_refptr<MessageLoopRunner> message_loop_runner_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue);
|
| +};
|
| +
|
| } // namespace content
|
|
|
| #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
|
|
|