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

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

Issue 24647003: Redesign of the avatar menu button. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better fix for app/popup browser crash Created 7 years, 2 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 5962fb0328958e3cca74854c5701053135453285..c75f09a1b07df52d83446bebaa12d2ceb9ede48b 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
@@ -5,9 +5,11 @@
#include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h"
#include "base/basictypes.h"
+#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/views/tab_icon_view.h"
#include "chrome/browser/ui/views/tabs/tab.h"
+#include "chrome/common/chrome_switches.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/text_constants.h"
@@ -80,6 +82,10 @@ class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate {
return show_avatar_;
}
+ virtual bool IsRegularOrGuestSession() const OVERRIDE {
+ return true;
+ }
+
virtual gfx::ImageSkia GetOTRAvatarIcon() const OVERRIDE {
// The calculations depend on the size of the OTR resource, and chromeos
// uses a different sized image, so hard code the size of the current
@@ -213,6 +219,12 @@ class OpaqueBrowserFrameViewLayoutTest : public views::ViewsTestBase {
AddAvatarButton();
}
+ void AddNewAvatarButton() {
+ new_avatar_button_ = new views::MenuButton(NULL, string16(), NULL, false);
+ new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON);
+ root_view_->AddChildView(new_avatar_button_);
+ }
+
void ExpectBasicWindowBounds() {
EXPECT_EQ("428,1 25x18", maximize_button_->bounds().ToString());
EXPECT_EQ("402,1 26x18", minimize_button_->bounds().ToString());
@@ -238,6 +250,7 @@ class OpaqueBrowserFrameViewLayoutTest : public views::ViewsTestBase {
views::MenuButton* menu_button_;
views::MenuButton* avatar_label_;
+ views::MenuButton* new_avatar_button_;
DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameViewLayoutTest);
};
@@ -314,6 +327,28 @@ TEST_F(OpaqueBrowserFrameViewLayoutTest, WindowWithAvatar) {
EXPECT_EQ("261x73", layout_manager_->GetMinimumSize(kWidth).ToString());
}
+
+TEST_F(OpaqueBrowserFrameViewLayoutTest, WindowWithNewAvatar) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kNewProfileManagement);
+
+ // Tests a normal tabstrip window with the new style avatar icon.
+ AddNewAvatarButton();
+ root_view_->Layout();
+
+ ExpectBasicWindowBounds();
+
+ // Check the location of the caption button
+ EXPECT_EQ("385,1 12x20", new_avatar_button_->bounds().ToString());
+ // The basic window bounds are (-1, 13 398x29). There should not be an icon
+ // avatar in the left, and the new avatar button has an offset of 5 to its
+ // next control.
+ EXPECT_EQ("-1,13 381x29",
+ layout_manager_->GetBoundsForTabStrip(
+ delegate_->GetTabstripPreferredSize(), kWidth).ToString());
+ EXPECT_EQ("261x73", layout_manager_->GetMinimumSize(kWidth).ToString());
+}
+
TEST_F(OpaqueBrowserFrameViewLayoutTest, WindowWithAvatarLabelAndButton) {
AddAvatarLabel();
root_view_->Layout();
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegate.h ('k') | chrome/browser/ui/views/new_avatar_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698