| OLD | NEW |
| 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" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 Widget widget; | 414 Widget widget; |
| 415 InitWidget(&widget); | 415 InitWidget(&widget); |
| 416 FakeTabController tab_controller; | 416 FakeTabController tab_controller; |
| 417 Tab tab(&tab_controller, nullptr); | 417 Tab tab(&tab_controller, nullptr); |
| 418 widget.GetContentsView()->AddChildView(&tab); | 418 widget.GetContentsView()->AddChildView(&tab); |
| 419 | 419 |
| 420 views::ImageButton* tab_close_button = GetCloseButton(tab); | 420 views::ImageButton* tab_close_button = GetCloseButton(tab); |
| 421 | 421 |
| 422 // Verify tab_close_button does not get focus on right click. | 422 // Verify tab_close_button does not get focus on right click. |
| 423 ui::MouseEvent right_click_event(ui::ET_KEY_PRESSED, gfx::Point(), | 423 ui::MouseEvent right_click_event(ui::ET_KEY_PRESSED, gfx::Point(), |
| 424 gfx::Point(), base::TimeDelta(), | 424 gfx::Point(), base::TimeTicks(), |
| 425 ui::EF_RIGHT_MOUSE_BUTTON, 0); | 425 ui::EF_RIGHT_MOUSE_BUTTON, 0); |
| 426 tab_close_button->OnMousePressed(right_click_event); | 426 tab_close_button->OnMousePressed(right_click_event); |
| 427 EXPECT_NE(tab_close_button, | 427 EXPECT_NE(tab_close_button, |
| 428 tab_close_button->GetFocusManager()->GetFocusedView()); | 428 tab_close_button->GetFocusManager()->GetFocusedView()); |
| 429 } | 429 } |
| 430 | 430 |
| 431 // Tests expected changes to the ThrobberView state when the WebContents loading | 431 // Tests expected changes to the ThrobberView state when the WebContents loading |
| 432 // state changes or the animation timer (usually in BrowserView) triggers. | 432 // state changes or the animation timer (usually in BrowserView) triggers. |
| 433 TEST_F(TabTest, LayeredThrobber) { | 433 TEST_F(TabTest, LayeredThrobber) { |
| 434 Widget widget; | 434 Widget widget; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 } | 485 } |
| 486 | 486 |
| 487 TEST_F(TabTest, TitleHiddenWhenSmall) { | 487 TEST_F(TabTest, TitleHiddenWhenSmall) { |
| 488 FakeTabController tab_controller; | 488 FakeTabController tab_controller; |
| 489 Tab tab(&tab_controller, nullptr); | 489 Tab tab(&tab_controller, nullptr); |
| 490 tab.SetBounds(0, 0, 100, 50); | 490 tab.SetBounds(0, 0, 100, 50); |
| 491 EXPECT_GT(GetTitleWidth(tab), 0); | 491 EXPECT_GT(GetTitleWidth(tab), 0); |
| 492 tab.SetBounds(0, 0, 0, 50); | 492 tab.SetBounds(0, 0, 0, 50); |
| 493 EXPECT_EQ(0, GetTitleWidth(tab)); | 493 EXPECT_EQ(0, GetTitleWidth(tab)); |
| 494 } | 494 } |
| OLD | NEW |