diff options
author | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 19:12:24 +0000 |
---|---|---|
committer | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 19:12:24 +0000 |
commit | 8fd7b2d6cd00d43f63ccee9bd3372e79814b137b (patch) | |
tree | d561c62dd20c1bce07ec97a394e816a6ba05a78b /chrome | |
parent | cc0eb0e6ac56e505d07c29dc54df7e668d768a32 (diff) | |
download | chromium_src-8fd7b2d6cd00d43f63ccee9bd3372e79814b137b.zip chromium_src-8fd7b2d6cd00d43f63ccee9bd3372e79814b137b.tar.gz chromium_src-8fd7b2d6cd00d43f63ccee9bd3372e79814b137b.tar.bz2 |
Add NativePanelTesting utility interface for testing panels.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7388017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92726 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
7 files changed, 32 insertions, 3 deletions
diff --git a/chrome/browser/ui/panels/native_panel.h b/chrome/browser/ui/panels/native_panel.h index e6795df..b4b6bd0 100644 --- a/chrome/browser/ui/panels/native_panel.h +++ b/chrome/browser/ui/panels/native_panel.h @@ -9,6 +9,7 @@ #include "chrome/browser/ui/panels/panel.h" #include "ui/gfx/native_widget_types.h" +class NativePanelTesting; class Panel; namespace gfx { @@ -58,6 +59,18 @@ class NativePanel { virtual void NotifyPanelOnUserChangedTheme() = 0; virtual void FlashPanelFrame() = 0; virtual void DestroyPanelBrowser() = 0; + + // Returns a pointer to the testing interface to the native panel. + virtual NativePanelTesting* GetNativePanelTesting() = 0; +}; + +// A NativePanel utility interface used for accessing elements of the +// native panel used only by test automation. +class NativePanelTesting { + public: + + protected: + virtual ~NativePanelTesting() {} }; #endif // CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc index 922b0d5..e8f9a4c 100644 --- a/chrome/browser/ui/panels/panel_browser_view.cc +++ b/chrome/browser/ui/panels/panel_browser_view.cc @@ -249,6 +249,10 @@ void PanelBrowserView::DestroyPanelBrowser() { DestroyBrowser(); } +NativePanelTesting* PanelBrowserView::GetNativePanelTesting() { + return this; +} + PanelBrowserFrameView* PanelBrowserView::GetFrameView() const { return static_cast<PanelBrowserFrameView*>(frame()->GetFrameView()); } diff --git a/chrome/browser/ui/panels/panel_browser_view.h b/chrome/browser/ui/panels/panel_browser_view.h index 553366a..8e5ef85 100644 --- a/chrome/browser/ui/panels/panel_browser_view.h +++ b/chrome/browser/ui/panels/panel_browser_view.h @@ -22,6 +22,7 @@ class SlideAnimation; // A browser view that implements Panel specific behavior. class PanelBrowserView : public BrowserView, public NativePanel, + public NativePanelTesting, public ui::AnimationDelegate { public: PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds); @@ -85,6 +86,7 @@ class PanelBrowserView : public BrowserView, virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; virtual void FlashPanelFrame() OVERRIDE; virtual void DestroyPanelBrowser() OVERRIDE; + virtual NativePanelTesting* GetNativePanelTesting() OVERRIDE; // Overridden from AnimationDelegate: virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; diff --git a/chrome/browser/ui/panels/panel_browser_window_cocoa.h b/chrome/browser/ui/panels/panel_browser_window_cocoa.h index 23544be..b78a732 100644 --- a/chrome/browser/ui/panels/panel_browser_window_cocoa.h +++ b/chrome/browser/ui/panels/panel_browser_window_cocoa.h @@ -19,7 +19,8 @@ class Panel; // Bridges between C++ and the Cocoa NSWindow. Cross-platform code will // interact with this object when it needs to manipulate the window. -class PanelBrowserWindowCocoa : public NativePanel { +class PanelBrowserWindowCocoa : public NativePanel, + public NativePanelTesting { public: PanelBrowserWindowCocoa(Browser* browser, Panel* panel, const gfx::Rect& bounds); @@ -44,6 +45,7 @@ class PanelBrowserWindowCocoa : public NativePanel { virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; virtual void FlashPanelFrame() OVERRIDE; virtual void DestroyPanelBrowser() OVERRIDE; + virtual NativePanelTesting* GetNativePanelTesting() OVERRIDE; Panel* panel() { return panel_.get(); } @@ -66,4 +68,3 @@ class PanelBrowserWindowCocoa : public NativePanel { }; #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_COCOA_H_ - diff --git a/chrome/browser/ui/panels/panel_browser_window_cocoa.mm b/chrome/browser/ui/panels/panel_browser_window_cocoa.mm index 543caf9..0c8a4bf 100644 --- a/chrome/browser/ui/panels/panel_browser_window_cocoa.mm +++ b/chrome/browser/ui/panels/panel_browser_window_cocoa.mm @@ -145,3 +145,6 @@ void PanelBrowserWindowCocoa::DestroyPanelBrowser() { controller_ = NULL; } +NativePanelTesting* PanelBrowserWindowCocoa::GetNativePanelTesting() { + return this; +} diff --git a/chrome/browser/ui/panels/panel_browser_window_gtk.cc b/chrome/browser/ui/panels/panel_browser_window_gtk.cc index ffb31b9..81a32a4 100644 --- a/chrome/browser/ui/panels/panel_browser_window_gtk.cc +++ b/chrome/browser/ui/panels/panel_browser_window_gtk.cc @@ -142,6 +142,10 @@ void PanelBrowserWindowGtk::DestroyPanelBrowser() { DestroyBrowser(); } +NativePanelTesting* PanelBrowserWindowGtk::GetNativePanelTesting() { + return this; +} + void PanelBrowserWindowGtk::SetBoundsImpl() { gtk_window_move(window_, bounds_.x(), bounds_.y()); gtk_window_resize(window(), bounds_.width(), bounds_.height()); diff --git a/chrome/browser/ui/panels/panel_browser_window_gtk.h b/chrome/browser/ui/panels/panel_browser_window_gtk.h index 394620e..0dc2168 100644 --- a/chrome/browser/ui/panels/panel_browser_window_gtk.h +++ b/chrome/browser/ui/panels/panel_browser_window_gtk.h @@ -11,7 +11,8 @@ class Panel; class PanelBrowserWindowGtk : public BrowserWindowGtk, - public NativePanel { + public NativePanel, + public NativePanelTesting { public: PanelBrowserWindowGtk(Browser* browser, Panel* panel, const gfx::Rect& bounds); @@ -53,6 +54,7 @@ class PanelBrowserWindowGtk : public BrowserWindowGtk, virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; virtual void FlashPanelFrame() OVERRIDE; virtual void DestroyPanelBrowser() OVERRIDE; + virtual NativePanelTesting* GetNativePanelTesting() OVERRIDE; private: void SetBoundsImpl(); |