Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view_layout_unittest.cc

Issue 99153012: Exclude dev tools bounds from views dialog hosting bounds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Hook up the unit test contents webview. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/ui/views/frame/browser_view.h" 7 #include "chrome/browser/ui/views/frame/browser_view.h"
8 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" 8 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h"
9 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" 9 #include "chrome/browser/ui/views/frame/contents_layout_manager.h"
10 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 10 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
11 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" 11 #include "chrome/browser/ui/views/infobars/infobar_container_view.h"
12 #include "chrome/browser/ui/views/tabs/tab_strip.h" 12 #include "chrome/browser/ui/views/tabs/tab_strip.h"
13 #include "chrome/test/base/browser_with_test_window_test.h" 13 #include "chrome/test/base/browser_with_test_window_test.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 class MockBrowserViewLayoutDelegate : public BrowserViewLayoutDelegate { 16 class MockBrowserViewLayoutDelegate : public BrowserViewLayoutDelegate {
17 public: 17 public:
18 MockBrowserViewLayoutDelegate() 18 explicit MockBrowserViewLayoutDelegate(views::View* contents_web_view)
19 : tab_strip_visible_(true), 19 : contents_web_view_(contents_web_view),
20 tab_strip_visible_(true),
20 toolbar_visible_(true), 21 toolbar_visible_(true),
21 bookmark_bar_visible_(true), 22 bookmark_bar_visible_(true),
22 download_shelf_needs_layout_(false) { 23 download_shelf_needs_layout_(false) {
23 } 24 }
24 virtual ~MockBrowserViewLayoutDelegate() {} 25 virtual ~MockBrowserViewLayoutDelegate() {}
25 26
26 void set_download_shelf_needs_layout(bool layout) { 27 void set_download_shelf_needs_layout(bool layout) {
27 download_shelf_needs_layout_ = layout; 28 download_shelf_needs_layout_ = layout;
28 } 29 }
29 void set_tab_strip_visible(bool visible) { 30 void set_tab_strip_visible(bool visible) {
30 tab_strip_visible_ = visible; 31 tab_strip_visible_ = visible;
31 } 32 }
32 void set_toolbar_visible(bool visible) { 33 void set_toolbar_visible(bool visible) {
33 toolbar_visible_ = visible; 34 toolbar_visible_ = visible;
34 } 35 }
35 void set_bookmark_bar_visible(bool visible) { 36 void set_bookmark_bar_visible(bool visible) {
36 bookmark_bar_visible_ = visible; 37 bookmark_bar_visible_ = visible;
37 } 38 }
38 39
39 // BrowserViewLayout::Delegate overrides: 40 // BrowserViewLayout::Delegate overrides:
41 virtual views::View* GetContentsWebView() const OVERRIDE {
42 return contents_web_view_;
43 }
40 virtual views::View* GetWindowSwitcherButton() const OVERRIDE { 44 virtual views::View* GetWindowSwitcherButton() const OVERRIDE {
41 // TODO(jamescook): Add a test for Windows that exercises the layout for 45 // TODO(jamescook): Add a test for Windows that exercises the layout for
42 // this button. 46 // this button.
43 return NULL; 47 return NULL;
44 } 48 }
45 virtual bool IsTabStripVisible() const OVERRIDE { 49 virtual bool IsTabStripVisible() const OVERRIDE {
46 return tab_strip_visible_; 50 return tab_strip_visible_;
47 } 51 }
48 virtual gfx::Rect GetBoundsForTabStripInBrowserView() const OVERRIDE { 52 virtual gfx::Rect GetBoundsForTabStripInBrowserView() const OVERRIDE {
49 return gfx::Rect(); 53 return gfx::Rect();
(...skipping 12 matching lines...) Expand all
62 } 66 }
63 virtual bool DownloadShelfNeedsLayout() const OVERRIDE { 67 virtual bool DownloadShelfNeedsLayout() const OVERRIDE {
64 return download_shelf_needs_layout_; 68 return download_shelf_needs_layout_;
65 } 69 }
66 70
67 virtual FullscreenExitBubbleViews* GetFullscreenExitBubble() const OVERRIDE { 71 virtual FullscreenExitBubbleViews* GetFullscreenExitBubble() const OVERRIDE {
68 return NULL; 72 return NULL;
69 } 73 }
70 74
71 private: 75 private:
76 views::View* contents_web_view_;
72 bool tab_strip_visible_; 77 bool tab_strip_visible_;
73 bool toolbar_visible_; 78 bool toolbar_visible_;
74 bool bookmark_bar_visible_; 79 bool bookmark_bar_visible_;
75 bool download_shelf_needs_layout_; 80 bool download_shelf_needs_layout_;
76 81
77 DISALLOW_COPY_AND_ASSIGN(MockBrowserViewLayoutDelegate); 82 DISALLOW_COPY_AND_ASSIGN(MockBrowserViewLayoutDelegate);
78 }; 83 };
79 84
80 /////////////////////////////////////////////////////////////////////////////// 85 ///////////////////////////////////////////////////////////////////////////////
81 86
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 contents_container_->AddChildView(devtools_web_view_); 180 contents_container_->AddChildView(devtools_web_view_);
176 contents_container_->AddChildView(contents_web_view_); 181 contents_container_->AddChildView(contents_web_view_);
177 ContentsLayoutManager* contents_layout_manager = 182 ContentsLayoutManager* contents_layout_manager =
178 new ContentsLayoutManager(devtools_web_view_, contents_web_view_); 183 new ContentsLayoutManager(devtools_web_view_, contents_web_view_);
179 contents_container_->SetLayoutManager(contents_layout_manager); 184 contents_container_->SetLayoutManager(contents_layout_manager);
180 185
181 root_view_->AddChildView(contents_container_); 186 root_view_->AddChildView(contents_container_);
182 187
183 // TODO(jamescook): Attach |layout_| to |root_view_|? 188 // TODO(jamescook): Attach |layout_| to |root_view_|?
184 layout_.reset(new BrowserViewLayout); 189 layout_.reset(new BrowserViewLayout);
185 delegate_ = new MockBrowserViewLayoutDelegate; 190 delegate_ = new MockBrowserViewLayoutDelegate(contents_web_view_);
186 layout_->Init(delegate_, 191 layout_->Init(delegate_,
187 browser(), 192 browser(),
188 NULL, // BrowserView. 193 NULL, // BrowserView.
189 top_container_, 194 top_container_,
190 tab_strip_, 195 tab_strip_,
191 toolbar_, 196 toolbar_,
192 infobar_container_, 197 infobar_container_,
193 contents_container_, 198 contents_container_,
194 contents_layout_manager, 199 contents_layout_manager,
195 immersive_mode_controller_.get()); 200 immersive_mode_controller_.get());
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 const int kBottom = 500; 263 const int kBottom = 500;
259 EXPECT_EQ(kBottom, layout()->LayoutDownloadShelf(kBottom)); 264 EXPECT_EQ(kBottom, layout()->LayoutDownloadShelf(kBottom));
260 265
261 // Download shelf layout moves up the bottom edge and sets visibility. 266 // Download shelf layout moves up the bottom edge and sets visibility.
262 delegate()->set_download_shelf_needs_layout(true); 267 delegate()->set_download_shelf_needs_layout(true);
263 download_shelf->SetVisible(false); 268 download_shelf->SetVisible(false);
264 EXPECT_EQ(450, layout()->LayoutDownloadShelf(kBottom)); 269 EXPECT_EQ(450, layout()->LayoutDownloadShelf(kBottom));
265 EXPECT_TRUE(download_shelf->visible()); 270 EXPECT_TRUE(download_shelf->visible());
266 EXPECT_EQ("0,450 0x50", download_shelf->bounds().ToString()); 271 EXPECT_EQ("0,450 0x50", download_shelf->bounds().ToString());
267 } 272 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698