1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_
6 #define CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "build/build_config.h"
11 #include "chrome/browser/download/test_download_shelf.h"
12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/test/base/test_location_bar.h"
16 namespace extensions
{
20 // An implementation of BrowserWindow used for testing. TestBrowserWindow only
21 // contains a valid LocationBar, all other getters return NULL.
22 // See BrowserWithTestWindowTest for an example of using this class.
23 class TestBrowserWindow
: public BrowserWindow
{
26 virtual ~TestBrowserWindow();
29 virtual void Show() OVERRIDE
{}
30 virtual void ShowInactive() OVERRIDE
{}
31 virtual void Hide() OVERRIDE
{}
32 virtual void SetBounds(const gfx::Rect
& bounds
) OVERRIDE
{}
33 virtual void Close() OVERRIDE
{}
34 virtual void Activate() OVERRIDE
{}
35 virtual void Deactivate() OVERRIDE
{}
36 virtual bool IsActive() const OVERRIDE
;
37 virtual void FlashFrame(bool flash
) OVERRIDE
{}
38 virtual bool IsAlwaysOnTop() const OVERRIDE
;
39 virtual gfx::NativeWindow
GetNativeWindow() OVERRIDE
;
40 virtual BrowserWindowTesting
* GetBrowserWindowTesting() OVERRIDE
;
41 virtual StatusBubble
* GetStatusBubble() OVERRIDE
;
42 virtual void UpdateTitleBar() OVERRIDE
{}
43 virtual void BookmarkBarStateChanged(
44 BookmarkBar::AnimateChangeType change_type
) OVERRIDE
{}
45 virtual void UpdateDevTools() OVERRIDE
{}
46 virtual void UpdateLoadingAnimations(bool should_animate
) OVERRIDE
{}
47 virtual void SetStarredState(bool is_starred
) OVERRIDE
{}
48 virtual void ZoomChangedForActiveTab(bool can_show_bubble
) OVERRIDE
{}
49 virtual gfx::Rect
GetRestoredBounds() const OVERRIDE
;
50 virtual gfx::Rect
GetBounds() const OVERRIDE
;
51 virtual bool IsMaximized() const OVERRIDE
;
52 virtual bool IsMinimized() const OVERRIDE
;
53 virtual void Maximize() OVERRIDE
{}
54 virtual void Minimize() OVERRIDE
{}
55 virtual void Restore() OVERRIDE
{}
56 virtual void EnterFullscreen(
57 const GURL
& url
, FullscreenExitBubbleType type
) OVERRIDE
{}
58 virtual void ExitFullscreen() OVERRIDE
{}
59 virtual void UpdateFullscreenExitBubbleContent(
61 FullscreenExitBubbleType bubble_type
) OVERRIDE
{}
62 virtual bool IsFullscreen() const OVERRIDE
;
64 virtual void SetMetroSnapMode(bool enable
) OVERRIDE
{}
65 virtual bool IsInMetroSnapMode() const;
67 virtual bool IsFullscreenBubbleVisible() const OVERRIDE
;
68 virtual LocationBar
* GetLocationBar() const OVERRIDE
;
69 virtual void SetFocusToLocationBar(bool select_all
) OVERRIDE
{}
70 virtual void UpdateReloadStopState(bool is_loading
, bool force
) OVERRIDE
{}
71 virtual void UpdateToolbar(content::WebContents
* contents
,
72 bool should_restore_state
) OVERRIDE
{}
73 virtual void FocusToolbar() OVERRIDE
{}
74 virtual void FocusAppMenu() OVERRIDE
{}
75 virtual void FocusBookmarksToolbar() OVERRIDE
{}
76 virtual void RotatePaneFocus(bool forwards
) OVERRIDE
{}
77 virtual void ShowAppMenu() OVERRIDE
{}
78 virtual bool PreHandleKeyboardEvent(
79 const content::NativeWebKeyboardEvent
& event
,
80 bool* is_keyboard_shortcut
) OVERRIDE
;
81 virtual void HandleKeyboardEvent(
82 const content::NativeWebKeyboardEvent
& event
) OVERRIDE
{}
83 virtual void ShowCreateChromeAppShortcutsDialog(
85 const extensions::Extension
* app
) OVERRIDE
{}
87 virtual bool IsBookmarkBarVisible() const OVERRIDE
;
88 virtual bool IsBookmarkBarAnimating() const OVERRIDE
;
89 virtual bool IsTabStripEditable() const OVERRIDE
;
90 virtual bool IsToolbarVisible() const OVERRIDE
;
91 virtual gfx::Rect
GetRootWindowResizerRect() const OVERRIDE
;
92 virtual bool IsPanel() const OVERRIDE
;
93 virtual void ConfirmAddSearchProvider(TemplateURL
* template_url
,
94 Profile
* profile
) OVERRIDE
{}
95 virtual void ToggleBookmarkBar() OVERRIDE
{}
96 virtual void ShowUpdateChromeDialog() OVERRIDE
{}
97 virtual void ShowTaskManager(chrome::HostDesktopType desktop_type
) OVERRIDE
{}
98 virtual void ShowBackgroundPages(
99 chrome::HostDesktopType desktop_type
) OVERRIDE
{}
100 virtual void ShowBookmarkBubble(const GURL
& url
,
101 bool already_bookmarked
) OVERRIDE
{}
102 virtual void ShowChromeToMobileBubble() OVERRIDE
{}
103 #if defined(ENABLE_ONE_CLICK_SIGNIN)
104 virtual void ShowOneClickSigninBubble(
105 const StartSyncCallback
& start_sync_callback
) OVERRIDE
{}
107 virtual bool IsDownloadShelfVisible() const OVERRIDE
;
108 virtual DownloadShelf
* GetDownloadShelf() OVERRIDE
;
109 virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE
{}
110 virtual void UserChangedTheme() OVERRIDE
{}
111 virtual int GetExtraRenderViewHeight() const OVERRIDE
;
112 virtual void WebContentsFocused(content::WebContents
* contents
) OVERRIDE
{}
113 virtual void ShowPageInfo(content::WebContents
* web_contents
,
115 const content::SSLStatus
& ssl
,
116 bool show_history
) OVERRIDE
{}
117 virtual void ShowWebsiteSettings(Profile
* profile
,
118 content::WebContents
* web_contents
,
120 const content::SSLStatus
& ssl
,
121 bool show_history
) OVERRIDE
{}
122 virtual void Cut() OVERRIDE
{}
123 virtual void Copy() OVERRIDE
{}
124 virtual void Paste() OVERRIDE
{}
125 #if defined(OS_MACOSX)
126 virtual void OpenTabpose() OVERRIDE
{}
127 virtual void EnterPresentationMode(
129 FullscreenExitBubbleType bubble_type
) OVERRIDE
{}
130 virtual void ExitPresentationMode() OVERRIDE
{}
131 virtual bool InPresentationMode() OVERRIDE
;
134 virtual gfx::Rect
GetInstantBounds() OVERRIDE
;
135 virtual bool IsInstantTabShowing() OVERRIDE
;
136 virtual WindowOpenDisposition
GetDispositionForPopupBounds(
137 const gfx::Rect
& bounds
) OVERRIDE
;
138 virtual FindBar
* CreateFindBar() OVERRIDE
;
139 virtual bool GetConstrainedWindowTopY(int* top_y
) OVERRIDE
;
140 virtual void ShowAvatarBubble(content::WebContents
* web_contents
,
141 const gfx::Rect
& rect
) OVERRIDE
{}
142 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE
{}
143 virtual void ShowPasswordGenerationBubble(
144 const gfx::Rect
& rect
,
145 const content::PasswordForm
& form
,
146 autofill::PasswordGenerator
* generator
) OVERRIDE
{}
149 virtual void DestroyBrowser() OVERRIDE
{}
152 TestDownloadShelf download_shelf_
;
153 TestLocationBar location_bar_
;
155 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindow
);
160 // Helpers that handle the lifetime of TestBrowserWindow instances.
161 Browser
* CreateBrowserWithTestWindowForProfile(Profile
* profile
);
162 Browser
* CreateBrowserWithTestWindowForParams(Browser::CreateParams
* params
);
164 } // namespace chrome
166 #endif // CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_