Commit 3e73c24c authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Remove SystemTrayUnified checks on chrome side.

This CL removes references to IsSystemTrayUnifiedEnabled in
chrome/browser/. tray_accessibility_browsertest and first_run_controller
are intentionally left as the first one will be moved to ash/,
and the second one will be updated in a separate CL.

This is the part 2 of removing old System Tray code.

(1) Removing the flag
(2) Removing references to IsSystemTrayUnifiedEnabled()
(3) Removing classes that are only used in old System Tray

I'll try to keep the number of CLs as small as possible to make the
history clean, but there can be multiple CLs for both part 2 and part 3
because some of them requires nontrivial refactoring to remove the
dependency to the old code.

TEST=trybot pass
BUG=898419

Change-Id: Ib1d046bae25a61354bba5dd8d0ce62ba938c015f
Reviewed-on: https://chromium-review.googlesource.com/c/1301054Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603405}
parent b76dfdd2
......@@ -13,7 +13,6 @@
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/unified/unified_system_tray.h"
#include "base/bind.h"
#include "base/memory/weak_ptr.h"
......@@ -158,14 +157,11 @@ class SelectToSpeakTest : public InProcessBrowserTest {
};
IN_PROC_BROWSER_TEST_F(SelectToSpeakTest, SpeakStatusTray) {
gfx::Rect tray_bounds =
ash::features::IsSystemTrayUnifiedEnabled()
? ash::Shell::Get()
->GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray()
->GetBoundsInScreen()
: ash::Shell::Get()->GetPrimarySystemTray()->GetBoundsInScreen();
gfx::Rect tray_bounds = ash::Shell::Get()
->GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray()
->GetBoundsInScreen();
// Hold down Search and click a few pixels into the status tray bounds.
generator_->PressKey(ui::VKEY_LWIN, 0 /* flags */);
......
......@@ -6,13 +6,9 @@
#include "ash/accelerators/accelerator_controller.h"
#include "ash/public/cpp/accelerators.h"
#include "ash/public/cpp/app_list/app_list_features.h"
#include "ash/public/cpp/app_list/app_list_switches.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/unified/unified_system_tray.h"
#include "base/command_line.h"
#include "base/macros.h"
......@@ -669,15 +665,10 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_TouchExploreStatusTray) {
// Send an accessibility hover event on the system tray, which is
// what we get when you tap it on a touch screen when ChromeVox is on.
ash::TrayBackgroundView* tray =
ash::features::IsSystemTrayUnifiedEnabled()
? static_cast<ash::TrayBackgroundView*>(
ash::Shell::Get()
->GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray())
: static_cast<ash::TrayBackgroundView*>(
ash::Shell::Get()->GetPrimarySystemTray());
ash::TrayBackgroundView* tray = ash::Shell::Get()
->GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray();
tray->NotifyAccessibilityEvent(ax::mojom::Event::kHover, true);
EXPECT_EQ("Status tray,", speech_monitor_.GetNextUtterance());
......
......@@ -4,13 +4,11 @@
#include <stddef.h>
#include "ash/public/cpp/ash_features.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/sticky_keys/sticky_keys_controller.h"
#include "ash/sticky_keys/sticky_keys_overlay.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/unified/unified_system_tray.h"
#include "base/macros.h"
#include "base/run_loop.h"
......@@ -44,25 +42,19 @@ class StickyKeysBrowserTest : public InProcessBrowserTest {
}
bool IsSystemTrayBubbleOpen() {
return ash::features::IsSystemTrayUnifiedEnabled()
? ash::Shell::Get()
->GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray()
->IsBubbleShown()
: ash::Shell::Get()->GetPrimarySystemTray()->HasSystemBubble();
return ash::Shell::Get()
->GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray()
->IsBubbleShown();
}
void CloseSystemTrayBubble() {
if (ash::features::IsSystemTrayUnifiedEnabled()) {
ash::Shell::Get()
->GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray()
->CloseBubble();
} else {
ash::Shell::Get()->GetPrimarySystemTray()->CloseBubble();
}
ash::Shell::Get()
->GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray()
->CloseBubble();
}
void SendKeyPress(ui::KeyboardCode key) {
......
......@@ -4,11 +4,9 @@
#include <string>
#include "ash/public/cpp/ash_features.h"
#include "ash/shelf/shelf.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/unified/unified_system_tray.h"
#include "base/command_line.h"
#include "base/location.h"
......@@ -194,11 +192,7 @@ void TestSystemTrayIsVisible(bool otr) {
aura::Window* primary_win = ash::Shell::GetPrimaryRootWindow();
ash::Shelf* shelf = ash::Shelf::ForWindow(primary_win);
ash::TrayBackgroundView* tray =
ash::features::IsSystemTrayUnifiedEnabled()
? static_cast<ash::TrayBackgroundView*>(
shelf->GetStatusAreaWidget()->unified_system_tray())
: static_cast<ash::TrayBackgroundView*>(
shelf->GetStatusAreaWidget()->system_tray());
shelf->GetStatusAreaWidget()->unified_system_tray();
SCOPED_TRACE(testing::Message()
<< "ShelfVisibilityState=" << shelf->GetVisibilityState()
<< " ShelfAutoHideBehavior=" << shelf->auto_hide_behavior());
......
......@@ -30,6 +30,5 @@ specific_include_rules = {
"login_display_host_webui\.cc": [
"+ash/accessibility/focus_ring_controller.h",
"+ash/shell.h",
"+ash/system/tray/system_tray.h",
],
}
......@@ -11,7 +11,6 @@
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/location.h"
......
......@@ -4,7 +4,6 @@
#include "chrome/browser/ui/ash/system_tray_client.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_view_ids.h"
#include "ash/public/interfaces/constants.mojom.h"
#include "ash/public/interfaces/system_tray_test_api.mojom.h"
......@@ -63,103 +62,6 @@ class SystemTrayClientTest : public InProcessBrowserTest {
DISALLOW_COPY_AND_ASSIGN(SystemTrayClientTest);
};
// Test that a chrome update shows the update icon in the system menu.
IN_PROC_BROWSER_TEST_F(SystemTrayClientTest, UpdateTrayIcon) {
// The tray icon is removed in UnifiedSystemTray.
// TODO(tetsui): Remove the test after UnifiedSystemTray launch.
// https://crbug.com/847104
if (ash::features::IsSystemTrayUnifiedEnabled())
return;
ash::mojom::SystemTrayTestApiAsyncWaiter wait_for(tray_test_api_.get());
// When no update is pending, the icon isn't visible.
bool visible = false;
wait_for.IsTrayViewVisible(ash::VIEW_ID_TRAY_UPDATE_ICON, &visible);
EXPECT_FALSE(visible);
// Simulate an upgrade. This sends a mojo message to ash.
UpgradeDetector* detector = UpgradeDetector::GetInstance();
detector->set_upgrade_notification_stage(
UpgradeDetector::UPGRADE_ANNOYANCE_LOW);
detector->NotifyUpgrade();
content::RunAllPendingInMessageLoop();
// Tray icon is now visible.
wait_for.IsTrayViewVisible(ash::VIEW_ID_TRAY_UPDATE_ICON, &visible);
EXPECT_TRUE(visible);
}
// Tests that the update icon becomes visible after an update is detected
// available for downloading over cellular connection. The update icon hides
// after user's one time permission on the update is set successfully in Update
// Engine.
IN_PROC_BROWSER_TEST_F(SystemTrayClientTest, UpdateOverCellularTrayIcon) {
// The tray icon is removed in UnifiedSystemTray.
// TODO(tetsui): Remove the test after UnifiedSystemTray launch.
// https://crbug.com/847104
if (ash::features::IsSystemTrayUnifiedEnabled())
return;
ash::mojom::SystemTrayTestApiAsyncWaiter wait_for(tray_test_api_.get());
wait_for.DisableAnimations();
// When no update is pending, the icon isn't visible.
bool visible = false;
wait_for.IsTrayViewVisible(ash::VIEW_ID_TRAY_UPDATE_ICON, &visible);
EXPECT_FALSE(visible);
chromeos::UpdateEngineClient::Status status;
status.status =
chromeos::UpdateEngineClient::UPDATE_STATUS_NEED_PERMISSION_TO_UPDATE;
fake_update_engine_client_->set_default_status(status);
fake_update_engine_client_->NotifyObserversThatStatusChanged(status);
content::RunAllPendingInMessageLoop();
// When an update is available over cellular networks, the icon is visible.
wait_for.IsTrayViewVisible(ash::VIEW_ID_TRAY_UPDATE_ICON, &visible);
EXPECT_TRUE(visible);
wait_for.ShowBubble();
base::string16 label;
wait_for.GetBubbleLabelText(ash::VIEW_ID_TRAY_UPDATE_MENU_LABEL, &label);
EXPECT_EQ("Click to view update details", base::UTF16ToUTF8(label));
// Notifies that the user's one time permission on update over cellular
// connection is granted.
fake_update_engine_client_
->NotifyUpdateOverCellularOneTimePermissionGranted();
content::RunAllPendingInMessageLoop();
// When user permission is granted, the icon becomes invisible.
wait_for.IsTrayViewVisible(ash::VIEW_ID_TRAY_UPDATE_ICON, &visible);
EXPECT_FALSE(visible);
}
// Test that a flash update causes the update UI to show in the system menu.
IN_PROC_BROWSER_TEST_F(SystemTrayClientTest, FlashUpdateTrayIcon) {
// The tray icon is removed in UnifiedSystemTray.
// TODO(tetsui): Remove the test after UnifiedSystemTray launch.
// https://crbug.com/847104
if (ash::features::IsSystemTrayUnifiedEnabled())
return;
ash::mojom::SystemTrayTestApiAsyncWaiter wait_for(tray_test_api_.get());
// When no update is pending, the icon isn't visible.
bool visible = false;
wait_for.IsTrayViewVisible(ash::VIEW_ID_TRAY_UPDATE_ICON, &visible);
EXPECT_FALSE(visible);
// Simulate a Flash update. This sends a mojo message to ash.
SystemTrayClient::Get()->SetFlashUpdateAvailable();
content::RunAllPendingInMessageLoop();
// Tray icon is now visible.
wait_for.IsTrayViewVisible(ash::VIEW_ID_TRAY_UPDATE_ICON, &visible);
EXPECT_TRUE(visible);
}
using SystemTrayClientEnterpriseTest = policy::DevicePolicyCrosBrowserTest;
IN_PROC_BROWSER_TEST_F(SystemTrayClientEnterpriseTest, TrayEnterprise) {
......
......@@ -5,7 +5,6 @@
#include <memory>
#include <vector>
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_view_ids.h"
#include "ash/public/interfaces/ash_message_center_controller.mojom.h"
#include "ash/public/interfaces/constants.mojom.h"
......@@ -64,39 +63,19 @@ class SystemTrayTrayCastMediaRouterChromeOSTest : public InProcessBrowserTest {
bool IsTrayVisible() { return IsViewDrawn(ash::VIEW_ID_CAST_MAIN_VIEW); }
bool IsCastingNotificationVisible() {
ash::mojom::SystemTrayTestApiAsyncWaiter wait_for(tray_test_api_.get());
if (ash::features::IsSystemTrayUnifiedEnabled())
return !GetNotificationString().empty();
else
return IsViewDrawn(ash::VIEW_ID_CAST_CAST_VIEW);
}
bool IsTraySelectViewVisible() {
// TODO(tetsui): Remove this method because in UnifiedSystemTray we don't
// have distinction between select view and cast view.
if (ash::features::IsSystemTrayUnifiedEnabled())
return IsTrayVisible();
ash::mojom::SystemTrayTestApiAsyncWaiter wait_for(tray_test_api_.get());
return IsViewDrawn(ash::VIEW_ID_CAST_SELECT_VIEW);
return !GetNotificationString().empty();
}
base::string16 GetNotificationString() {
if (ash::features::IsSystemTrayUnifiedEnabled()) {
ash::mojom::AshMessageCenterControllerAsyncWaiter wait_for(
ash_message_center_controller_.get());
std::vector<message_center::Notification> notifications;
wait_for.GetActiveNotifications(&notifications);
for (const auto& notification : notifications) {
if (notification.id() == kNotificationId)
return notification.title();
}
return base::string16();
} else {
base::string16 result;
ash::mojom::SystemTrayTestApiAsyncWaiter wait_for(tray_test_api_.get());
wait_for.GetBubbleLabelText(ash::VIEW_ID_CAST_CAST_VIEW_LABEL, &result);
return result;
ash::mojom::AshMessageCenterControllerAsyncWaiter wait_for(
ash_message_center_controller_.get());
std::vector<message_center::Notification> notifications;
wait_for.GetActiveNotifications(&notifications);
for (const auto& notification : notifications) {
if (notification.id() == kNotificationId)
return notification.title();
}
return base::string16();
}
media_router::MediaSinksObserver* media_sinks_observer() const {
......@@ -189,7 +168,6 @@ IN_PROC_BROWSER_TEST_F(SystemTrayTrayCastMediaRouterChromeOSTest,
media_sinks_observer()->OnSinksUpdated(two_sinks, std::vector<url::Origin>());
content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsTrayVisible());
EXPECT_TRUE(IsTraySelectViewVisible());
// And if all of the sinks go away, it should be hidden again.
media_sinks_observer()->OnSinksUpdated(zero_sinks,
......
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