diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-01 18:28:48 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-01 18:28:48 +0000 |
commit | 7f2d47f382820256df5b4773e7e5d5de3243e6c7 (patch) | |
tree | 30aae19feaf2a5edad819cf5d79a1e1f35f1c571 /chrome/test/ui_test_utils.h | |
parent | 1fc91daf0448ca4f67a433f18abdba8cb747ed03 (diff) | |
download | chromium_src-7f2d47f382820256df5b4773e7e5d5de3243e6c7.zip chromium_src-7f2d47f382820256df5b4773e7e5d5de3243e6c7.tar.gz chromium_src-7f2d47f382820256df5b4773e7e5d5de3243e6c7.tar.bz2 |
Add test fixture for GPU browser tests which do image comparisons.
BUG=59131
TEST=none
Review URL: http://codereview.chromium.org/4723006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67877 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui_test_utils.h')
-rw-r--r-- | chrome/test/ui_test_utils.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/chrome/test/ui_test_utils.h b/chrome/test/ui_test_utils.h index 591c3f8..e07544f 100644 --- a/chrome/test/ui_test_utils.h +++ b/chrome/test/ui_test_utils.h @@ -7,6 +7,7 @@ #pragma once #include <map> +#include <queue> #include <string> #include <set> @@ -36,10 +37,16 @@ class NavigationController; class NotificationType; class Profile; class RenderViewHost; +class RenderWidgetHost; class ScopedTempDir; +class SkBitmap; class TabContents; class Value; +namespace gfx { +class Size; +} + // A collections of functions designed for use with InProcessBrowserTest. namespace ui_test_utils { @@ -422,6 +429,44 @@ void HideNativeWindow(gfx::NativeWindow window); // Show and focus a native window. void ShowAndFocusNativeWindow(gfx::NativeWindow window); +// 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(); + + // 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(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + + private: + NotificationRegistrar registrar_; + std::queue<std::string> message_queue_; + bool waiting_for_message_; + + DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); +}; + +// Takes a snapshot of the given render widget, rendered at |page_size|. The +// snapshot is set to |bitmap|. Returns true on success. +bool TakeRenderWidgetSnapshot(RenderWidgetHost* rwh, + const gfx::Size& page_size, + SkBitmap* bitmap) WARN_UNUSED_RESULT; + +// Takes a snapshot of the entire page, according to the width and height +// properties of the DOM's document. Returns true on success. DOMAutomation +// must be enabled. +bool TakeEntirePageSnapshot(RenderViewHost* rvh, + SkBitmap* bitmap) WARN_UNUSED_RESULT; + } // namespace ui_test_utils #endif // CHROME_TEST_UI_TEST_UTILS_H_ |