#include "ash/system/tracing_notification_controller.h"
#include "ash/shell.h"
#include "ash/system/model/system_tray_model.h"
#include "ash/test/ash_test_base.h"
#include "ui/message_center/message_center.h"
namespace ash {
class TracingNotificationControllerTest : public AshTestBase {
public:
TracingNotificationControllerTest() = default;
TracingNotificationControllerTest(const TracingNotificationControllerTest&) =
delete;
TracingNotificationControllerTest& operator=(
const TracingNotificationControllerTest&) = delete;
~TracingNotificationControllerTest() override = default;
protected:
bool HasNotification() {
return message_center::MessageCenter::Get()->FindVisibleNotificationById(
TracingNotificationController::kNotificationId);
}
};
TEST_F(TracingNotificationControllerTest, Visibility) {
EXPECT_FALSE(HasNotification());
SystemTrayModel* model = Shell::Get()->system_tray_model();
model->SetPerformanceTracingIconVisible(true);
EXPECT_TRUE(HasNotification());
model->SetPerformanceTracingIconVisible(false);
EXPECT_FALSE(HasNotification());
}
}