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