Commit 0795efc4 authored by James Cook's avatar James Cook Committed by Commit Bot

Clean up MASH_DEPRECATED in FlagWarningTray and test

We don't run ash_unittests with --enable-features=Mash anymore, so
manually turn on the flag to test the feature.

Bug: 840391
Test: ash_unittests
Change-Id: Idb61128d9a65cbc6e93095683247c3e8cd714a9d
Reviewed-on: https://chromium-review.googlesource.com/1134418Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574405}
parent 382c1d76
......@@ -38,9 +38,6 @@ FlagWarningTray::FlagWarningTray(Shelf* shelf) : shelf_(shelf) {
DCHECK(shelf_);
SetLayoutManager(std::make_unique<views::FillLayout>());
// Flag warning tray is not currently used in non-MASH environments, because
// mus will roll out via experiment/Finch trial and showing the tray would
// reveal the experiment state to users.
DCHECK(!::features::IsAshInBrowserProcess());
container_ = new TrayContainer(shelf);
AddChildView(container_);
......
......@@ -4,26 +4,40 @@
#include "ash/system/flag_warning/flag_warning_tray.h"
#include "ash/public/cpp/config.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
#include "ash/test/ash_test_base.h"
#include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "ui/base/ui_base_features.h"
namespace ash {
namespace {
using FlagWarningTrayTest = AshTestBase;
class FlagWarningTrayTest : public AshTestBase {
public:
FlagWarningTrayTest() = default;
~FlagWarningTrayTest() override = default;
TEST_F(FlagWarningTrayTest, Visibility) {
// Flag warning tray is not currently used in non-MASH environments, because
// mus will roll out via experiment/Finch trial and showing the tray would
// reveal the experiment state to users.
const bool is_mash = Shell::GetAshConfig() == Config::MASH_DEPRECATED;
// testing::Test:
void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(::features::kMash);
AshTestBase::SetUp();
}
private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(FlagWarningTrayTest);
};
TEST_F(FlagWarningTrayTest, VisibleForMash) {
FlagWarningTray* tray = Shell::GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->flag_warning_tray_for_testing();
EXPECT_EQ(tray != nullptr, is_mash);
ASSERT_TRUE(tray);
EXPECT_TRUE(tray->visible());
}
} // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment