Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(959)

Unified Diff: chrome/browser/ui/toolbar/media_router_action_controller_unittest.cc

Issue 2410553002: Show Media Router toolbar icon ephemerally for MR dialogs (Closed)
Patch Set: Deleted the first patch set on accident, responded to Mark's comments inline below Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/toolbar/media_router_action_controller_unittest.cc
diff --git a/chrome/browser/ui/toolbar/media_router_action_controller_unittest.cc b/chrome/browser/ui/toolbar/media_router_action_controller_unittest.cc
index 6f25b895dd61e4b76709547829ab0b8f3b7a583f..26fdf0ffb9489c64a451c1f8b9c36ecf36cea8ac 100644
--- a/chrome/browser/ui/toolbar/media_router_action_controller_unittest.cc
+++ b/chrome/browser/ui/toolbar/media_router_action_controller_unittest.cc
@@ -137,7 +137,7 @@ class MediaRouterActionControllerUnitTest : public MediaRouterTest {
DISALLOW_COPY_AND_ASSIGN(MediaRouterActionControllerUnitTest);
};
-TEST_F(MediaRouterActionControllerUnitTest, EphemeralIcon) {
+TEST_F(MediaRouterActionControllerUnitTest, EphemeralIconForRoutesAndIssues) {
EXPECT_FALSE(ActionExists());
// Creating a local route should show the action icon.
@@ -172,6 +172,34 @@ TEST_F(MediaRouterActionControllerUnitTest, EphemeralIcon) {
EXPECT_FALSE(ActionExists());
}
+TEST_F(MediaRouterActionControllerUnitTest, EphemeralIconForDialog) {
+ EXPECT_FALSE(ActionExists());
+
+ // Showing a dialog should show the icon.
+ controller()->OnDialogShown();
+ EXPECT_TRUE(ActionExists());
+ // Showing and hiding a dialog shouldn't hide the icon as long as we have a
+ // positive number of dialogs.
+ controller()->OnDialogShown();
+ EXPECT_TRUE(ActionExists());
+ controller()->OnDialogHidden();
+ EXPECT_TRUE(ActionExists());
+ // When we have zero dialogs, the icon should be hidden.
+ controller()->OnDialogHidden();
+ EXPECT_FALSE(ActionExists());
+
+ controller()->OnDialogShown();
+ EXPECT_TRUE(ActionExists());
+ controller()->OnRoutesUpdated(local_display_route_list(),
+ empty_route_id_list());
+ // Hiding the dialog while there are local routes shouldn't hide the icon.
+ controller()->OnDialogHidden();
+ EXPECT_TRUE(ActionExists());
+ controller()->OnRoutesUpdated(non_local_display_route_list(),
+ empty_route_id_list());
+ EXPECT_FALSE(ActionExists());
+}
+
TEST_F(MediaRouterActionControllerUnitTest, ObserveAlwaysShowPrefChange) {
EXPECT_FALSE(ActionExists());

Powered by Google App Engine
This is Rietveld 408576698