
The methodology used to generate this CL is documented in https://crbug.com/1098010#c21. No-Try: true No-Presubmit: true Bug: 1098010 Change-Id: I1d041830fce905cf3682306ab435f4356d528c0e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3879644 Reviewed-by: Mark Mentovai <mark@chromium.org> Auto-Submit: Avi Drissman <avi@chromium.org> Commit-Queue: Avi Drissman <avi@chromium.org> Owners-Override: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/main@{#1044133}
49 lines
1.5 KiB
C++
49 lines
1.5 KiB
C++
// Copyright 2018 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#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);
|
|
}
|
|
};
|
|
|
|
// Tests that the notification becomes visible when the tray model toggles
|
|
// it.
|
|
TEST_F(TracingNotificationControllerTest, Visibility) {
|
|
// The system starts with tracing off, so the notification isn't visible.
|
|
EXPECT_FALSE(HasNotification());
|
|
|
|
// Simulate turning on tracing.
|
|
SystemTrayModel* model = Shell::Get()->system_tray_model();
|
|
model->SetPerformanceTracingIconVisible(true);
|
|
EXPECT_TRUE(HasNotification());
|
|
|
|
// Simulate turning off tracing.
|
|
model->SetPerformanceTracingIconVisible(false);
|
|
EXPECT_FALSE(HasNotification());
|
|
}
|
|
|
|
} // namespace ash
|