Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / test / base / test_browser_window.cc
blob63ee1ae7e4c4fb65fdc3ac3ab44dc61620a2147e
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 #include "chrome/test/base/test_browser_window.h"
7 #include "chrome/browser/ui/browser_list.h"
8 #include "chrome/browser/ui/browser_list_observer.h"
9 #include "ui/gfx/geometry/rect.h"
12 // Helpers --------------------------------------------------------------------
14 namespace chrome {
16 scoped_ptr<Browser> CreateBrowserWithTestWindowForParams(
17 Browser::CreateParams* params) {
18 TestBrowserWindow* window = new TestBrowserWindow;
19 new TestBrowserWindowOwner(window);
20 params->window = window;
21 return make_scoped_ptr(new Browser(*params));
24 } // namespace chrome
27 // TestBrowserWindow::TestLocationBar -----------------------------------------
29 GURL TestBrowserWindow::TestLocationBar::GetDestinationURL() const {
30 return GURL();
33 WindowOpenDisposition
34 TestBrowserWindow::TestLocationBar::GetWindowOpenDisposition() const {
35 return CURRENT_TAB;
38 ui::PageTransition
39 TestBrowserWindow::TestLocationBar::GetPageTransition() const {
40 return ui::PAGE_TRANSITION_LINK;
43 bool TestBrowserWindow::TestLocationBar::ShowPageActionPopup(
44 const extensions::Extension* extension, bool grant_active_tab) {
45 return false;
48 const OmniboxView* TestBrowserWindow::TestLocationBar::GetOmniboxView() const {
49 return NULL;
52 OmniboxView* TestBrowserWindow::TestLocationBar::GetOmniboxView() {
53 return NULL;
56 LocationBarTesting*
57 TestBrowserWindow::TestLocationBar::GetLocationBarForTesting() {
58 return NULL;
62 // TestBrowserWindow ----------------------------------------------------------
64 TestBrowserWindow::TestBrowserWindow() {}
66 TestBrowserWindow::~TestBrowserWindow() {}
68 bool TestBrowserWindow::IsActive() const {
69 return false;
72 bool TestBrowserWindow::IsAlwaysOnTop() const {
73 return false;
76 gfx::NativeWindow TestBrowserWindow::GetNativeWindow() const {
77 return NULL;
80 StatusBubble* TestBrowserWindow::GetStatusBubble() {
81 return NULL;
84 gfx::Rect TestBrowserWindow::GetRestoredBounds() const {
85 return gfx::Rect();
88 ui::WindowShowState TestBrowserWindow::GetRestoredState() const {
89 return ui::SHOW_STATE_DEFAULT;
92 gfx::Rect TestBrowserWindow::GetBounds() const {
93 return gfx::Rect();
96 bool TestBrowserWindow::IsMaximized() const {
97 return false;
100 bool TestBrowserWindow::IsMinimized() const {
101 return false;
104 bool TestBrowserWindow::ShouldHideUIForFullscreen() const {
105 return false;
108 bool TestBrowserWindow::IsFullscreen() const {
109 return false;
112 bool TestBrowserWindow::IsFullscreenBubbleVisible() const {
113 return false;
116 bool TestBrowserWindow::SupportsFullscreenWithToolbar() const {
117 return false;
120 void TestBrowserWindow::UpdateFullscreenWithToolbar(bool with_toolbar) {
123 bool TestBrowserWindow::IsFullscreenWithToolbar() const {
124 return false;
127 #if defined(OS_WIN)
128 bool TestBrowserWindow::IsInMetroSnapMode() const {
129 return false;
131 #endif
133 LocationBar* TestBrowserWindow::GetLocationBar() const {
134 return const_cast<TestLocationBar*>(&location_bar_);
137 ToolbarActionsBar* TestBrowserWindow::GetToolbarActionsBar() {
138 return nullptr;
141 bool TestBrowserWindow::PreHandleKeyboardEvent(
142 const content::NativeWebKeyboardEvent& event,
143 bool* is_keyboard_shortcut) {
144 return false;
147 bool TestBrowserWindow::IsBookmarkBarVisible() const {
148 return false;
151 bool TestBrowserWindow::IsBookmarkBarAnimating() const {
152 return false;
155 bool TestBrowserWindow::IsTabStripEditable() const {
156 return false;
159 bool TestBrowserWindow::IsToolbarVisible() const {
160 return false;
163 gfx::Rect TestBrowserWindow::GetRootWindowResizerRect() const {
164 return gfx::Rect();
167 bool TestBrowserWindow::ShowSessionCrashedBubble() {
168 return false;
171 bool TestBrowserWindow::IsProfileResetBubbleSupported() const {
172 return false;
175 GlobalErrorBubbleViewBase* TestBrowserWindow::ShowProfileResetBubble(
176 const base::WeakPtr<ProfileResetGlobalError>& global_error) {
177 return nullptr;
180 bool TestBrowserWindow::IsDownloadShelfVisible() const {
181 return false;
184 DownloadShelf* TestBrowserWindow::GetDownloadShelf() {
185 return &download_shelf_;
188 WindowOpenDisposition TestBrowserWindow::GetDispositionForPopupBounds(
189 const gfx::Rect& bounds) {
190 return NEW_POPUP;
193 FindBar* TestBrowserWindow::CreateFindBar() {
194 return NULL;
197 web_modal::WebContentsModalDialogHost*
198 TestBrowserWindow::GetWebContentsModalDialogHost() {
199 return NULL;
202 int TestBrowserWindow::GetRenderViewHeightInsetWithDetachedBookmarkBar() {
203 return 0;
206 void TestBrowserWindow::ExecuteExtensionCommand(
207 const extensions::Extension* extension,
208 const extensions::Command& command) {}
210 ExclusiveAccessContext* TestBrowserWindow::GetExclusiveAccessContext() {
211 return nullptr;
214 // TestBrowserWindowOwner -----------------------------------------------------
216 TestBrowserWindowOwner::TestBrowserWindowOwner(TestBrowserWindow* window)
217 : window_(window) {
218 BrowserList::AddObserver(this);
221 TestBrowserWindowOwner::~TestBrowserWindowOwner() {
222 BrowserList::RemoveObserver(this);
225 void TestBrowserWindowOwner::OnBrowserRemoved(Browser* browser) {
226 if (browser->window() == window_.get())
227 delete this;