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

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

Issue 1424913008: Combine tab background image getter code into one place. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@combine_tab_drawing
Patch Set: Created 5 years, 1 month 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.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 "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
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
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));
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698