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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_unittest.cc

Issue 1827083004: UI: Rename MediaState to AlertState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-tab-indicator
Patch Set: Keep gypi ordered Created 4 years, 8 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
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_renderer_data.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/tabs/tab.h" 5 #include "chrome/browser/ui/views/tabs/tab.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/ui/layout_constants.h" 11 #include "chrome/browser/ui/layout_constants.h"
12 #include "chrome/browser/ui/tabs/tab_utils.h" 12 #include "chrome/browser/ui/tabs/tab_utils.h"
13 #include "chrome/browser/ui/views/tabs/media_indicator_button.h" 13 #include "chrome/browser/ui/views/tabs/alert_indicator_button.h"
14 #include "chrome/browser/ui/views/tabs/tab_controller.h" 14 #include "chrome/browser/ui/views/tabs/tab_controller.h"
15 #include "grit/theme_resources.h" 15 #include "grit/theme_resources.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/base/models/list_selection_model.h" 17 #include "ui/base/models/list_selection_model.h"
18 #include "ui/views/controls/button/image_button.h" 18 #include "ui/views/controls/button/image_button.h"
19 #include "ui/views/controls/label.h" 19 #include "ui/views/controls/label.h"
20 #include "ui/views/test/views_test_base.h" 20 #include "ui/views/test/views_test_base.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 using views::Widget; 23 using views::Widget;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return tab.title_->bounds().width(); 109 return tab.title_->bounds().width();
110 } 110 }
111 111
112 static void LayoutTab(Tab* tab) { tab->Layout(); } 112 static void LayoutTab(Tab* tab) { tab->Layout(); }
113 113
114 static void CheckForExpectedLayoutAndVisibilityOfElements(const Tab& tab) { 114 static void CheckForExpectedLayoutAndVisibilityOfElements(const Tab& tab) {
115 // Check whether elements are visible when they are supposed to be, given 115 // Check whether elements are visible when they are supposed to be, given
116 // Tab size and TabRendererData state. 116 // Tab size and TabRendererData state.
117 if (tab.data_.pinned) { 117 if (tab.data_.pinned) {
118 EXPECT_EQ(1, tab.IconCapacity()); 118 EXPECT_EQ(1, tab.IconCapacity());
119 if (tab.data_.media_state != TAB_MEDIA_STATE_NONE) { 119 if (tab.data_.alert_state != TabAlertState::NONE) {
120 EXPECT_FALSE(tab.ShouldShowIcon()); 120 EXPECT_FALSE(tab.ShouldShowIcon());
121 EXPECT_TRUE(tab.ShouldShowMediaIndicator()); 121 EXPECT_TRUE(tab.ShouldShowAlertIndicator());
122 } else { 122 } else {
123 EXPECT_TRUE(tab.ShouldShowIcon()); 123 EXPECT_TRUE(tab.ShouldShowIcon());
124 EXPECT_FALSE(tab.ShouldShowMediaIndicator()); 124 EXPECT_FALSE(tab.ShouldShowAlertIndicator());
125 } 125 }
126 EXPECT_FALSE(tab.ShouldShowCloseBox()); 126 EXPECT_FALSE(tab.ShouldShowCloseBox());
127 } else if (tab.IsActive()) { 127 } else if (tab.IsActive()) {
128 EXPECT_TRUE(tab.ShouldShowCloseBox()); 128 EXPECT_TRUE(tab.ShouldShowCloseBox());
129 switch (tab.IconCapacity()) { 129 switch (tab.IconCapacity()) {
130 case 0: 130 case 0:
131 case 1: 131 case 1:
132 EXPECT_FALSE(tab.ShouldShowIcon()); 132 EXPECT_FALSE(tab.ShouldShowIcon());
133 EXPECT_FALSE(tab.ShouldShowMediaIndicator()); 133 EXPECT_FALSE(tab.ShouldShowAlertIndicator());
134 break; 134 break;
135 case 2: 135 case 2:
136 if (tab.data_.media_state != TAB_MEDIA_STATE_NONE) { 136 if (tab.data_.alert_state != TabAlertState::NONE) {
137 EXPECT_FALSE(tab.ShouldShowIcon()); 137 EXPECT_FALSE(tab.ShouldShowIcon());
138 EXPECT_TRUE(tab.ShouldShowMediaIndicator()); 138 EXPECT_TRUE(tab.ShouldShowAlertIndicator());
139 } else { 139 } else {
140 EXPECT_TRUE(tab.ShouldShowIcon()); 140 EXPECT_TRUE(tab.ShouldShowIcon());
141 EXPECT_FALSE(tab.ShouldShowMediaIndicator()); 141 EXPECT_FALSE(tab.ShouldShowAlertIndicator());
142 } 142 }
143 break; 143 break;
144 default: 144 default:
145 EXPECT_LE(3, tab.IconCapacity()); 145 EXPECT_LE(3, tab.IconCapacity());
146 EXPECT_TRUE(tab.ShouldShowIcon()); 146 EXPECT_TRUE(tab.ShouldShowIcon());
147 if (tab.data_.media_state != TAB_MEDIA_STATE_NONE) 147 if (tab.data_.alert_state != TabAlertState::NONE)
148 EXPECT_TRUE(tab.ShouldShowMediaIndicator()); 148 EXPECT_TRUE(tab.ShouldShowAlertIndicator());
149 else 149 else
150 EXPECT_FALSE(tab.ShouldShowMediaIndicator()); 150 EXPECT_FALSE(tab.ShouldShowAlertIndicator());
151 break; 151 break;
152 } 152 }
153 } else { // Tab not active and not pinned tab. 153 } else { // Tab not active and not pinned tab.
154 switch (tab.IconCapacity()) { 154 switch (tab.IconCapacity()) {
155 case 0: 155 case 0:
156 EXPECT_FALSE(tab.ShouldShowCloseBox()); 156 EXPECT_FALSE(tab.ShouldShowCloseBox());
157 EXPECT_FALSE(tab.ShouldShowIcon()); 157 EXPECT_FALSE(tab.ShouldShowIcon());
158 EXPECT_FALSE(tab.ShouldShowMediaIndicator()); 158 EXPECT_FALSE(tab.ShouldShowAlertIndicator());
159 break; 159 break;
160 case 1: 160 case 1:
161 EXPECT_FALSE(tab.ShouldShowCloseBox()); 161 EXPECT_FALSE(tab.ShouldShowCloseBox());
162 if (tab.data_.media_state != TAB_MEDIA_STATE_NONE) { 162 if (tab.data_.alert_state != TabAlertState::NONE) {
163 EXPECT_FALSE(tab.ShouldShowIcon()); 163 EXPECT_FALSE(tab.ShouldShowIcon());
164 EXPECT_TRUE(tab.ShouldShowMediaIndicator()); 164 EXPECT_TRUE(tab.ShouldShowAlertIndicator());
165 } else { 165 } else {
166 EXPECT_TRUE(tab.ShouldShowIcon()); 166 EXPECT_TRUE(tab.ShouldShowIcon());
167 EXPECT_FALSE(tab.ShouldShowMediaIndicator()); 167 EXPECT_FALSE(tab.ShouldShowAlertIndicator());
168 } 168 }
169 break; 169 break;
170 default: 170 default:
171 EXPECT_LE(2, tab.IconCapacity()); 171 EXPECT_LE(2, tab.IconCapacity());
172 EXPECT_TRUE(tab.ShouldShowIcon()); 172 EXPECT_TRUE(tab.ShouldShowIcon());
173 if (tab.data_.media_state != TAB_MEDIA_STATE_NONE) 173 if (tab.data_.alert_state != TabAlertState::NONE)
174 EXPECT_TRUE(tab.ShouldShowMediaIndicator()); 174 EXPECT_TRUE(tab.ShouldShowAlertIndicator());
175 else 175 else
176 EXPECT_FALSE(tab.ShouldShowMediaIndicator()); 176 EXPECT_FALSE(tab.ShouldShowAlertIndicator());
177 break; 177 break;
178 } 178 }
179 } 179 }
180 180
181 // Check positioning of elements with respect to each other, and that they 181 // Check positioning of elements with respect to each other, and that they
182 // are fully within the contents bounds. 182 // are fully within the contents bounds.
183 const gfx::Rect contents_bounds = tab.GetContentsBounds(); 183 const gfx::Rect contents_bounds = tab.GetContentsBounds();
184 if (tab.ShouldShowIcon()) { 184 if (tab.ShouldShowIcon()) {
185 EXPECT_LE(contents_bounds.x(), tab.favicon_bounds_.x()); 185 EXPECT_LE(contents_bounds.x(), tab.favicon_bounds_.x());
186 if (tab.title_->width() > 0) 186 if (tab.title_->width() > 0)
187 EXPECT_LE(tab.favicon_bounds_.right(), tab.title_->x()); 187 EXPECT_LE(tab.favicon_bounds_.right(), tab.title_->x());
188 EXPECT_LE(contents_bounds.y(), tab.favicon_bounds_.y()); 188 EXPECT_LE(contents_bounds.y(), tab.favicon_bounds_.y());
189 EXPECT_LE(tab.favicon_bounds_.bottom(), contents_bounds.bottom()); 189 EXPECT_LE(tab.favicon_bounds_.bottom(), contents_bounds.bottom());
190 } 190 }
191 if (tab.ShouldShowIcon() && tab.ShouldShowMediaIndicator()) 191 if (tab.ShouldShowIcon() && tab.ShouldShowAlertIndicator())
192 EXPECT_LE(tab.favicon_bounds_.right(), GetMediaIndicatorBounds(tab).x()); 192 EXPECT_LE(tab.favicon_bounds_.right(), GetAlertIndicatorBounds(tab).x());
193 if (tab.ShouldShowMediaIndicator()) { 193 if (tab.ShouldShowAlertIndicator()) {
194 if (tab.title_->width() > 0) { 194 if (tab.title_->width() > 0) {
195 EXPECT_LE(tab.title_->bounds().right(), 195 EXPECT_LE(tab.title_->bounds().right(),
196 GetMediaIndicatorBounds(tab).x()); 196 GetAlertIndicatorBounds(tab).x());
197 } 197 }
198 EXPECT_LE(GetMediaIndicatorBounds(tab).right(), contents_bounds.right()); 198 EXPECT_LE(GetAlertIndicatorBounds(tab).right(), contents_bounds.right());
199 EXPECT_LE(contents_bounds.y(), GetMediaIndicatorBounds(tab).y()); 199 EXPECT_LE(contents_bounds.y(), GetAlertIndicatorBounds(tab).y());
200 EXPECT_LE(GetMediaIndicatorBounds(tab).bottom(), 200 EXPECT_LE(GetAlertIndicatorBounds(tab).bottom(),
201 contents_bounds.bottom()); 201 contents_bounds.bottom());
202 } 202 }
203 if (tab.ShouldShowMediaIndicator() && tab.ShouldShowCloseBox()) { 203 if (tab.ShouldShowAlertIndicator() && tab.ShouldShowCloseBox()) {
204 // Note: The media indicator can overlap the left-insets of the close box, 204 // Note: The alert indicator can overlap the left-insets of the close box,
205 // but should otherwise be to the left of the close button. 205 // but should otherwise be to the left of the close button.
206 EXPECT_LE(GetMediaIndicatorBounds(tab).right(), 206 EXPECT_LE(GetAlertIndicatorBounds(tab).right(),
207 tab.close_button_->bounds().x() + 207 tab.close_button_->bounds().x() +
208 tab.close_button_->GetInsets().left()); 208 tab.close_button_->GetInsets().left());
209 } 209 }
210 if (tab.ShouldShowCloseBox()) { 210 if (tab.ShouldShowCloseBox()) {
211 // Note: The title bounds can overlap the left-insets of the close box, 211 // Note: The title bounds can overlap the left-insets of the close box,
212 // but should otherwise be to the left of the close button. 212 // but should otherwise be to the left of the close button.
213 if (tab.title_->width() > 0) { 213 if (tab.title_->width() > 0) {
214 EXPECT_LE(tab.title_->bounds().right(), 214 EXPECT_LE(tab.title_->bounds().right(),
215 tab.close_button_->bounds().x() + 215 tab.close_button_->bounds().x() +
216 tab.close_button_->GetInsets().left()); 216 tab.close_button_->GetInsets().left());
(...skipping 12 matching lines...) Expand all
229 229
230 protected: 230 protected:
231 void InitWidget(Widget* widget) { 231 void InitWidget(Widget* widget) {
232 Widget::InitParams params(CreateParams(Widget::InitParams::TYPE_WINDOW)); 232 Widget::InitParams params(CreateParams(Widget::InitParams::TYPE_WINDOW));
233 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 233 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
234 params.bounds.SetRect(10, 20, 300, 400); 234 params.bounds.SetRect(10, 20, 300, 400);
235 widget->Init(params); 235 widget->Init(params);
236 } 236 }
237 237
238 private: 238 private:
239 static gfx::Rect GetMediaIndicatorBounds(const Tab& tab) { 239 static gfx::Rect GetAlertIndicatorBounds(const Tab& tab) {
240 if (!tab.media_indicator_button_) { 240 if (!tab.alert_indicator_button_) {
241 ADD_FAILURE(); 241 ADD_FAILURE();
242 return gfx::Rect(); 242 return gfx::Rect();
243 } 243 }
244 return tab.media_indicator_button_->bounds(); 244 return tab.alert_indicator_button_->bounds();
245 } 245 }
246 246
247 std::string original_locale_; 247 std::string original_locale_;
248 }; 248 };
249 249
250 TEST_F(TabTest, HitTestTopPixel) { 250 TEST_F(TabTest, HitTestTopPixel) {
251 Widget widget; 251 Widget widget;
252 InitWidget(&widget); 252 InitWidget(&widget);
253 253
254 FakeTabController tab_controller; 254 FakeTabController tab_controller;
(...skipping 16 matching lines...) Expand all
271 // select the tab. 271 // select the tab.
272 widget.Maximize(); 272 widget.Maximize();
273 EXPECT_TRUE(tab.HitTestPoint(gfx::Point(middle_x, 0))); 273 EXPECT_TRUE(tab.HitTestPoint(gfx::Point(middle_x, 0)));
274 274
275 // But clicks in the area above the slanted sides should still miss. 275 // But clicks in the area above the slanted sides should still miss.
276 EXPECT_FALSE(tab.HitTestPoint(gfx::Point(0, 0))); 276 EXPECT_FALSE(tab.HitTestPoint(gfx::Point(0, 0)));
277 EXPECT_FALSE(tab.HitTestPoint(gfx::Point(tab.width() - 1, 0))); 277 EXPECT_FALSE(tab.HitTestPoint(gfx::Point(tab.width() - 1, 0)));
278 } 278 }
279 279
280 TEST_F(TabTest, LayoutAndVisibilityOfElements) { 280 TEST_F(TabTest, LayoutAndVisibilityOfElements) {
281 static const TabMediaState kMediaStatesToTest[] = { 281 static const TabAlertState kAlertStatesToTest[] = {
282 TAB_MEDIA_STATE_NONE, TAB_MEDIA_STATE_CAPTURING, 282 TabAlertState::NONE, TabAlertState::TAB_CAPTURING,
283 TAB_MEDIA_STATE_AUDIO_PLAYING, TAB_MEDIA_STATE_AUDIO_MUTING 283 TabAlertState::AUDIO_PLAYING, TabAlertState::AUDIO_MUTING};
284 };
285 284
286 Widget widget; 285 Widget widget;
287 InitWidget(&widget); 286 InitWidget(&widget);
288 287
289 FakeTabController controller; 288 FakeTabController controller;
290 Tab tab(&controller, nullptr); 289 Tab tab(&controller, nullptr);
291 widget.GetContentsView()->AddChildView(&tab); 290 widget.GetContentsView()->AddChildView(&tab);
292 291
293 SkBitmap bitmap; 292 SkBitmap bitmap;
294 bitmap.allocN32Pixels(16, 16); 293 bitmap.allocN32Pixels(16, 16);
295 TabRendererData data; 294 TabRendererData data;
296 data.favicon = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); 295 data.favicon = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
297 296
298 // Perform layout over all possible combinations, checking for correct 297 // Perform layout over all possible combinations, checking for correct
299 // results. 298 // results.
300 for (int is_pinned_tab = 0; is_pinned_tab < 2; ++is_pinned_tab) { 299 for (int is_pinned_tab = 0; is_pinned_tab < 2; ++is_pinned_tab) {
301 for (int is_active_tab = 0; is_active_tab < 2; ++is_active_tab) { 300 for (int is_active_tab = 0; is_active_tab < 2; ++is_active_tab) {
302 for (size_t media_state_index = 0; 301 for (size_t alert_state_index = 0;
303 media_state_index < arraysize(kMediaStatesToTest); 302 alert_state_index < arraysize(kAlertStatesToTest);
304 ++media_state_index) { 303 ++alert_state_index) {
305 const TabMediaState media_state = kMediaStatesToTest[media_state_index]; 304 const TabAlertState alert_state = kAlertStatesToTest[alert_state_index];
306 SCOPED_TRACE(::testing::Message() 305 SCOPED_TRACE(::testing::Message()
307 << (is_active_tab ? "Active" : "Inactive") << ' ' 306 << (is_active_tab ? "Active" : "Inactive") << ' '
308 << (is_pinned_tab ? "Pinned " : "") 307 << (is_pinned_tab ? "Pinned " : "")
309 << "Tab with media indicator state " << media_state); 308 << "Tab with alert indicator state "
309 << static_cast<uint8_t>(alert_state));
310 310
311 data.pinned = !!is_pinned_tab; 311 data.pinned = !!is_pinned_tab;
312 controller.set_active_tab(!!is_active_tab); 312 controller.set_active_tab(!!is_active_tab);
313 data.media_state = media_state; 313 data.alert_state = alert_state;
314 tab.SetData(data); 314 tab.SetData(data);
315 315
316 // Test layout for every width from standard to minimum. 316 // Test layout for every width from standard to minimum.
317 gfx::Rect bounds(gfx::Point(0, 0), Tab::GetStandardSize()); 317 gfx::Rect bounds(gfx::Point(0, 0), Tab::GetStandardSize());
318 int min_width; 318 int min_width;
319 if (is_pinned_tab) { 319 if (is_pinned_tab) {
320 bounds.set_width(Tab::GetPinnedWidth()); 320 bounds.set_width(Tab::GetPinnedWidth());
321 min_width = Tab::GetPinnedWidth(); 321 min_width = Tab::GetPinnedWidth();
322 } else { 322 } else {
323 min_width = is_active_tab ? Tab::GetMinimumActiveSize().width() 323 min_width = is_active_tab ? Tab::GetMinimumActiveSize().width()
(...skipping 26 matching lines...) Expand all
350 bitmap.allocN32Pixels(16, 16); 350 bitmap.allocN32Pixels(16, 16);
351 TabRendererData data; 351 TabRendererData data;
352 data.favicon = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); 352 data.favicon = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
353 353
354 data.title = base::UTF8ToUTF16( 354 data.title = base::UTF8ToUTF16(
355 "This is a really long tab title that would case views::Label to provide " 355 "This is a really long tab title that would case views::Label to provide "
356 "its own tooltip; but Tab should disable that feature so it can provide " 356 "its own tooltip; but Tab should disable that feature so it can provide "
357 "the tooltip instead."); 357 "the tooltip instead.");
358 358
359 // Test both with and without an indicator showing since the tab tooltip text 359 // Test both with and without an indicator showing since the tab tooltip text
360 // should include a description of the media state when the indicator is 360 // should include a description of the alert state when the indicator is
361 // present. 361 // present.
362 for (int i = 0; i < 2; ++i) { 362 for (int i = 0; i < 2; ++i) {
363 data.media_state = 363 data.alert_state =
364 (i == 0 ? TAB_MEDIA_STATE_NONE : TAB_MEDIA_STATE_AUDIO_PLAYING); 364 (i == 0 ? TabAlertState::NONE : TabAlertState::AUDIO_PLAYING);
365 SCOPED_TRACE(::testing::Message() 365 SCOPED_TRACE(::testing::Message()
366 << "Tab with media indicator state " << data.media_state); 366 << "Tab with alert indicator state "
367 << static_cast<uint8_t>(data.alert_state));
367 tab.SetData(data); 368 tab.SetData(data);
368 369
369 for (int j = 0; j < tab.child_count(); ++j) { 370 for (int j = 0; j < tab.child_count(); ++j) {
370 views::View& child = *tab.child_at(j); 371 views::View& child = *tab.child_at(j);
371 if (!strcmp(child.GetClassName(), "TabCloseButton")) 372 if (!strcmp(child.GetClassName(), "TabCloseButton"))
372 continue; // Close button is excepted. 373 continue; // Close button is excepted.
373 if (!child.visible()) 374 if (!child.visible())
374 continue; 375 continue;
375 SCOPED_TRACE(::testing::Message() << "child_at(" << j << "): " 376 SCOPED_TRACE(::testing::Message() << "child_at(" << j << "): "
376 << child.GetClassName()); 377 << child.GetClassName());
377 378
378 const gfx::Point midpoint(child.width() / 2, child.height() / 2); 379 const gfx::Point midpoint(child.width() / 2, child.height() / 2);
379 EXPECT_FALSE(child.GetTooltipHandlerForPoint(midpoint)); 380 EXPECT_FALSE(child.GetTooltipHandlerForPoint(midpoint));
380 const gfx::Point mouse_hover_point = 381 const gfx::Point mouse_hover_point =
381 midpoint + child.GetMirroredPosition().OffsetFromOrigin(); 382 midpoint + child.GetMirroredPosition().OffsetFromOrigin();
382 base::string16 tooltip; 383 base::string16 tooltip;
383 EXPECT_TRUE(static_cast<views::View&>(tab).GetTooltipText( 384 EXPECT_TRUE(static_cast<views::View&>(tab).GetTooltipText(
384 mouse_hover_point, &tooltip)); 385 mouse_hover_point, &tooltip));
385 EXPECT_EQ(chrome::AssembleTabTooltipText(data.title, data.media_state), 386 EXPECT_EQ(chrome::AssembleTabTooltipText(data.title, data.alert_state),
386 tooltip); 387 tooltip);
387 } 388 }
388 } 389 }
389 } 390 }
390 391
391 // Regression test for http://crbug.com/226253. Calling Layout() more than once 392 // Regression test for http://crbug.com/226253. Calling Layout() more than once
392 // shouldn't change the insets of the close button. 393 // shouldn't change the insets of the close button.
393 TEST_F(TabTest, CloseButtonLayout) { 394 TEST_F(TabTest, CloseButtonLayout) {
394 FakeTabController tab_controller; 395 FakeTabController tab_controller;
395 Tab tab(&tab_controller, nullptr); 396 Tab tab(&tab_controller, nullptr);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 465 }
465 466
466 TEST_F(TabTest, TitleHiddenWhenSmall) { 467 TEST_F(TabTest, TitleHiddenWhenSmall) {
467 FakeTabController tab_controller; 468 FakeTabController tab_controller;
468 Tab tab(&tab_controller, nullptr); 469 Tab tab(&tab_controller, nullptr);
469 tab.SetBounds(0, 0, 100, 50); 470 tab.SetBounds(0, 0, 100, 50);
470 EXPECT_GT(GetTitleWidth(tab), 0); 471 EXPECT_GT(GetTitleWidth(tab), 0);
471 tab.SetBounds(0, 0, 0, 50); 472 tab.SetBounds(0, 0, 0, 50);
472 EXPECT_EQ(0, GetTitleWidth(tab)); 473 EXPECT_EQ(0, GetTitleWidth(tab));
473 } 474 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_renderer_data.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698