Durable Storage: Refactor browser test and test the basic "deny" flow.
[chromium-blink-merge.git] / chrome / test / base / test_browser_window.cc
blobe3cf6c8c5c983233f7d23e9fba666fa694fc40a2
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 bool TestBrowserWindow::PreHandleKeyboardEvent(
138 const content::NativeWebKeyboardEvent& event,
139 bool* is_keyboard_shortcut) {
140 return false;
143 bool TestBrowserWindow::IsBookmarkBarVisible() const {
144 return false;
147 bool TestBrowserWindow::IsBookmarkBarAnimating() const {
148 return false;
151 bool TestBrowserWindow::IsTabStripEditable() const {
152 return false;
155 bool TestBrowserWindow::IsToolbarVisible() const {
156 return false;
159 gfx::Rect TestBrowserWindow::GetRootWindowResizerRect() const {
160 return gfx::Rect();
163 bool TestBrowserWindow::ShowSessionCrashedBubble() {
164 return false;
167 bool TestBrowserWindow::IsProfileResetBubbleSupported() const {
168 return false;
171 GlobalErrorBubbleViewBase* TestBrowserWindow::ShowProfileResetBubble(
172 const base::WeakPtr<ProfileResetGlobalError>& global_error) {
173 return nullptr;
176 bool TestBrowserWindow::IsDownloadShelfVisible() const {
177 return false;
180 DownloadShelf* TestBrowserWindow::GetDownloadShelf() {
181 return &download_shelf_;
184 WindowOpenDisposition TestBrowserWindow::GetDispositionForPopupBounds(
185 const gfx::Rect& bounds) {
186 return NEW_POPUP;
189 FindBar* TestBrowserWindow::CreateFindBar() {
190 return NULL;
193 web_modal::WebContentsModalDialogHost*
194 TestBrowserWindow::GetWebContentsModalDialogHost() {
195 return NULL;
198 int TestBrowserWindow::GetRenderViewHeightInsetWithDetachedBookmarkBar() {
199 return 0;
202 void TestBrowserWindow::ExecuteExtensionCommand(
203 const extensions::Extension* extension,
204 const extensions::Command& command) {}
206 ExclusiveAccessContext* TestBrowserWindow::GetExclusiveAccessContext() {
207 return nullptr;
210 // TestBrowserWindowOwner -----------------------------------------------------
212 TestBrowserWindowOwner::TestBrowserWindowOwner(TestBrowserWindow* window)
213 : window_(window) {
214 BrowserList::AddObserver(this);
217 TestBrowserWindowOwner::~TestBrowserWindowOwner() {
218 BrowserList::RemoveObserver(this);
221 void TestBrowserWindowOwner::OnBrowserRemoved(Browser* browser) {
222 if (browser->window() == window_.get())
223 delete this;