Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / test / base / test_browser_window.cc
blobf04e7ae365f262b717860cd6d761e455db84d7f3
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 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 ~TestBrowserWindowOwner() override { BrowserList::RemoveObserver(this); }
27 private:
28 // Overridden from BrowserListObserver:
29 void OnBrowserRemoved(Browser* browser) override {
30 if (browser->window() == window_.get())
31 delete this;
34 scoped_ptr<TestBrowserWindow> window_;
36 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowOwner);
39 } // namespace
41 Browser* CreateBrowserWithTestWindowForParams(Browser::CreateParams* params) {
42 TestBrowserWindow* window = new TestBrowserWindow;
43 new TestBrowserWindowOwner(window);
44 params->window = window;
45 return new Browser(*params);
48 } // namespace chrome
51 // TestBrowserWindow::TestLocationBar -----------------------------------------
53 GURL TestBrowserWindow::TestLocationBar::GetDestinationURL() const {
54 return GURL();
57 WindowOpenDisposition
58 TestBrowserWindow::TestLocationBar::GetWindowOpenDisposition() const {
59 return CURRENT_TAB;
62 ui::PageTransition
63 TestBrowserWindow::TestLocationBar::GetPageTransition() const {
64 return ui::PAGE_TRANSITION_LINK;
67 bool TestBrowserWindow::TestLocationBar::ShowPageActionPopup(
68 const extensions::Extension* extension, bool grant_active_tab) {
69 return false;
72 const OmniboxView* TestBrowserWindow::TestLocationBar::GetOmniboxView() const {
73 return NULL;
76 OmniboxView* TestBrowserWindow::TestLocationBar::GetOmniboxView() {
77 return NULL;
80 LocationBarTesting*
81 TestBrowserWindow::TestLocationBar::GetLocationBarForTesting() {
82 return NULL;
86 // TestBrowserWindow ----------------------------------------------------------
88 TestBrowserWindow::TestBrowserWindow() {}
90 TestBrowserWindow::~TestBrowserWindow() {}
92 bool TestBrowserWindow::IsActive() const {
93 return false;
96 bool TestBrowserWindow::IsAlwaysOnTop() const {
97 return false;
100 gfx::NativeWindow TestBrowserWindow::GetNativeWindow() const {
101 return NULL;
104 StatusBubble* TestBrowserWindow::GetStatusBubble() {
105 return NULL;
108 gfx::Rect TestBrowserWindow::GetRestoredBounds() const {
109 return gfx::Rect();
112 ui::WindowShowState TestBrowserWindow::GetRestoredState() const {
113 return ui::SHOW_STATE_DEFAULT;
116 gfx::Rect TestBrowserWindow::GetBounds() const {
117 return gfx::Rect();
120 bool TestBrowserWindow::IsMaximized() const {
121 return false;
124 bool TestBrowserWindow::IsMinimized() const {
125 return false;
128 bool TestBrowserWindow::ShouldHideUIForFullscreen() const {
129 return false;
132 bool TestBrowserWindow::IsFullscreen() const {
133 return false;
136 bool TestBrowserWindow::IsFullscreenBubbleVisible() const {
137 return false;
140 bool TestBrowserWindow::SupportsFullscreenWithToolbar() const {
141 return false;
144 void TestBrowserWindow::UpdateFullscreenWithToolbar(bool with_toolbar) {
147 bool TestBrowserWindow::IsFullscreenWithToolbar() const {
148 return false;
151 #if defined(OS_WIN)
152 bool TestBrowserWindow::IsInMetroSnapMode() const {
153 return false;
155 #endif
157 LocationBar* TestBrowserWindow::GetLocationBar() const {
158 return const_cast<TestLocationBar*>(&location_bar_);
161 bool TestBrowserWindow::PreHandleKeyboardEvent(
162 const content::NativeWebKeyboardEvent& event,
163 bool* is_keyboard_shortcut) {
164 return false;
167 bool TestBrowserWindow::IsBookmarkBarVisible() const {
168 return false;
171 bool TestBrowserWindow::IsBookmarkBarAnimating() const {
172 return false;
175 bool TestBrowserWindow::IsTabStripEditable() const {
176 return false;
179 bool TestBrowserWindow::IsToolbarVisible() const {
180 return false;
183 gfx::Rect TestBrowserWindow::GetRootWindowResizerRect() const {
184 return gfx::Rect();
187 bool TestBrowserWindow::ShowSessionCrashedBubble() {
188 return false;
191 bool TestBrowserWindow::IsProfileResetBubbleSupported() const {
192 return false;
195 GlobalErrorBubbleViewBase* TestBrowserWindow::ShowProfileResetBubble(
196 const base::WeakPtr<ProfileResetGlobalError>& global_error) {
197 return nullptr;
200 bool TestBrowserWindow::IsDownloadShelfVisible() const {
201 return false;
204 DownloadShelf* TestBrowserWindow::GetDownloadShelf() {
205 return &download_shelf_;
208 int TestBrowserWindow::GetExtraRenderViewHeight() const {
209 return 0;
212 WindowOpenDisposition TestBrowserWindow::GetDispositionForPopupBounds(
213 const gfx::Rect& bounds) {
214 return NEW_POPUP;
217 FindBar* TestBrowserWindow::CreateFindBar() {
218 return NULL;
221 web_modal::WebContentsModalDialogHost*
222 TestBrowserWindow::GetWebContentsModalDialogHost() {
223 return NULL;
227 TestBrowserWindow::GetRenderViewHeightInsetWithDetachedBookmarkBar() {
228 return 0;
231 void TestBrowserWindow::ExecuteExtensionCommand(
232 const extensions::Extension* extension,
233 const extensions::Command& command) {}