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

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

Issue 63173016: DevTools: place DevTools WebContents underneath inspected WebContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years 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
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.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/ui/browser_commands.h" 8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 9 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
10 #include "chrome/browser/ui/views/frame/browser_view_layout.h" 10 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 // Test layout of the top-of-window UI. 61 // Test layout of the top-of-window UI.
62 TEST_F(BrowserViewTest, BrowserViewLayout) { 62 TEST_F(BrowserViewTest, BrowserViewLayout) {
63 BookmarkBarView::DisableAnimationsForTesting(true); 63 BookmarkBarView::DisableAnimationsForTesting(true);
64 64
65 // |browser_view_| owns the Browser, not the test class. 65 // |browser_view_| owns the Browser, not the test class.
66 Browser* browser = browser_view()->browser(); 66 Browser* browser = browser_view()->browser();
67 TopContainerView* top_container = browser_view()->top_container(); 67 TopContainerView* top_container = browser_view()->top_container();
68 TabStrip* tabstrip = browser_view()->tabstrip(); 68 TabStrip* tabstrip = browser_view()->tabstrip();
69 ToolbarView* toolbar = browser_view()->toolbar(); 69 ToolbarView* toolbar = browser_view()->toolbar();
70 views::SingleSplitView* contents_split = 70 views::View* contents_container =
71 browser_view()->GetContentsSplitForTest(); 71 browser_view()->GetContentsContainerForTest();
72 views::WebView* contents_web_view = 72 views::WebView* contents_web_view =
73 browser_view()->GetContentsWebViewForTest(); 73 browser_view()->GetContentsWebViewForTest();
74 views::WebView* devtools_web_view =
75 browser_view()->GetDevToolsWebViewForTest();
74 76
75 // Start with a single tab open to a normal page. 77 // Start with a single tab open to a normal page.
76 AddTab(browser, GURL("about:blank")); 78 AddTab(browser, GURL("about:blank"));
77 79
78 // Verify the view hierarchy. 80 // Verify the view hierarchy.
79 EXPECT_EQ(top_container, browser_view()->tabstrip()->parent()); 81 EXPECT_EQ(top_container, browser_view()->tabstrip()->parent());
80 EXPECT_EQ(top_container, browser_view()->toolbar()->parent()); 82 EXPECT_EQ(top_container, browser_view()->toolbar()->parent());
81 EXPECT_EQ(top_container, browser_view()->GetBookmarkBarView()->parent()); 83 EXPECT_EQ(top_container, browser_view()->GetBookmarkBarView()->parent());
82 EXPECT_EQ(browser_view(), browser_view()->infobar_container()->parent()); 84 EXPECT_EQ(browser_view(), browser_view()->infobar_container()->parent());
83 85
(...skipping 10 matching lines...) Expand all
94 EXPECT_EQ(browser_view()->width(), top_container->width()); 96 EXPECT_EQ(browser_view()->width(), top_container->width());
95 // Tabstrip layout varies based on window frame sizes. 97 // Tabstrip layout varies based on window frame sizes.
96 gfx::Point expected_tabstrip_origin = ExpectedTabStripOrigin(browser_view()); 98 gfx::Point expected_tabstrip_origin = ExpectedTabStripOrigin(browser_view());
97 EXPECT_EQ(expected_tabstrip_origin.x(), tabstrip->x()); 99 EXPECT_EQ(expected_tabstrip_origin.x(), tabstrip->x());
98 EXPECT_EQ(expected_tabstrip_origin.y(), tabstrip->y()); 100 EXPECT_EQ(expected_tabstrip_origin.y(), tabstrip->y());
99 EXPECT_EQ(0, toolbar->x()); 101 EXPECT_EQ(0, toolbar->x());
100 EXPECT_EQ( 102 EXPECT_EQ(
101 tabstrip->bounds().bottom() - 103 tabstrip->bounds().bottom() -
102 BrowserViewLayout::kToolbarTabStripVerticalOverlap, 104 BrowserViewLayout::kToolbarTabStripVerticalOverlap,
103 toolbar->y()); 105 toolbar->y());
104 EXPECT_EQ(0, contents_split->x()); 106 EXPECT_EQ(0, contents_container->x());
105 EXPECT_EQ(toolbar->bounds().bottom(), contents_split->y()); 107 EXPECT_EQ(toolbar->bounds().bottom(), contents_container->y());
108 EXPECT_EQ(0, devtools_web_view->x());
109 EXPECT_EQ(0, devtools_web_view->y());
106 EXPECT_EQ(0, contents_web_view->x()); 110 EXPECT_EQ(0, contents_web_view->x());
107 EXPECT_EQ(0, contents_web_view->y()); 111 EXPECT_EQ(0, contents_web_view->y());
108 112
109 // Verify bookmark bar visibility. 113 // Verify bookmark bar visibility.
110 BookmarkBarView* bookmark_bar = browser_view()->GetBookmarkBarView(); 114 BookmarkBarView* bookmark_bar = browser_view()->GetBookmarkBarView();
111 EXPECT_FALSE(bookmark_bar->visible()); 115 EXPECT_FALSE(bookmark_bar->visible());
112 EXPECT_FALSE(bookmark_bar->IsDetached()); 116 EXPECT_FALSE(bookmark_bar->IsDetached());
113 chrome::ExecuteCommand(browser, IDC_SHOW_BOOKMARK_BAR); 117 chrome::ExecuteCommand(browser, IDC_SHOW_BOOKMARK_BAR);
114 EXPECT_TRUE(bookmark_bar->visible()); 118 EXPECT_TRUE(bookmark_bar->visible());
115 EXPECT_FALSE(bookmark_bar->IsDetached()); 119 EXPECT_FALSE(bookmark_bar->IsDetached());
(...skipping 16 matching lines...) Expand all
132 browser_view()->GetIndexOf(top_container)); 136 browser_view()->GetIndexOf(top_container));
133 137
134 // Bookmark bar layout on NTP. 138 // Bookmark bar layout on NTP.
135 EXPECT_EQ(0, bookmark_bar->x()); 139 EXPECT_EQ(0, bookmark_bar->x());
136 EXPECT_EQ( 140 EXPECT_EQ(
137 tabstrip->bounds().bottom() + 141 tabstrip->bounds().bottom() +
138 toolbar->height() - 142 toolbar->height() -
139 BrowserViewLayout::kToolbarTabStripVerticalOverlap - 143 BrowserViewLayout::kToolbarTabStripVerticalOverlap -
140 views::NonClientFrameView::kClientEdgeThickness, 144 views::NonClientFrameView::kClientEdgeThickness,
141 bookmark_bar->y()); 145 bookmark_bar->y());
142 EXPECT_EQ(toolbar->bounds().bottom(), contents_split->y()); 146 EXPECT_EQ(toolbar->bounds().bottom(), contents_container->y());
143 // Contents view has a "top margin" pushing it below the bookmark bar. 147 // Contents view has a "top margin" pushing it below the bookmark bar.
144 EXPECT_EQ(bookmark_bar->height() - 148 EXPECT_EQ(bookmark_bar->height() -
145 views::NonClientFrameView::kClientEdgeThickness, 149 views::NonClientFrameView::kClientEdgeThickness,
150 devtools_web_view->y());
151 EXPECT_EQ(bookmark_bar->height() -
152 views::NonClientFrameView::kClientEdgeThickness,
146 contents_web_view->y()); 153 contents_web_view->y());
147 154
148 // Bookmark bar is parented back to top container on normal page. 155 // Bookmark bar is parented back to top container on normal page.
149 NavigateAndCommitActiveTabWithTitle(browser, 156 NavigateAndCommitActiveTabWithTitle(browser,
150 GURL("about:blank"), 157 GURL("about:blank"),
151 base::string16()); 158 base::string16());
152 EXPECT_FALSE(bookmark_bar->visible()); 159 EXPECT_FALSE(bookmark_bar->visible());
153 EXPECT_FALSE(bookmark_bar->IsDetached()); 160 EXPECT_FALSE(bookmark_bar->IsDetached());
154 EXPECT_EQ(top_container, bookmark_bar->parent()); 161 EXPECT_EQ(top_container, bookmark_bar->parent());
155 // Top container is still second from front. 162 // Top container is still second from front.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // Test initial state. 247 // Test initial state.
241 EXPECT_TRUE(browser_view()->IsTabStripVisible()); 248 EXPECT_TRUE(browser_view()->IsTabStripVisible());
242 // Validate whether the window switcher button is the target for the position 249 // Validate whether the window switcher button is the target for the position
243 // passed in. 250 // passed in.
244 gfx::Point switcher_point(browser_view()->window_switcher_button()->x() + 2, 251 gfx::Point switcher_point(browser_view()->window_switcher_button()->x() + 2,
245 browser_view()->window_switcher_button()->y()); 252 browser_view()->window_switcher_button()->y());
246 EXPECT_EQ(browser_view()->GetEventHandlerForPoint(switcher_point), 253 EXPECT_EQ(browser_view()->GetEventHandlerForPoint(switcher_point),
247 browser_view()->window_switcher_button()); 254 browser_view()->window_switcher_button());
248 } 255 }
249 #endif 256 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout_unittest.cc ('k') | chrome/browser/ui/views/frame/contents_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698