Commit aeb1a905 authored by Andre Le's avatar Andre Le Committed by Commit Bot

[CrOS PhoneHub] Adjust hotspot states and add notification when failure.

- Change the states in enable hotspot to fit new design.
- Add a notification when enable hotspot fails.

BUG=1106937,1126208

Change-Id: Id9092649d5cfcee9f6153c74a258b869a81f89dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495621
Commit-Queue: Andre Le <leandre@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarTim Song <tengs@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821374}
parent addcf77e
...@@ -1121,6 +1121,12 @@ This file contains the strings for ash. ...@@ -1121,6 +1121,12 @@ This file contains the strings for ash.
<message name="IDS_ASH_PHONE_HUB_NOTIFICATION_OPT_IN_DISMISS_BUTTON" desc="Label for the dismiss button to opt out showing notifications from the phone."> <message name="IDS_ASH_PHONE_HUB_NOTIFICATION_OPT_IN_DISMISS_BUTTON" desc="Label for the dismiss button to opt out showing notifications from the phone.">
Dismiss Dismiss
</message> </message>
<message name="IDS_ASH_PHONE_HUB_NOTIFICATION_HOTSPOT_FAILED_TITLE" desc="Title inside a PhoneHub notification when enable hotspot failed to find a connection.">
Hotspot connection failed
</message>
<message name="IDS_ASH_PHONE_HUB_NOTIFICATION_HOTSPOT_FAILED_MESSAGE" desc="Message inside a PhoneHub notification when enable hotspot failed to find a connection.">
Tap to configure
</message>
<message name="IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_ACTION" desc="Title of the capture region action in the stylus tools (a pop-up panel next to the status tray). This causes a partial screenshot to be taken (the user selects an area of the screen to take a screenshot of)."> <message name="IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_ACTION" desc="Title of the capture region action in the stylus tools (a pop-up panel next to the status tray). This causes a partial screenshot to be taken (the user selects an area of the screen to take a screenshot of).">
Capture region Capture region
......
c5de29f1206bf408d71a64fe5e18efbe426c4427
\ No newline at end of file
c5de29f1206bf408d71a64fe5e18efbe426c4427
\ No newline at end of file
...@@ -54,6 +54,9 @@ class ASH_PUBLIC_EXPORT SystemTrayClient { ...@@ -54,6 +54,9 @@ class ASH_PUBLIC_EXPORT SystemTrayClient {
// Shows settings related to MultiDevice features. // Shows settings related to MultiDevice features.
virtual void ShowConnectedDevicesSettings() = 0; virtual void ShowConnectedDevicesSettings() = 0;
// Shows settings related to tether network.
virtual void ShowTetherNetworkSettings() = 0;
// Shows the about chrome OS page and checks for updates after the page is // Shows the about chrome OS page and checks for updates after the page is
// loaded. // loaded.
virtual void ShowAboutChromeOS() = 0; virtual void ShowAboutChromeOS() = 0;
......
...@@ -38,6 +38,8 @@ void TestSystemTrayClient::ShowConnectedDevicesSettings() { ...@@ -38,6 +38,8 @@ void TestSystemTrayClient::ShowConnectedDevicesSettings() {
show_connected_devices_settings_count_++; show_connected_devices_settings_count_++;
} }
void TestSystemTrayClient::ShowTetherNetworkSettings() {}
void TestSystemTrayClient::ShowAboutChromeOS() {} void TestSystemTrayClient::ShowAboutChromeOS() {}
void TestSystemTrayClient::ShowHelp() {} void TestSystemTrayClient::ShowHelp() {}
......
...@@ -31,6 +31,7 @@ class ASH_PUBLIC_EXPORT TestSystemTrayClient : public SystemTrayClient { ...@@ -31,6 +31,7 @@ class ASH_PUBLIC_EXPORT TestSystemTrayClient : public SystemTrayClient {
void ShowChromeSlow() override; void ShowChromeSlow() override;
void ShowIMESettings() override; void ShowIMESettings() override;
void ShowConnectedDevicesSettings() override; void ShowConnectedDevicesSettings() override;
void ShowTetherNetworkSettings() override;
void ShowAboutChromeOS() override; void ShowAboutChromeOS() override;
void ShowHelp() override; void ShowHelp() override;
void ShowAccessibilityHelp() override; void ShowAccessibilityHelp() override;
......
...@@ -129,7 +129,7 @@ void SystemTrayModel::SetPhoneHubManager( ...@@ -129,7 +129,7 @@ void SystemTrayModel::SetPhoneHubManager(
Shell::Get() Shell::Get()
->message_center_controller() ->message_center_controller()
->phone_hub_notification_controller() ->phone_hub_notification_controller()
->SetManager(phone_hub_manager->GetNotificationManager()); ->SetManager(phone_hub_manager);
} }
} // namespace ash } // namespace ash
...@@ -48,10 +48,9 @@ void EnableHotspotQuickActionController::OnTetherStatusChanged() { ...@@ -48,10 +48,9 @@ void EnableHotspotQuickActionController::OnTetherStatusChanged() {
item_->SetVisible(false); item_->SetVisible(false);
return; return;
case Status::kConnectionUnavailable: case Status::kConnectionUnavailable:
SetState(ActionState::kNotAvailable); FALLTHROUGH;
break;
case Status::kConnectionAvailable: case Status::kConnectionAvailable:
SetState(ActionState::kNotConnected); SetState(ActionState::kOff);
break; break;
case Status::kConnecting: case Status::kConnecting:
SetState(ActionState::kConnecting); SetState(ActionState::kConnecting);
...@@ -70,17 +69,10 @@ void EnableHotspotQuickActionController::SetState(ActionState state) { ...@@ -70,17 +69,10 @@ void EnableHotspotQuickActionController::SetState(ActionState state) {
int state_text_id; int state_text_id;
int sub_label_text; int sub_label_text;
switch (state) { switch (state) {
case ActionState::kNotAvailable: case ActionState::kOff:
icon_enabled = false;
state_text_id =
IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE_TOOLTIP;
sub_label_text = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_AVAILABLE_STATE;
break;
case ActionState::kNotConnected:
icon_enabled = false; icon_enabled = false;
state_text_id = state_text_id = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_DISABLED_STATE_TOOLTIP;
IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_CONNECTED_STATE_TOOLTIP; sub_label_text = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_OFF_STATE;
sub_label_text = IDS_ASH_PHONE_HUB_QUICK_ACTIONS_NOT_CONNECTED_STATE;
break; break;
case ActionState::kConnecting: case ActionState::kConnecting:
icon_enabled = true; icon_enabled = true;
......
...@@ -33,12 +33,7 @@ class EnableHotspotQuickActionController ...@@ -33,12 +33,7 @@ class EnableHotspotQuickActionController
private: private:
// All the possible states that the enable hotspot button can be viewed. Each // All the possible states that the enable hotspot button can be viewed. Each
// state has a corresponding icon, labels and tooltip view. // state has a corresponding icon, labels and tooltip view.
enum class ActionState { enum class ActionState { kOff, kConnecting, kConnected };
kNotAvailable,
kNotConnected,
kConnecting,
kConnected
};
// Set the item (including icon, label and tooltips) to a certain state. // Set the item (including icon, label and tooltips) to a certain state.
void SetState(ActionState state); void SetState(ActionState state);
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
#include "ash/system/phonehub/phone_hub_notification_controller.h" #include "ash/system/phonehub/phone_hub_notification_controller.h"
#include "ash/public/cpp/notification_utils.h"
#include "ash/public/cpp/system_tray_client.h" #include "ash/public/cpp/system_tray_client.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/system/model/system_tray_model.h" #include "ash/system/model/system_tray_model.h"
...@@ -16,6 +18,7 @@ ...@@ -16,6 +18,7 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "chromeos/components/phonehub/notification.h" #include "chromeos/components/phonehub/notification.h"
#include "chromeos/components/phonehub/phone_hub_manager.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/message_center/message_center.h" #include "ui/message_center/message_center.h"
...@@ -32,6 +35,8 @@ namespace { ...@@ -32,6 +35,8 @@ namespace {
const char kNotifierId[] = "chrome://phonehub"; const char kNotifierId[] = "chrome://phonehub";
const char kNotifierIdSeparator[] = "-"; const char kNotifierIdSeparator[] = "-";
const char kNotificationCustomViewType[] = "phonehub"; const char kNotificationCustomViewType[] = "phonehub";
const char kPhoneHubInstantTetherNotificationId[] =
"chrome://phonehub-instant-tether";
const int kReplyButtonIndex = 0; const int kReplyButtonIndex = 0;
// The amount of time the reply button is disabled after sending an inline // The amount of time the reply button is disabled after sending an inline
...@@ -189,18 +194,33 @@ PhoneHubNotificationController::PhoneHubNotificationController() { ...@@ -189,18 +194,33 @@ PhoneHubNotificationController::PhoneHubNotificationController() {
PhoneHubNotificationController::~PhoneHubNotificationController() { PhoneHubNotificationController::~PhoneHubNotificationController() {
if (manager_) if (manager_)
manager_->RemoveObserver(this); manager_->RemoveObserver(this);
if (tether_controller_)
tether_controller_->RemoveObserver(this);
} }
void PhoneHubNotificationController::SetManager( void PhoneHubNotificationController::SetManager(
chromeos::phonehub::NotificationManager* manager) { chromeos::phonehub::PhoneHubManager* phone_hub_manager) {
if (manager_ == manager) chromeos::phonehub::NotificationManager* notification_manager =
phone_hub_manager->GetNotificationManager();
chromeos::phonehub::TetherController* tether_controller =
phone_hub_manager->GetTetherController();
if (manager_ == notification_manager &&
tether_controller_ == tether_controller) {
return; return;
}
if (manager_) if (manager_)
manager_->RemoveObserver(this); manager_->RemoveObserver(this);
manager_ = manager; manager_ = notification_manager;
manager_->AddObserver(this); manager_->AddObserver(this);
if (tether_controller_)
tether_controller_->RemoveObserver(this);
tether_controller_ = tether_controller;
tether_controller_->AddObserver(this);
} }
void PhoneHubNotificationController::OnNotificationsAdded( void PhoneHubNotificationController::OnNotificationsAdded(
...@@ -228,6 +248,42 @@ void PhoneHubNotificationController::OnNotificationsRemoved( ...@@ -228,6 +248,42 @@ void PhoneHubNotificationController::OnNotificationsRemoved(
} }
} }
void PhoneHubNotificationController::OnAttemptConnectionScanFailed() {
// Add a notification if tether failed.
scoped_refptr<message_center::NotificationDelegate> delegate =
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
base::BindRepeating([](base::Optional<int> button_index) {
// When clicked, open Tether Settings page if we can open WebUI
// settings, otherwise do nothing.
if (TrayPopupUtils::CanOpenWebUISettings()) {
Shell::Get()
->system_tray_model()
->client()
->ShowTetherNetworkSettings();
} else {
LOG(WARNING) << "Cannot open Tether Settings since it's not "
"possible to opening WebUI settings";
}
}));
std::unique_ptr<message_center::Notification> notification =
CreateSystemNotification(
message_center::NOTIFICATION_TYPE_SIMPLE,
kPhoneHubInstantTetherNotificationId,
l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_NOTIFICATION_HOTSPOT_FAILED_TITLE),
l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_NOTIFICATION_HOTSPOT_FAILED_MESSAGE),
base::string16() /*display_source */, GURL() /* origin_url */,
message_center::NotifierId(
message_center::NotifierType::SYSTEM_COMPONENT,
kPhoneHubInstantTetherNotificationId),
message_center::RichNotificationData(), std::move(delegate),
kPhoneHubEnableHotspotOnIcon,
message_center::SystemNotificationWarningLevel::NORMAL);
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
void PhoneHubNotificationController::OpenSettings() { void PhoneHubNotificationController::OpenSettings() {
DCHECK(TrayPopupUtils::CanOpenWebUISettings()); DCHECK(TrayPopupUtils::CanOpenWebUISettings());
Shell::Get()->system_tray_model()->client()->ShowConnectedDevicesSettings(); Shell::Get()->system_tray_model()->client()->ShowConnectedDevicesSettings();
......
...@@ -9,10 +9,12 @@ ...@@ -9,10 +9,12 @@
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "chromeos/components/phonehub/notification_manager.h" #include "chromeos/components/phonehub/notification_manager.h"
#include "chromeos/components/phonehub/tether_controller.h"
namespace chromeos { namespace chromeos {
namespace phonehub { namespace phonehub {
class Notification; class Notification;
class PhoneHubManager;
} // namespace phonehub } // namespace phonehub
} // namespace chromeos } // namespace chromeos
...@@ -26,7 +28,8 @@ namespace ash { ...@@ -26,7 +28,8 @@ namespace ash {
// This controller creates and manages a message_center::Notification for each // This controller creates and manages a message_center::Notification for each
// PhoneHub corresponding notification. // PhoneHub corresponding notification.
class ASH_EXPORT PhoneHubNotificationController class ASH_EXPORT PhoneHubNotificationController
: public chromeos::phonehub::NotificationManager::Observer { : public chromeos::phonehub::NotificationManager::Observer,
public chromeos::phonehub::TetherController::Observer {
public: public:
PhoneHubNotificationController(); PhoneHubNotificationController();
~PhoneHubNotificationController() override; ~PhoneHubNotificationController() override;
...@@ -37,7 +40,7 @@ class ASH_EXPORT PhoneHubNotificationController ...@@ -37,7 +40,7 @@ class ASH_EXPORT PhoneHubNotificationController
// Sets the NotifictionManager that provides the underlying PhoneHub // Sets the NotifictionManager that provides the underlying PhoneHub
// notifications. // notifications.
void SetManager(chromeos::phonehub::NotificationManager* manager); void SetManager(chromeos::phonehub::PhoneHubManager* phone_hub_manager);
private: private:
FRIEND_TEST_ALL_PREFIXES(PhoneHubNotificationControllerTest, FRIEND_TEST_ALL_PREFIXES(PhoneHubNotificationControllerTest,
...@@ -53,6 +56,10 @@ class ASH_EXPORT PhoneHubNotificationController ...@@ -53,6 +56,10 @@ class ASH_EXPORT PhoneHubNotificationController
void OnNotificationsRemoved( void OnNotificationsRemoved(
const base::flat_set<int64_t>& notification_ids) override; const base::flat_set<int64_t>& notification_ids) override;
// chromeos::phonehub::TetherController::Observer:
void OnAttemptConnectionScanFailed() override;
void OnTetherStatusChanged() override {}
// Callbacks for user interactions. // Callbacks for user interactions.
void OpenSettings(); void OpenSettings();
void DismissNotification(int64_t notification_id); void DismissNotification(int64_t notification_id);
...@@ -75,6 +82,7 @@ class ASH_EXPORT PhoneHubNotificationController ...@@ -75,6 +82,7 @@ class ASH_EXPORT PhoneHubNotificationController
const message_center::Notification& notification); const message_center::Notification& notification);
chromeos::phonehub::NotificationManager* manager_ = nullptr; chromeos::phonehub::NotificationManager* manager_ = nullptr;
chromeos::phonehub::TetherController* tether_controller_ = nullptr;
std::unordered_map<int64_t, std::unique_ptr<NotificationDelegate>> std::unordered_map<int64_t, std::unique_ptr<NotificationDelegate>>
notification_map_; notification_map_;
}; };
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chromeos/components/phonehub/fake_notification_manager.h" #include "chromeos/components/phonehub/fake_notification_manager.h"
#include "chromeos/components/phonehub/fake_phone_hub_manager.h"
#include "chromeos/components/phonehub/notification.h" #include "chromeos/components/phonehub/notification.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
...@@ -69,7 +70,8 @@ class PhoneHubNotificationControllerTest : public AshTestBase { ...@@ -69,7 +70,8 @@ class PhoneHubNotificationControllerTest : public AshTestBase {
controller_ = Shell::Get() controller_ = Shell::Get()
->message_center_controller() ->message_center_controller()
->phone_hub_notification_controller(); ->phone_hub_notification_controller();
controller_->SetManager(&notification_manager_); controller_->SetManager(&phone_hub_manager_);
notification_manager_ = phone_hub_manager_.fake_notification_manager();
fake_notifications_.insert(CreateNotification(kPhoneHubNotificationId0)); fake_notifications_.insert(CreateNotification(kPhoneHubNotificationId0));
fake_notifications_.insert(CreateNotification(kPhoneHubNotificationId1)); fake_notifications_.insert(CreateNotification(kPhoneHubNotificationId1));
...@@ -79,14 +81,15 @@ class PhoneHubNotificationControllerTest : public AshTestBase { ...@@ -79,14 +81,15 @@ class PhoneHubNotificationControllerTest : public AshTestBase {
protected: protected:
base::test::ScopedFeatureList feature_list_; base::test::ScopedFeatureList feature_list_;
message_center::MessageCenter* message_center_; message_center::MessageCenter* message_center_;
chromeos::phonehub::FakeNotificationManager notification_manager_; chromeos::phonehub::FakePhoneHubManager phone_hub_manager_;
chromeos::phonehub::FakeNotificationManager* notification_manager_;
PhoneHubNotificationController* controller_; PhoneHubNotificationController* controller_;
base::flat_set<chromeos::phonehub::Notification> fake_notifications_; base::flat_set<chromeos::phonehub::Notification> fake_notifications_;
}; };
TEST_F(PhoneHubNotificationControllerTest, AddNotifications) { TEST_F(PhoneHubNotificationControllerTest, AddNotifications) {
EXPECT_FALSE(message_center_->NotificationCount()); EXPECT_FALSE(message_center_->NotificationCount());
notification_manager_.SetNotificationsInternal(fake_notifications_); notification_manager_->SetNotificationsInternal(fake_notifications_);
EXPECT_EQ(3u, message_center_->NotificationCount()); EXPECT_EQ(3u, message_center_->NotificationCount());
ASSERT_TRUE( ASSERT_TRUE(
...@@ -104,7 +107,7 @@ TEST_F(PhoneHubNotificationControllerTest, AddNotifications) { ...@@ -104,7 +107,7 @@ TEST_F(PhoneHubNotificationControllerTest, AddNotifications) {
TEST_F(PhoneHubNotificationControllerTest, UpdateNotifications) { TEST_F(PhoneHubNotificationControllerTest, UpdateNotifications) {
EXPECT_FALSE(message_center_->NotificationCount()); EXPECT_FALSE(message_center_->NotificationCount());
notification_manager_.SetNotificationsInternal(fake_notifications_); notification_manager_->SetNotificationsInternal(fake_notifications_);
EXPECT_EQ(3u, message_center_->NotificationCount()); EXPECT_EQ(3u, message_center_->NotificationCount());
auto* notification = auto* notification =
...@@ -123,7 +126,7 @@ TEST_F(PhoneHubNotificationControllerTest, UpdateNotifications) { ...@@ -123,7 +126,7 @@ TEST_F(PhoneHubNotificationControllerTest, UpdateNotifications) {
/*inline_reply_id=*/0, base::UTF8ToUTF16(kNewTitle), /*inline_reply_id=*/0, base::UTF8ToUTF16(kNewTitle),
base::UTF8ToUTF16(kNewTextContent)); base::UTF8ToUTF16(kNewTextContent));
notification_manager_.SetNotification(updated_notification); notification_manager_->SetNotification(updated_notification);
notification = notification =
message_center_->FindVisibleNotificationById(kCrOSNotificationId1); message_center_->FindVisibleNotificationById(kCrOSNotificationId1);
...@@ -133,26 +136,26 @@ TEST_F(PhoneHubNotificationControllerTest, UpdateNotifications) { ...@@ -133,26 +136,26 @@ TEST_F(PhoneHubNotificationControllerTest, UpdateNotifications) {
TEST_F(PhoneHubNotificationControllerTest, RemoveNotifications) { TEST_F(PhoneHubNotificationControllerTest, RemoveNotifications) {
EXPECT_FALSE(message_center_->NotificationCount()); EXPECT_FALSE(message_center_->NotificationCount());
notification_manager_.SetNotificationsInternal(fake_notifications_); notification_manager_->SetNotificationsInternal(fake_notifications_);
EXPECT_EQ(3u, message_center_->NotificationCount()); EXPECT_EQ(3u, message_center_->NotificationCount());
notification_manager_.RemoveNotification(kPhoneHubNotificationId0); notification_manager_->RemoveNotification(kPhoneHubNotificationId0);
EXPECT_EQ(2u, message_center_->NotificationCount()); EXPECT_EQ(2u, message_center_->NotificationCount());
EXPECT_FALSE( EXPECT_FALSE(
message_center_->FindVisibleNotificationById(kCrOSNotificationId0)); message_center_->FindVisibleNotificationById(kCrOSNotificationId0));
notification_manager_.RemoveNotificationsInternal(base::flat_set<int64_t>( notification_manager_->RemoveNotificationsInternal(base::flat_set<int64_t>(
{kPhoneHubNotificationId1, kPhoneHubNotificationId2})); {kPhoneHubNotificationId1, kPhoneHubNotificationId2}));
EXPECT_FALSE(message_center_->NotificationCount()); EXPECT_FALSE(message_center_->NotificationCount());
// Attempt removing the same notifications again and expect nothing to happen. // Attempt removing the same notifications again and expect nothing to happen.
notification_manager_.RemoveNotificationsInternal(base::flat_set<int64_t>( notification_manager_->RemoveNotificationsInternal(base::flat_set<int64_t>(
{kPhoneHubNotificationId1, kPhoneHubNotificationId2})); {kPhoneHubNotificationId1, kPhoneHubNotificationId2}));
EXPECT_FALSE(message_center_->NotificationCount()); EXPECT_FALSE(message_center_->NotificationCount());
} }
TEST_F(PhoneHubNotificationControllerTest, CloseByUser) { TEST_F(PhoneHubNotificationControllerTest, CloseByUser) {
notification_manager_.SetNotificationsInternal(fake_notifications_); notification_manager_->SetNotificationsInternal(fake_notifications_);
EXPECT_EQ(3u, message_center_->NotificationCount()); EXPECT_EQ(3u, message_center_->NotificationCount());
message_center_->RemoveNotification(kCrOSNotificationId0, /*by_user=*/true); message_center_->RemoveNotification(kCrOSNotificationId0, /*by_user=*/true);
...@@ -162,11 +165,11 @@ TEST_F(PhoneHubNotificationControllerTest, CloseByUser) { ...@@ -162,11 +165,11 @@ TEST_F(PhoneHubNotificationControllerTest, CloseByUser) {
EXPECT_EQ( EXPECT_EQ(
std::vector<int64_t>({kPhoneHubNotificationId0, kPhoneHubNotificationId1, std::vector<int64_t>({kPhoneHubNotificationId0, kPhoneHubNotificationId1,
kPhoneHubNotificationId2}), kPhoneHubNotificationId2}),
notification_manager_.dismissed_notification_ids()); notification_manager_->dismissed_notification_ids());
} }
TEST_F(PhoneHubNotificationControllerTest, InlineReply) { TEST_F(PhoneHubNotificationControllerTest, InlineReply) {
notification_manager_.SetNotificationsInternal(fake_notifications_); notification_manager_->SetNotificationsInternal(fake_notifications_);
const base::string16 kInlineReply0 = base::UTF8ToUTF16("inline reply 0"); const base::string16 kInlineReply0 = base::UTF8ToUTF16("inline reply 0");
const base::string16 kInlineReply1 = base::UTF8ToUTF16("inline reply 1"); const base::string16 kInlineReply1 = base::UTF8ToUTF16("inline reply 1");
...@@ -175,7 +178,7 @@ TEST_F(PhoneHubNotificationControllerTest, InlineReply) { ...@@ -175,7 +178,7 @@ TEST_F(PhoneHubNotificationControllerTest, InlineReply) {
message_center_->ClickOnNotificationButtonWithReply(kCrOSNotificationId1, 0, message_center_->ClickOnNotificationButtonWithReply(kCrOSNotificationId1, 0,
kInlineReply1); kInlineReply1);
auto inline_replies = notification_manager_.inline_replies(); auto inline_replies = notification_manager_->inline_replies();
EXPECT_EQ(kPhoneHubNotificationId0, inline_replies[0].notification_id); EXPECT_EQ(kPhoneHubNotificationId0, inline_replies[0].notification_id);
EXPECT_EQ(kInlineReply0, inline_replies[0].inline_reply_text); EXPECT_EQ(kInlineReply0, inline_replies[0].inline_reply_text);
EXPECT_EQ(kPhoneHubNotificationId1, inline_replies[1].notification_id); EXPECT_EQ(kPhoneHubNotificationId1, inline_replies[1].notification_id);
...@@ -183,7 +186,7 @@ TEST_F(PhoneHubNotificationControllerTest, InlineReply) { ...@@ -183,7 +186,7 @@ TEST_F(PhoneHubNotificationControllerTest, InlineReply) {
} }
TEST_F(PhoneHubNotificationControllerTest, ClickSettings) { TEST_F(PhoneHubNotificationControllerTest, ClickSettings) {
notification_manager_.SetNotificationsInternal(fake_notifications_); notification_manager_->SetNotificationsInternal(fake_notifications_);
EXPECT_TRUE( EXPECT_TRUE(
message_center_->FindVisibleNotificationById(kCrOSNotificationId0)); message_center_->FindVisibleNotificationById(kCrOSNotificationId0));
EXPECT_EQ(0, GetSystemTrayClient()->show_connected_devices_settings_count()); EXPECT_EQ(0, GetSystemTrayClient()->show_connected_devices_settings_count());
...@@ -217,7 +220,7 @@ TEST_F(PhoneHubNotificationControllerTest, NotificationDataAndImages) { ...@@ -217,7 +220,7 @@ TEST_F(PhoneHubNotificationControllerTest, NotificationDataAndImages) {
/*inline_reply_id=*/0, base::UTF8ToUTF16(kTitle), /*inline_reply_id=*/0, base::UTF8ToUTF16(kTitle),
base::UTF8ToUTF16(kTextContent), shared_image, contact_image); base::UTF8ToUTF16(kTextContent), shared_image, contact_image);
notification_manager_.SetNotification(fake_notification); notification_manager_->SetNotification(fake_notification);
auto* cros_notification = auto* cros_notification =
message_center_->FindVisibleNotificationById(kCrOSNotificationId0); message_center_->FindVisibleNotificationById(kCrOSNotificationId0);
...@@ -235,7 +238,7 @@ TEST_F(PhoneHubNotificationControllerTest, NotificationDataAndImages) { ...@@ -235,7 +238,7 @@ TEST_F(PhoneHubNotificationControllerTest, NotificationDataAndImages) {
} }
TEST_F(PhoneHubNotificationControllerTest, NotificationHasCustomViewType) { TEST_F(PhoneHubNotificationControllerTest, NotificationHasCustomViewType) {
notification_manager_.SetNotificationsInternal(fake_notifications_); notification_manager_->SetNotificationsInternal(fake_notifications_);
auto* notification = auto* notification =
message_center_->FindVisibleNotificationById(kCrOSNotificationId0); message_center_->FindVisibleNotificationById(kCrOSNotificationId0);
...@@ -244,7 +247,7 @@ TEST_F(PhoneHubNotificationControllerTest, NotificationHasCustomViewType) { ...@@ -244,7 +247,7 @@ TEST_F(PhoneHubNotificationControllerTest, NotificationHasCustomViewType) {
} }
TEST_F(PhoneHubNotificationControllerTest, ReplyBrieflyDisabled) { TEST_F(PhoneHubNotificationControllerTest, ReplyBrieflyDisabled) {
notification_manager_.SetNotificationsInternal(fake_notifications_); notification_manager_->SetNotificationsInternal(fake_notifications_);
auto* notification = auto* notification =
message_center_->FindVisibleNotificationById(kCrOSNotificationId0); message_center_->FindVisibleNotificationById(kCrOSNotificationId0);
......
...@@ -266,6 +266,11 @@ void SystemTrayClient::ShowConnectedDevicesSettings() { ...@@ -266,6 +266,11 @@ void SystemTrayClient::ShowConnectedDevicesSettings() {
chromeos::settings::mojom::kMultiDeviceFeaturesSubpagePath); chromeos::settings::mojom::kMultiDeviceFeaturesSubpagePath);
} }
void SystemTrayClient::ShowTetherNetworkSettings() {
ShowSettingsSubPageForActiveUser(
chromeos::settings::mojom::kMobileDataNetworksSubpagePath);
}
void SystemTrayClient::ShowAboutChromeOS() { void SystemTrayClient::ShowAboutChromeOS() {
// We always want to check for updates when showing the about page from the // We always want to check for updates when showing the about page from the
// Ash UI. // Ash UI.
......
...@@ -16,7 +16,7 @@ struct LocaleInfo; ...@@ -16,7 +16,7 @@ struct LocaleInfo;
class SystemTray; class SystemTray;
enum class LoginStatus; enum class LoginStatus;
enum class NotificationStyle; enum class NotificationStyle;
} } // namespace ash
// Handles method calls delegated back to chrome from ash. Also notifies ash of // Handles method calls delegated back to chrome from ash. Also notifies ash of
// relevant state changes in chrome. // relevant state changes in chrome.
...@@ -62,6 +62,7 @@ class SystemTrayClient : public ash::SystemTrayClient, ...@@ -62,6 +62,7 @@ class SystemTrayClient : public ash::SystemTrayClient,
void ShowChromeSlow() override; void ShowChromeSlow() override;
void ShowIMESettings() override; void ShowIMESettings() override;
void ShowConnectedDevicesSettings() override; void ShowConnectedDevicesSettings() override;
void ShowTetherNetworkSettings() override;
void ShowAboutChromeOS() override; void ShowAboutChromeOS() override;
void ShowHelp() override; void ShowHelp() override;
void ShowAccessibilityHelp() override; void ShowAccessibilityHelp() override;
......
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