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

Unified Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc

Issue 1972033002: Simplify some old avatar menu button code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc
index 107391aaa71e3dac6c635894477f0c289f173bc6..544cb2fce71c845ba925f7b7cb93346de26af54e 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc
@@ -8,7 +8,7 @@
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/layout_constants.h"
-#include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
+#include "chrome/browser/ui/views/profiles/profile_indicator_icon.h"
#include "chrome/browser/ui/views/tab_icon_view.h"
#include "chrome/browser/ui/views/tabs/tab.h"
#include "chrome/common/chrome_switches.h"
@@ -39,15 +39,10 @@ const int kCaptionButtonHeight = 18;
class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate {
public:
- TestLayoutDelegate()
- : show_avatar_(false),
- show_caption_buttons_(true),
- maximized_(false) {
- }
+ TestLayoutDelegate() : show_caption_buttons_(true), maximized_(false) {}
~TestLayoutDelegate() override {}
void set_window_title(const base::string16& title) { window_title_ = title; }
- void set_show_avatar(bool show_avatar) { show_avatar_ = show_avatar; }
void set_show_caption_buttons(bool show_caption_buttons) {
show_caption_buttons_ = show_caption_buttons;
}
@@ -64,7 +59,6 @@ class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate {
bool ShouldShowCaptionButtons() const override {
return show_caption_buttons_;
}
- bool ShouldShowAvatar() const override { return show_avatar_; }
bool IsRegularOrGuestSession() const override { return true; }
gfx::ImageSkia GetOTRAvatarIcon() const override {
return gfx::ImageSkia(gfx::ImageSkiaRep(gfx::Size(40, 29), 1.0f));
@@ -84,7 +78,6 @@ class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate {
private:
base::string16 window_title_;
- bool show_avatar_;
bool show_caption_buttons_;
bool maximized_;
@@ -170,7 +163,6 @@ class OpaqueBrowserFrameViewLayoutTest : public views::ViewsTestBase {
new views::MenuButton(base::string16(), nullptr, false);
new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON);
root_view_->AddChildView(new_avatar_button_);
- delegate_->set_show_avatar(true);
}
int CaptionY() const {
@@ -240,8 +232,9 @@ class OpaqueBrowserFrameViewLayoutTest : public views::ViewsTestBase {
int caption_buttons_width = kCaptionButtonsWidth;
bool show_caption_buttons = delegate_->ShouldShowCaptionButtons();
bool maximized = delegate_->IsMaximized() || !show_caption_buttons;
- if (delegate_->ShouldShowAvatar()) {
- caption_buttons_width += new_avatar_button_->GetPreferredSize().width() +
+ if (new_avatar_button_) {
+ caption_buttons_width +=
+ new_avatar_button_->GetPreferredSize().width() +
(maximized ? OBFVL::kCaptionSpacing
: -GetLayoutSize(NEW_TAB_BUTTON).width());
}

Powered by Google App Engine
This is Rietveld 408576698