blob: c28c11c97d48b5a1659c3e8441f175eee348e90d [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/unified/unified_system_tray.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/status_area_widget_test_helper.h"
#include "ash/system/unified/unified_slider_bubble_controller.h"
#include "ash/test/ash_test_base.h"
namespace ash {
class UnifiedSystemTrayTest : public AshTestBase {
public:
UnifiedSystemTrayTest() = default;
~UnifiedSystemTrayTest() override = default;
protected:
bool IsSliderBubbleShown() {
return GetPrimaryUnifiedSystemTray()
->slider_bubble_controller_->bubble_widget_;
}
UnifiedSliderBubbleController::SliderType GetSliderBubbleType() {
return GetPrimaryUnifiedSystemTray()
->slider_bubble_controller_->slider_type_;
}
private:
DISALLOW_COPY_AND_ASSIGN(UnifiedSystemTrayTest);
};
TEST_F(UnifiedSystemTrayTest, ShowVolumeSliderBubble) {
if (!features::IsSystemTrayUnifiedEnabled())
return;
// The volume popup is not visible initially.
EXPECT_FALSE(IsSliderBubbleShown());
// When set to autohide, the shelf shouldn't be shown.
StatusAreaWidget* status = StatusAreaWidgetTestHelper::GetStatusAreaWidget();
EXPECT_FALSE(status->ShouldShowShelf());
// Simulate ARC asking to show the volume view.
GetPrimaryUnifiedSystemTray()->ShowVolumeSliderBubble();
// Volume view is now visible.
EXPECT_TRUE(IsSliderBubbleShown());
EXPECT_EQ(UnifiedSliderBubbleController::SLIDER_TYPE_VOLUME,
GetSliderBubbleType());
// This does not force the shelf to automatically show. Regression tests for
// crbug.com/729188
EXPECT_FALSE(status->ShouldShowShelf());
}
} // namespace ash