Implement nacl_irt_memory for non-sfi mode.
[chromium-blink-merge.git] / chrome / test / base / test_browser_window.cc
blob4e385d078daff4b182c127aa47403efe57517e14
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/rect.h"
12 // Helpers --------------------------------------------------------------------
14 namespace chrome {
16 namespace {
18 // Handles destroying a TestBrowserWindow when the Browser it is attached to is
19 // destroyed.
20 class TestBrowserWindowOwner : public chrome::BrowserListObserver {
21 public:
22 explicit TestBrowserWindowOwner(TestBrowserWindow* window) : window_(window) {
23 BrowserList::AddObserver(this);
25 virtual ~TestBrowserWindowOwner() {
26 BrowserList::RemoveObserver(this);
29 private:
30 // Overridden from BrowserListObserver:
31 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE {
32 if (browser->window() == window_.get())
33 delete this;
36 scoped_ptr<TestBrowserWindow> window_;
38 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowOwner);
41 } // namespace
43 Browser* CreateBrowserWithTestWindowForParams(Browser::CreateParams* params) {
44 TestBrowserWindow* window = new TestBrowserWindow;
45 new TestBrowserWindowOwner(window);
46 params->window = window;
47 return new Browser(*params);
50 } // namespace chrome
53 // TestBrowserWindow::TestLocationBar -----------------------------------------
55 GURL TestBrowserWindow::TestLocationBar::GetDestinationURL() const {
56 return GURL();
59 WindowOpenDisposition
60 TestBrowserWindow::TestLocationBar::GetWindowOpenDisposition() const {
61 return CURRENT_TAB;
64 content::PageTransition
65 TestBrowserWindow::TestLocationBar::GetPageTransition() const {
66 return content::PAGE_TRANSITION_LINK;
69 const OmniboxView* TestBrowserWindow::TestLocationBar::GetOmniboxView() const {
70 return NULL;
73 OmniboxView* TestBrowserWindow::TestLocationBar::GetOmniboxView() {
74 return NULL;
77 LocationBarTesting*
78 TestBrowserWindow::TestLocationBar::GetLocationBarForTesting() {
79 return NULL;
83 // TestBrowserWindow ----------------------------------------------------------
85 TestBrowserWindow::TestBrowserWindow() {}
87 TestBrowserWindow::~TestBrowserWindow() {}
89 bool TestBrowserWindow::IsActive() const {
90 return false;
93 bool TestBrowserWindow::IsAlwaysOnTop() const {
94 return false;
97 gfx::NativeWindow TestBrowserWindow::GetNativeWindow() {
98 return NULL;
101 BrowserWindowTesting* TestBrowserWindow::GetBrowserWindowTesting() {
102 return NULL;
105 StatusBubble* TestBrowserWindow::GetStatusBubble() {
106 return NULL;
109 gfx::Rect TestBrowserWindow::GetRestoredBounds() const {
110 return gfx::Rect();
113 ui::WindowShowState TestBrowserWindow::GetRestoredState() const {
114 return ui::SHOW_STATE_DEFAULT;
117 gfx::Rect TestBrowserWindow::GetBounds() const {
118 return gfx::Rect();
121 bool TestBrowserWindow::IsMaximized() const {
122 return false;
125 bool TestBrowserWindow::IsMinimized() const {
126 return false;
129 bool TestBrowserWindow::ShouldHideUIForFullscreen() const {
130 return false;
133 bool TestBrowserWindow::IsFullscreen() const {
134 return false;
137 #if defined(OS_WIN)
138 bool TestBrowserWindow::IsInMetroSnapMode() const {
139 return false;
141 #endif
143 bool TestBrowserWindow::IsFullscreenBubbleVisible() const {
144 return false;
147 LocationBar* TestBrowserWindow::GetLocationBar() const {
148 return const_cast<TestLocationBar*>(&location_bar_);
151 bool TestBrowserWindow::PreHandleKeyboardEvent(
152 const content::NativeWebKeyboardEvent& event,
153 bool* is_keyboard_shortcut) {
154 return false;
157 bool TestBrowserWindow::IsBookmarkBarVisible() const {
158 return false;
161 bool TestBrowserWindow::IsBookmarkBarAnimating() const {
162 return false;
165 bool TestBrowserWindow::IsTabStripEditable() const {
166 return false;
169 bool TestBrowserWindow::IsToolbarVisible() const {
170 return false;
173 gfx::Rect TestBrowserWindow::GetRootWindowResizerRect() const {
174 return gfx::Rect();
177 bool TestBrowserWindow::IsDownloadShelfVisible() const {
178 return false;
181 DownloadShelf* TestBrowserWindow::GetDownloadShelf() {
182 return &download_shelf_;
185 int TestBrowserWindow::GetExtraRenderViewHeight() const {
186 return 0;
189 #if defined(OS_MACOSX)
190 bool TestBrowserWindow::IsFullscreenWithChrome() {
191 return false;
194 bool TestBrowserWindow::IsFullscreenWithoutChrome() {
195 return false;
197 #endif
199 WindowOpenDisposition TestBrowserWindow::GetDispositionForPopupBounds(
200 const gfx::Rect& bounds) {
201 return NEW_POPUP;
204 FindBar* TestBrowserWindow::CreateFindBar() {
205 return NULL;
208 web_modal::WebContentsModalDialogHost*
209 TestBrowserWindow::GetWebContentsModalDialogHost() {
210 return NULL;
214 TestBrowserWindow::GetRenderViewHeightInsetWithDetachedBookmarkBar() {
215 return 0;