| Index: content/test/content_browser_test_utils.h
|
| diff --git a/content/test/content_browser_test_utils.h b/content/test/content_browser_test_utils.h
|
| index 9ea40a5d542e7c4cf95416b650444534ad75bd55..e83af20b936826255b630616feb0798ee1c9a715 100644
|
| --- a/content/test/content_browser_test_utils.h
|
| +++ b/content/test/content_browser_test_utils.h
|
| @@ -5,7 +5,13 @@
|
| #ifndef CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_H_
|
| #define CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_H_
|
|
|
| +#include <queue>
|
| +
|
| #include "base/memory/ref_counted.h"
|
| +#include "content/public/browser/notification_details.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| +#include "content/public/browser/notification_source.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "ui/gfx/native_widget_types.h"
|
|
|
| @@ -69,6 +75,37 @@ class ShellAddedObserver {
|
| DISALLOW_COPY_AND_ASSIGN(ShellAddedObserver);
|
| };
|
|
|
| +// Watches for responses from the DOMAutomationController and keeps them in a
|
| +// queue. Useful for waiting for a message to be received.
|
| +class DOMMessageQueue : public content::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 content::NotificationObserver methods.
|
| + virtual void Observe(int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) OVERRIDE;
|
| +
|
| + private:
|
| + content::NotificationRegistrar registrar_;
|
| + std::queue<std::string> message_queue_;
|
| + bool waiting_for_message_;
|
| + scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue);
|
| +};
|
| +
|
| #if defined OS_MACOSX
|
| void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds);
|
| #endif
|
|
|