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

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

Issue 2690443002: cros-md: Remove the non-MD immersive mode code paths (Closed)
Patch Set: rebase & code comments Created 3 years, 10 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_strip_unittest.cc ('k') | no next file » | 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/alert_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 "chrome/grit/theme_resources.h" 15 #include "chrome/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;
24 24
25 class FakeTabController : public TabController { 25 class FakeTabController : public TabController {
26 public: 26 public:
27 FakeTabController() {} 27 FakeTabController() {}
28 28
29 void set_immersive_style(bool value) { immersive_style_ = value; }
30 void set_active_tab(bool value) { active_tab_ = value; } 29 void set_active_tab(bool value) { active_tab_ = value; }
31 void set_paint_throbber_to_layer(bool value) { 30 void set_paint_throbber_to_layer(bool value) {
32 paint_throbber_to_layer_ = value; 31 paint_throbber_to_layer_ = value;
33 } 32 }
34 33
35 const ui::ListSelectionModel& GetSelectionModel() const override { 34 const ui::ListSelectionModel& GetSelectionModel() const override {
36 return selection_model_; 35 return selection_model_;
37 } 36 }
38 bool SupportsMultipleSelection() override { return false; } 37 bool SupportsMultipleSelection() override { return false; }
39 bool ShouldHideCloseButtonForInactiveTabs() override { 38 bool ShouldHideCloseButtonForInactiveTabs() override {
(...skipping 26 matching lines...) Expand all
66 const ui::MouseEvent& event) override {} 65 const ui::MouseEvent& event) override {}
67 bool ShouldPaintTab( 66 bool ShouldPaintTab(
68 const Tab* tab, 67 const Tab* tab,
69 const base::Callback<gfx::Path(const gfx::Size&)>& border_callback, 68 const base::Callback<gfx::Path(const gfx::Size&)>& border_callback,
70 gfx::Path* clip) override { 69 gfx::Path* clip) override {
71 return true; 70 return true;
72 } 71 }
73 bool CanPaintThrobberToLayer() const override { 72 bool CanPaintThrobberToLayer() const override {
74 return paint_throbber_to_layer_; 73 return paint_throbber_to_layer_;
75 } 74 }
76 bool IsImmersiveStyle() const override { return immersive_style_; }
77 SkColor GetToolbarTopSeparatorColor() const override { return SK_ColorBLACK; } 75 SkColor GetToolbarTopSeparatorColor() const override { return SK_ColorBLACK; }
78 int GetBackgroundResourceId(bool* custom_image) const override { 76 int GetBackgroundResourceId(bool* custom_image) const override {
79 *custom_image = false; 77 *custom_image = false;
80 return IDR_THEME_TAB_BACKGROUND; 78 return IDR_THEME_TAB_BACKGROUND;
81 } 79 }
82 void UpdateTabAccessibilityState(const Tab* tab, 80 void UpdateTabAccessibilityState(const Tab* tab,
83 ui::AXNodeData* node_data) override{}; 81 ui::AXNodeData* node_data) override{};
84 base::string16 GetAccessibleTabName(const Tab* tab) const override { 82 base::string16 GetAccessibleTabName(const Tab* tab) const override {
85 return base::string16(); 83 return base::string16();
86 } 84 }
87 85
88 private: 86 private:
89 ui::ListSelectionModel selection_model_; 87 ui::ListSelectionModel selection_model_;
90 bool immersive_style_ = false;
91 bool active_tab_ = false; 88 bool active_tab_ = false;
92 bool paint_throbber_to_layer_ = true; 89 bool paint_throbber_to_layer_ = true;
93 90
94 DISALLOW_COPY_AND_ASSIGN(FakeTabController); 91 DISALLOW_COPY_AND_ASSIGN(FakeTabController);
95 }; 92 };
96 93
97 class TabTest : public views::ViewsTestBase { 94 class TabTest : public views::ViewsTestBase {
98 public: 95 public:
99 TabTest() {} 96 TabTest() {}
100 ~TabTest() override {} 97 ~TabTest() override {}
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 488 }
492 489
493 TEST_F(TabTest, TitleHiddenWhenSmall) { 490 TEST_F(TabTest, TitleHiddenWhenSmall) {
494 FakeTabController tab_controller; 491 FakeTabController tab_controller;
495 Tab tab(&tab_controller, nullptr); 492 Tab tab(&tab_controller, nullptr);
496 tab.SetBounds(0, 0, 100, 50); 493 tab.SetBounds(0, 0, 100, 50);
497 EXPECT_GT(GetTitleWidth(tab), 0); 494 EXPECT_GT(GetTitleWidth(tab), 0);
498 tab.SetBounds(0, 0, 0, 50); 495 tab.SetBounds(0, 0, 0, 50);
499 EXPECT_EQ(0, GetTitleWidth(tab)); 496 EXPECT_EQ(0, GetTitleWidth(tab));
500 } 497 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698