| 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 "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/base/l10n/l10n_util.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 { |
| 22 public: | 23 public: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 class TabTest : public views::ViewsTestBase, | 72 class TabTest : public views::ViewsTestBase, |
| 72 public ::testing::WithParamInterface<bool> { | 73 public ::testing::WithParamInterface<bool> { |
| 73 public: | 74 public: |
| 74 TabTest() {} | 75 TabTest() {} |
| 75 virtual ~TabTest() {} | 76 virtual ~TabTest() {} |
| 76 | 77 |
| 77 bool testing_for_rtl_locale() const { return GetParam(); } | 78 bool testing_for_rtl_locale() const { return GetParam(); } |
| 78 | 79 |
| 79 void SetUp() override { | 80 void SetUp() override { |
| 80 if (testing_for_rtl_locale()) { | 81 if (testing_for_rtl_locale()) { |
| 81 original_locale_ = base::i18n::GetConfiguredLocale(); | 82 original_locale_ = l10n_util::GetConfiguredLocale(); |
| 82 base::i18n::SetICUDefaultLocale("he"); | 83 base::i18n::SetICUDefaultLocale("he"); |
| 83 } | 84 } |
| 84 views::ViewsTestBase::SetUp(); | 85 views::ViewsTestBase::SetUp(); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void TearDown() override { | 88 void TearDown() override { |
| 88 views::ViewsTestBase::TearDown(); | 89 views::ViewsTestBase::TearDown(); |
| 89 if (testing_for_rtl_locale()) | 90 if (testing_for_rtl_locale()) |
| 90 base::i18n::SetICUDefaultLocale(original_locale_); | 91 base::i18n::SetICUDefaultLocale(original_locale_); |
| 91 } | 92 } |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 EXPECT_EQ(50, tab.close_button_->bounds().height()); | 385 EXPECT_EQ(50, tab.close_button_->bounds().height()); |
| 385 } | 386 } |
| 386 | 387 |
| 387 // Test in both a LTR and a RTL locale. Note: The fact that the UI code is | 388 // Test in both a LTR and a RTL locale. Note: The fact that the UI code is |
| 388 // configured for an RTL locale does *not* change how the coordinates are | 389 // configured for an RTL locale does *not* change how the coordinates are |
| 389 // examined in the tests above because views::View and friends are supposed to | 390 // examined in the tests above because views::View and friends are supposed to |
| 390 // auto-mirror the widgets when painting. Thus, what we're testing here is that | 391 // auto-mirror the widgets when painting. Thus, what we're testing here is that |
| 391 // there's no code in Tab that will erroneously subvert this automatic | 392 // there's no code in Tab that will erroneously subvert this automatic |
| 392 // coordinate translation. http://crbug.com/384179 | 393 // coordinate translation. http://crbug.com/384179 |
| 393 INSTANTIATE_TEST_CASE_P(, TabTest, ::testing::Values(false, true)); | 394 INSTANTIATE_TEST_CASE_P(, TabTest, ::testing::Values(false, true)); |
| OLD | NEW |