This source file includes following definitions.
- GetUserLoginStatus
- CreateDefaultView
- CreateDetailedView
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
#include "ash/system/chromeos/brightness/tray_brightness.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/system_tray_item.h"
#include "ash/test/ash_test_base.h"
#include "ui/views/view.h"
namespace ash {
namespace {
user::LoginStatus GetUserLoginStatus() {
return Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus();
}
}
class TrayBrightnessTest : public test::AshTestBase {
public:
TrayBrightnessTest() {}
virtual ~TrayBrightnessTest() {}
protected:
views::View* CreateDefaultView() {
TrayBrightness tray(NULL);
return tray.CreateDefaultView(GetUserLoginStatus());
}
views::View* CreateDetailedView() {
TrayBrightness tray(NULL);
return tray.CreateDetailedView(GetUserLoginStatus());
}
private:
DISALLOW_COPY_AND_ASSIGN(TrayBrightnessTest);
};
TEST_F(TrayBrightnessTest, CreateDefaultView) {
scoped_ptr<views::View> tray(CreateDefaultView());
EXPECT_FALSE(tray->visible());
}
TEST_F(TrayBrightnessTest, CreateDefaultViewDuringMaximizeMode) {
Shell::GetInstance()->EnableMaximizeModeWindowManager(true);
scoped_ptr<views::View> tray(CreateDefaultView());
EXPECT_TRUE(tray->visible());
Shell::GetInstance()->EnableMaximizeModeWindowManager(false);
}
TEST_F(TrayBrightnessTest, DefaultViewVisibilityChangesDuringMaximizeMode) {
scoped_ptr<views::View> tray(CreateDefaultView());
Shell::GetInstance()->EnableMaximizeModeWindowManager(true);
EXPECT_TRUE(tray->visible());
Shell::GetInstance()->EnableMaximizeModeWindowManager(false);
EXPECT_FALSE(tray->visible());
}
TEST_F(TrayBrightnessTest, CreateDetailedView) {
scoped_ptr<views::View> tray(CreateDetailedView());
EXPECT_TRUE(tray->visible());
}
TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) {
Shell::GetInstance()->EnableMaximizeModeWindowManager(true);
scoped_ptr<views::View> tray(CreateDetailedView());
EXPECT_TRUE(tray->visible());
Shell::GetInstance()->EnableMaximizeModeWindowManager(false);
}
TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) {
scoped_ptr<views::View> tray(CreateDetailedView());
Shell::GetInstance()->EnableMaximizeModeWindowManager(true);
EXPECT_TRUE(tray->visible());
Shell::GetInstance()->EnableMaximizeModeWindowManager(false);
EXPECT_TRUE(tray->visible());
}
}