Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame/opaque_browser_frame_view_layout.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
| 11 #include "chrome/browser/ui/views/tab_icon_view.h" | 11 #include "chrome/browser/ui/views/tab_icon_view.h" |
| 12 #include "chrome/browser/ui/views/tabs/tab.h" | 12 #include "chrome/browser/ui/views/tabs/tab.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/test/base/testing_browser_process.h" | |
| 15 #include "chrome/test/base/testing_profile_manager.h" | |
| 14 #include "components/signin/core/common/profile_management_switches.h" | 16 #include "components/signin/core/common/profile_management_switches.h" |
| 15 #include "ui/gfx/image/image_skia.h" | 17 #include "ui/gfx/image/image_skia.h" |
| 16 #include "ui/gfx/image/image_skia_rep.h" | 18 #include "ui/gfx/image/image_skia_rep.h" |
| 17 #include "ui/gfx/text_constants.h" | 19 #include "ui/gfx/text_constants.h" |
| 18 #include "ui/views/controls/button/image_button.h" | 20 #include "ui/views/controls/button/image_button.h" |
| 19 #include "ui/views/controls/button/menu_button.h" | 21 #include "ui/views/controls/button/menu_button.h" |
| 20 #include "ui/views/controls/label.h" | 22 #include "ui/views/controls/label.h" |
| 21 #include "ui/views/test/views_test_base.h" | 23 #include "ui/views/test/views_test_base.h" |
| 22 | 24 |
| 23 #if defined(ENABLE_SUPERVISED_USERS) | 25 #if defined(ENABLE_SUPERVISED_USERS) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 | 134 |
| 133 } // namespace | 135 } // namespace |
| 134 | 136 |
| 135 class OpaqueBrowserFrameViewLayoutTest : public views::ViewsTestBase { | 137 class OpaqueBrowserFrameViewLayoutTest : public views::ViewsTestBase { |
| 136 public: | 138 public: |
| 137 OpaqueBrowserFrameViewLayoutTest() {} | 139 OpaqueBrowserFrameViewLayoutTest() {} |
| 138 ~OpaqueBrowserFrameViewLayoutTest() override {} | 140 ~OpaqueBrowserFrameViewLayoutTest() override {} |
| 139 | 141 |
| 140 void SetUp() override { | 142 void SetUp() override { |
| 141 views::ViewsTestBase::SetUp(); | 143 views::ViewsTestBase::SetUp(); |
| 144 // Set up a test profiler manager so that | |
| 145 // ProfileManager::GetProfileInfoCache won't crash when constructing | |
|
msw
2015/04/16 22:53:34
Can you make AvatarBaseButton work when g_browser_
yao
2015/05/04 17:30:06
Done.
| |
| 146 // and destructing AvatarBaseButton. | |
| 147 TestingProfileManager profile_manager_(TestingBrowserProcess::GetGlobal()); | |
| 148 ASSERT_TRUE(profile_manager_.SetUp()); | |
| 142 | 149 |
| 143 delegate_.reset(new TestLayoutDelegate); | 150 delegate_.reset(new TestLayoutDelegate); |
| 144 layout_manager_ = new OpaqueBrowserFrameViewLayout(delegate_.get()); | 151 layout_manager_ = new OpaqueBrowserFrameViewLayout(delegate_.get()); |
| 145 layout_manager_->set_extra_caption_y(0); | 152 layout_manager_->set_extra_caption_y(0); |
| 146 layout_manager_->set_window_caption_spacing(0); | 153 layout_manager_->set_window_caption_spacing(0); |
| 147 widget_ = new Widget; | 154 widget_ = new Widget; |
| 148 widget_->Init(CreateParams(Widget::InitParams::TYPE_POPUP)); | 155 widget_->Init(CreateParams(Widget::InitParams::TYPE_POPUP)); |
| 149 root_view_ = widget_->GetRootView(); | 156 root_view_ = widget_->GetRootView(); |
| 150 root_view_->SetSize(gfx::Size(kWidth, kWidth)); | 157 root_view_->SetSize(gfx::Size(kWidth, kWidth)); |
| 151 root_view_->SetLayoutManager(layout_manager_); | 158 root_view_->SetLayoutManager(layout_manager_); |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 // both are displayed on the left side. | 551 // both are displayed on the left side. |
| 545 // The label height and width depends on the font size and the text displayed. | 552 // The label height and width depends on the font size and the text displayed. |
| 546 // This may possibly change, so we don't test it here. | 553 // This may possibly change, so we don't test it here. |
| 547 EXPECT_EQ(menu_button_->bounds().x() - 2, | 554 EXPECT_EQ(menu_button_->bounds().x() - 2, |
| 548 supervised_user_avatar_label_->bounds().x()); | 555 supervised_user_avatar_label_->bounds().x()); |
| 549 EXPECT_EQ(menu_button_->bounds().bottom() - 3 - | 556 EXPECT_EQ(menu_button_->bounds().bottom() - 3 - |
| 550 supervised_user_avatar_label_->bounds().height(), | 557 supervised_user_avatar_label_->bounds().height(), |
| 551 supervised_user_avatar_label_->bounds().y()); | 558 supervised_user_avatar_label_->bounds().y()); |
| 552 } | 559 } |
| 553 #endif | 560 #endif |
| OLD | NEW |