| Index: ash/frame/custom_frame_view_ash_unittest.cc
|
| diff --git a/ash/frame/custom_frame_view_ash_unittest.cc b/ash/frame/custom_frame_view_ash_unittest.cc
|
| index eb0a543d3f11af36c41e84f0a38e4329b3198473..68a85a849a1109337d5deb3dcefdbb629df6ae66 100644
|
| --- a/ash/frame/custom_frame_view_ash_unittest.cc
|
| +++ b/ash/frame/custom_frame_view_ash_unittest.cc
|
| @@ -4,7 +4,9 @@
|
|
|
| #include "ash/frame/custom_frame_view_ash.h"
|
|
|
| +#include "ash/shell.h"
|
| #include "ash/test/ash_test_base.h"
|
| +#include "ash/test/test_session_state_delegate.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "grit/ash_resources.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| @@ -97,6 +99,11 @@ class CustomFrameViewAshTest : public test::AshTestBase {
|
| return widget.Pass();
|
| }
|
|
|
| + test::TestSessionStateDelegate* GetTestSessionStateDelegate() {
|
| + return static_cast<ash::test::TestSessionStateDelegate*>(
|
| + Shell::GetInstance()->session_state_delegate());
|
| + }
|
| +
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshTest);
|
| };
|
| @@ -158,4 +165,30 @@ TEST_F(CustomFrameViewAshTest, MinimumAndMaximumSize) {
|
| max_frame_size.height());
|
| }
|
|
|
| +// Verify that CustomFrameViewAsh updates the avatar icon based on the
|
| +// state of the SessionStateDelegate after visibility change.
|
| +TEST_F(CustomFrameViewAshTest, AvatarIcon) {
|
| + TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate;
|
| + scoped_ptr<views::Widget> widget(CreateWidget(delegate));
|
| +
|
| + CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view();
|
| + EXPECT_FALSE(custom_frame_view->GetAvatarIconViewForTest());
|
| +
|
| + // Avatar image becomes available.
|
| + const gfx::ImageSkia user_image =
|
| + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
|
| + IDR_AURA_UBER_TRAY_GUEST_ICON);
|
| + GetTestSessionStateDelegate()->SetUserImage(user_image);
|
| + widget->Hide();
|
| + widget->Show();
|
| + EXPECT_TRUE(custom_frame_view->GetAvatarIconViewForTest());
|
| +
|
| + // Avatar image is gone; the ImageView for the avatar icon should be
|
| + // removed.
|
| + GetTestSessionStateDelegate()->SetUserImage(gfx::ImageSkia());
|
| + widget->Hide();
|
| + widget->Show();
|
| + EXPECT_FALSE(custom_frame_view->GetAvatarIconViewForTest());
|
| +}
|
| +
|
| } // namespace ash
|
|
|