OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/frame/browser_view_layout.h" | 5 #include "chrome/browser/ui/views/frame/browser_view_layout.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "chrome/browser/ui/views/frame/browser_view.h" | 8 #include "chrome/browser/ui/views/frame/browser_view.h" |
9 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" | 9 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" |
10 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" | 10 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 top_container_, | 182 top_container_, |
183 tab_strip_, | 183 tab_strip_, |
184 toolbar_, | 184 toolbar_, |
185 infobar_container_, | 185 infobar_container_, |
186 contents_container_, | 186 contents_container_, |
187 contents_layout_manager, | 187 contents_layout_manager, |
188 immersive_mode_controller_.get()); | 188 immersive_mode_controller_.get()); |
189 } | 189 } |
190 | 190 |
191 private: | 191 private: |
192 scoped_ptr<BrowserViewLayout> layout_; | 192 std::unique_ptr<BrowserViewLayout> layout_; |
193 MockBrowserViewLayoutDelegate* delegate_; // Owned by |layout_|. | 193 MockBrowserViewLayoutDelegate* delegate_; // Owned by |layout_|. |
194 scoped_ptr<MockView> root_view_; | 194 std::unique_ptr<MockView> root_view_; |
195 | 195 |
196 // Views owned by |root_view_|. | 196 // Views owned by |root_view_|. |
197 MockView* top_container_; | 197 MockView* top_container_; |
198 TabStrip* tab_strip_; | 198 TabStrip* tab_strip_; |
199 MockView* toolbar_; | 199 MockView* toolbar_; |
200 InfoBarContainerView* infobar_container_; | 200 InfoBarContainerView* infobar_container_; |
201 MockView* contents_container_; | 201 MockView* contents_container_; |
202 MockView* contents_web_view_; | 202 MockView* contents_web_view_; |
203 MockView* devtools_web_view_; | 203 MockView* devtools_web_view_; |
204 | 204 |
205 scoped_ptr<MockImmersiveModeController> immersive_mode_controller_; | 205 std::unique_ptr<MockImmersiveModeController> immersive_mode_controller_; |
206 | 206 |
207 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayoutTest); | 207 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayoutTest); |
208 }; | 208 }; |
209 | 209 |
210 // Test basic construction and initialization. | 210 // Test basic construction and initialization. |
211 TEST_F(BrowserViewLayoutTest, BrowserViewLayout) { | 211 TEST_F(BrowserViewLayoutTest, BrowserViewLayout) { |
212 EXPECT_TRUE(layout()->browser()); | 212 EXPECT_TRUE(layout()->browser()); |
213 EXPECT_TRUE(layout()->GetWebContentsModalDialogHost()); | 213 EXPECT_TRUE(layout()->GetWebContentsModalDialogHost()); |
214 EXPECT_FALSE(layout()->InfobarVisible()); | 214 EXPECT_FALSE(layout()->InfobarVisible()); |
215 } | 215 } |
(...skipping 20 matching lines...) Expand all Loading... |
236 // Now the toolbar has bounds and other views shift down. | 236 // Now the toolbar has bounds and other views shift down. |
237 EXPECT_EQ("0,0 0x0", tab_strip()->bounds().ToString()); | 237 EXPECT_EQ("0,0 0x0", tab_strip()->bounds().ToString()); |
238 EXPECT_EQ("0,0 800x30", toolbar()->bounds().ToString()); | 238 EXPECT_EQ("0,0 800x30", toolbar()->bounds().ToString()); |
239 EXPECT_EQ("0,30 800x0", infobar_container()->bounds().ToString()); | 239 EXPECT_EQ("0,30 800x0", infobar_container()->bounds().ToString()); |
240 EXPECT_EQ("0,30 800x570", contents_container()->bounds().ToString()); | 240 EXPECT_EQ("0,30 800x570", contents_container()->bounds().ToString()); |
241 | 241 |
242 // TODO(jamescook): Tab strip and bookmark bar. | 242 // TODO(jamescook): Tab strip and bookmark bar. |
243 } | 243 } |
244 | 244 |
245 TEST_F(BrowserViewLayoutTest, LayoutDownloadShelf) { | 245 TEST_F(BrowserViewLayoutTest, LayoutDownloadShelf) { |
246 scoped_ptr<MockView> download_shelf(new MockView(gfx::Size(800, 50))); | 246 std::unique_ptr<MockView> download_shelf(new MockView(gfx::Size(800, 50))); |
247 layout()->set_download_shelf(download_shelf.get()); | 247 layout()->set_download_shelf(download_shelf.get()); |
248 | 248 |
249 // If download shelf doesn't need layout, it doesn't move the bottom edge. | 249 // If download shelf doesn't need layout, it doesn't move the bottom edge. |
250 delegate()->set_download_shelf_needs_layout(false); | 250 delegate()->set_download_shelf_needs_layout(false); |
251 const int kBottom = 500; | 251 const int kBottom = 500; |
252 EXPECT_EQ(kBottom, layout()->LayoutDownloadShelf(kBottom)); | 252 EXPECT_EQ(kBottom, layout()->LayoutDownloadShelf(kBottom)); |
253 | 253 |
254 // Download shelf layout moves up the bottom edge and sets visibility. | 254 // Download shelf layout moves up the bottom edge and sets visibility. |
255 delegate()->set_download_shelf_needs_layout(true); | 255 delegate()->set_download_shelf_needs_layout(true); |
256 download_shelf->SetVisible(false); | 256 download_shelf->SetVisible(false); |
257 EXPECT_EQ(450, layout()->LayoutDownloadShelf(kBottom)); | 257 EXPECT_EQ(450, layout()->LayoutDownloadShelf(kBottom)); |
258 EXPECT_TRUE(download_shelf->visible()); | 258 EXPECT_TRUE(download_shelf->visible()); |
259 EXPECT_EQ("0,450 0x50", download_shelf->bounds().ToString()); | 259 EXPECT_EQ("0,450 0x50", download_shelf->bounds().ToString()); |
260 } | 260 } |
OLD | NEW |