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

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

Issue 628773002: replace OVERRIDE and FINAL with override and final in chrome/browser/ui/[t-v]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 "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/views/tabs/media_indicator_button.h" 9 #include "chrome/browser/ui/views/tabs/media_indicator_button.h"
10 #include "chrome/browser/ui/views/tabs/tab_controller.h" 10 #include "chrome/browser/ui/views/tabs/tab_controller.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/base/models/list_selection_model.h" 12 #include "ui/base/models/list_selection_model.h"
13 #include "ui/views/controls/button/image_button.h" 13 #include "ui/views/controls/button/image_button.h"
14 #include "ui/views/controls/label.h" 14 #include "ui/views/controls/label.h"
15 #include "ui/views/test/views_test_base.h" 15 #include "ui/views/test/views_test_base.h"
16 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
17 17
18 using views::Widget; 18 using views::Widget;
19 19
20 class FakeTabController : public TabController { 20 class FakeTabController : public TabController {
21 public: 21 public:
22 FakeTabController() : immersive_style_(false), active_tab_(false) { 22 FakeTabController() : immersive_style_(false), active_tab_(false) {
23 } 23 }
24 virtual ~FakeTabController() {} 24 virtual ~FakeTabController() {}
25 25
26 void set_immersive_style(bool value) { immersive_style_ = value; } 26 void set_immersive_style(bool value) { immersive_style_ = value; }
27 void set_active_tab(bool value) { active_tab_ = value; } 27 void set_active_tab(bool value) { active_tab_ = value; }
28 28
29 virtual const ui::ListSelectionModel& GetSelectionModel() OVERRIDE { 29 virtual const ui::ListSelectionModel& GetSelectionModel() override {
30 return selection_model_; 30 return selection_model_;
31 } 31 }
32 virtual bool SupportsMultipleSelection() OVERRIDE { return false; } 32 virtual bool SupportsMultipleSelection() override { return false; }
33 virtual void SelectTab(Tab* tab) OVERRIDE {} 33 virtual void SelectTab(Tab* tab) override {}
34 virtual void ExtendSelectionTo(Tab* tab) OVERRIDE {} 34 virtual void ExtendSelectionTo(Tab* tab) override {}
35 virtual void ToggleSelected(Tab* tab) OVERRIDE {} 35 virtual void ToggleSelected(Tab* tab) override {}
36 virtual void AddSelectionFromAnchorTo(Tab* tab) OVERRIDE {} 36 virtual void AddSelectionFromAnchorTo(Tab* tab) override {}
37 virtual void CloseTab(Tab* tab, CloseTabSource source) OVERRIDE {} 37 virtual void CloseTab(Tab* tab, CloseTabSource source) override {}
38 virtual void ToggleTabAudioMute(Tab* tab) OVERRIDE {} 38 virtual void ToggleTabAudioMute(Tab* tab) override {}
39 virtual void ShowContextMenuForTab(Tab* tab, 39 virtual void ShowContextMenuForTab(Tab* tab,
40 const gfx::Point& p, 40 const gfx::Point& p,
41 ui::MenuSourceType source_type) OVERRIDE {} 41 ui::MenuSourceType source_type) override {}
42 virtual bool IsActiveTab(const Tab* tab) const OVERRIDE { 42 virtual bool IsActiveTab(const Tab* tab) const override {
43 return active_tab_; 43 return active_tab_;
44 } 44 }
45 virtual bool IsTabSelected(const Tab* tab) const OVERRIDE { 45 virtual bool IsTabSelected(const Tab* tab) const override {
46 return false; 46 return false;
47 } 47 }
48 virtual bool IsTabPinned(const Tab* tab) const OVERRIDE { return false; } 48 virtual bool IsTabPinned(const Tab* tab) const override { return false; }
49 virtual void MaybeStartDrag( 49 virtual void MaybeStartDrag(
50 Tab* tab, 50 Tab* tab,
51 const ui::LocatedEvent& event, 51 const ui::LocatedEvent& event,
52 const ui::ListSelectionModel& original_selection) OVERRIDE {} 52 const ui::ListSelectionModel& original_selection) override {}
53 virtual void ContinueDrag(views::View* view, 53 virtual void ContinueDrag(views::View* view,
54 const ui::LocatedEvent& event) OVERRIDE {} 54 const ui::LocatedEvent& event) override {}
55 virtual bool EndDrag(EndDragReason reason) OVERRIDE { return false; } 55 virtual bool EndDrag(EndDragReason reason) override { return false; }
56 virtual Tab* GetTabAt(Tab* tab, 56 virtual Tab* GetTabAt(Tab* tab,
57 const gfx::Point& tab_in_tab_coordinates) OVERRIDE { 57 const gfx::Point& tab_in_tab_coordinates) override {
58 return NULL; 58 return NULL;
59 } 59 }
60 virtual void OnMouseEventInTab(views::View* source, 60 virtual void OnMouseEventInTab(views::View* source,
61 const ui::MouseEvent& event) OVERRIDE {} 61 const ui::MouseEvent& event) override {}
62 virtual bool ShouldPaintTab(const Tab* tab, gfx::Rect* clip) OVERRIDE { 62 virtual bool ShouldPaintTab(const Tab* tab, gfx::Rect* clip) override {
63 return true; 63 return true;
64 } 64 }
65 virtual bool IsImmersiveStyle() const OVERRIDE { return immersive_style_; } 65 virtual bool IsImmersiveStyle() const override { return immersive_style_; }
66 virtual void UpdateTabAccessibilityState(const Tab* tab, 66 virtual void UpdateTabAccessibilityState(const Tab* tab,
67 ui::AXViewState* state) OVERRIDE{}; 67 ui::AXViewState* state) override{};
68 68
69 private: 69 private:
70 ui::ListSelectionModel selection_model_; 70 ui::ListSelectionModel selection_model_;
71 bool immersive_style_; 71 bool immersive_style_;
72 bool active_tab_; 72 bool active_tab_;
73 73
74 DISALLOW_COPY_AND_ASSIGN(FakeTabController); 74 DISALLOW_COPY_AND_ASSIGN(FakeTabController);
75 }; 75 };
76 76
77 class TabTest : public views::ViewsTestBase, 77 class TabTest : public views::ViewsTestBase,
78 public ::testing::WithParamInterface<bool> { 78 public ::testing::WithParamInterface<bool> {
79 public: 79 public:
80 TabTest() {} 80 TabTest() {}
81 virtual ~TabTest() {} 81 virtual ~TabTest() {}
82 82
83 bool testing_for_rtl_locale() const { return GetParam(); } 83 bool testing_for_rtl_locale() const { return GetParam(); }
84 84
85 virtual void SetUp() OVERRIDE { 85 virtual void SetUp() override {
86 if (testing_for_rtl_locale()) { 86 if (testing_for_rtl_locale()) {
87 original_locale_ = base::i18n::GetConfiguredLocale(); 87 original_locale_ = base::i18n::GetConfiguredLocale();
88 base::i18n::SetICUDefaultLocale("he"); 88 base::i18n::SetICUDefaultLocale("he");
89 } 89 }
90 views::ViewsTestBase::SetUp(); 90 views::ViewsTestBase::SetUp();
91 } 91 }
92 92
93 virtual void TearDown() OVERRIDE { 93 virtual void TearDown() override {
94 views::ViewsTestBase::TearDown(); 94 views::ViewsTestBase::TearDown();
95 if (testing_for_rtl_locale()) 95 if (testing_for_rtl_locale())
96 base::i18n::SetICUDefaultLocale(original_locale_); 96 base::i18n::SetICUDefaultLocale(original_locale_);
97 } 97 }
98 98
99 static void CheckForExpectedLayoutAndVisibilityOfElements(const Tab& tab) { 99 static void CheckForExpectedLayoutAndVisibilityOfElements(const Tab& tab) {
100 // Check whether elements are visible when they are supposed to be, given 100 // Check whether elements are visible when they are supposed to be, given
101 // Tab size and TabRendererData state. 101 // Tab size and TabRendererData state.
102 if (tab.data_.mini) { 102 if (tab.data_.mini) {
103 EXPECT_EQ(1, tab.IconCapacity()); 103 EXPECT_EQ(1, tab.IconCapacity());
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 EXPECT_EQ(50, tab.close_button_->bounds().height()); 335 EXPECT_EQ(50, tab.close_button_->bounds().height());
336 } 336 }
337 337
338 // Test in both a LTR and a RTL locale. Note: The fact that the UI code is 338 // Test in both a LTR and a RTL locale. Note: The fact that the UI code is
339 // configured for an RTL locale does *not* change how the coordinates are 339 // configured for an RTL locale does *not* change how the coordinates are
340 // examined in the tests above because views::View and friends are supposed to 340 // examined in the tests above because views::View and friends are supposed to
341 // auto-mirror the widgets when painting. Thus, what we're testing here is that 341 // auto-mirror the widgets when painting. Thus, what we're testing here is that
342 // there's no code in Tab that will erroneously subvert this automatic 342 // there's no code in Tab that will erroneously subvert this automatic
343 // coordinate translation. http://crbug.com/384179 343 // coordinate translation. http://crbug.com/384179
344 INSTANTIATE_TEST_CASE_P(, TabTest, ::testing::Values(false, true)); 344 INSTANTIATE_TEST_CASE_P(, TabTest, ::testing::Values(false, true));
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip_unittest.cc ('k') | chrome/browser/ui/views/task_manager_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698