| 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 "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/tabs/tab_utils.h" | 9 #include "chrome/browser/ui/tabs/tab_utils.h" |
| 10 #include "chrome/browser/ui/views/tabs/media_indicator_button.h" | 10 #include "chrome/browser/ui/views/tabs/media_indicator_button.h" |
| 11 #include "chrome/browser/ui/views/tabs/tab_controller.h" | 11 #include "chrome/browser/ui/views/tabs/tab_controller.h" |
| 12 #include "grit/theme_resources.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/base/models/list_selection_model.h" | 14 #include "ui/base/models/list_selection_model.h" |
| 14 #include "ui/views/controls/button/image_button.h" | 15 #include "ui/views/controls/button/image_button.h" |
| 15 #include "ui/views/controls/label.h" | 16 #include "ui/views/controls/label.h" |
| 16 #include "ui/views/test/views_test_base.h" | 17 #include "ui/views/test/views_test_base.h" |
| 17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
| 18 | 19 |
| 19 using views::Widget; | 20 using views::Widget; |
| 20 | 21 |
| 21 class FakeTabController : public TabController { | 22 class FakeTabController : public TabController { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 void ContinueDrag(views::View* view, const ui::LocatedEvent& event) override { | 54 void ContinueDrag(views::View* view, const ui::LocatedEvent& event) override { |
| 54 } | 55 } |
| 55 bool EndDrag(EndDragReason reason) override { return false; } | 56 bool EndDrag(EndDragReason reason) override { return false; } |
| 56 Tab* GetTabAt(Tab* tab, const gfx::Point& tab_in_tab_coordinates) override { | 57 Tab* GetTabAt(Tab* tab, const gfx::Point& tab_in_tab_coordinates) override { |
| 57 return NULL; | 58 return NULL; |
| 58 } | 59 } |
| 59 void OnMouseEventInTab(views::View* source, | 60 void OnMouseEventInTab(views::View* source, |
| 60 const ui::MouseEvent& event) override {} | 61 const ui::MouseEvent& event) override {} |
| 61 bool ShouldPaintTab(const Tab* tab, gfx::Rect* clip) override { return true; } | 62 bool ShouldPaintTab(const Tab* tab, gfx::Rect* clip) override { return true; } |
| 62 bool IsImmersiveStyle() const override { return immersive_style_; } | 63 bool IsImmersiveStyle() const override { return immersive_style_; } |
| 64 int GetBackgroundResourceId(bool* custom_image) const override { |
| 65 *custom_image = false; |
| 66 return IDR_THEME_TAB_BACKGROUND; |
| 67 } |
| 63 void UpdateTabAccessibilityState(const Tab* tab, | 68 void UpdateTabAccessibilityState(const Tab* tab, |
| 64 ui::AXViewState* state) override{}; | 69 ui::AXViewState* state) override{}; |
| 65 | 70 |
| 66 private: | 71 private: |
| 67 ui::ListSelectionModel selection_model_; | 72 ui::ListSelectionModel selection_model_; |
| 68 bool immersive_style_; | 73 bool immersive_style_; |
| 69 bool active_tab_; | 74 bool active_tab_; |
| 70 | 75 |
| 71 DISALLOW_COPY_AND_ASSIGN(FakeTabController); | 76 DISALLOW_COPY_AND_ASSIGN(FakeTabController); |
| 72 }; | 77 }; |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 EXPECT_EQ(50, tab.close_button_->bounds().height()); | 411 EXPECT_EQ(50, tab.close_button_->bounds().height()); |
| 407 } | 412 } |
| 408 | 413 |
| 409 // Test in both a LTR and a RTL locale. Note: The fact that the UI code is | 414 // Test in both a LTR and a RTL locale. Note: The fact that the UI code is |
| 410 // configured for an RTL locale does *not* change how the coordinates are | 415 // configured for an RTL locale does *not* change how the coordinates are |
| 411 // examined in the tests above because views::View and friends are supposed to | 416 // examined in the tests above because views::View and friends are supposed to |
| 412 // auto-mirror the widgets when painting. Thus, what we're testing here is that | 417 // auto-mirror the widgets when painting. Thus, what we're testing here is that |
| 413 // there's no code in Tab that will erroneously subvert this automatic | 418 // there's no code in Tab that will erroneously subvert this automatic |
| 414 // coordinate translation. http://crbug.com/384179 | 419 // coordinate translation. http://crbug.com/384179 |
| 415 INSTANTIATE_TEST_CASE_P(, TabTest, ::testing::Values(false, true)); | 420 INSTANTIATE_TEST_CASE_P(, TabTest, ::testing::Values(false, true)); |
| OLD | NEW |