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

Unified Diff: chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc

Issue 2744883002: Migrate the pref to always show the Cast icon (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc
diff --git a/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc b/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc
index b867e61ab8e4ccbc5f81c4088c2f6cf52faa5dbb..2960d191b64d786b004705759b3be1d2b9af2c42 100644
--- a/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc
+++ b/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc
@@ -7,6 +7,7 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/extensions/browser_action_test_util.h"
#include "chrome/browser/media/router/media_router_ui_service.h"
+#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
@@ -32,6 +33,11 @@
#include "content/public/test/test_utils.h"
#include "ui/views/widget/widget.h"
+namespace {
+constexpr char kToolbarMigratedComponentActionStatus[] =
+ "toolbar_migrated_component_action_status";
+}
+
namespace media_router {
class MediaRouterUIBrowserTest : public InProcessBrowserTest {
@@ -111,6 +117,18 @@ class MediaRouterUIBrowserTest : public InProcessBrowserTest {
->app_menu_button();
}
+ // Sets the old preference to show the toolbar action icon to |always_show|,
+ // and migrates the preference.
+ void MigrateToolbarIconPref(bool always_show) {
+ {
+ DictionaryPrefUpdate update(browser()->profile()->GetPrefs(),
+ kToolbarMigratedComponentActionStatus);
+ update->SetBoolean(ComponentToolbarActionsFactory::kMediaRouterActionId,
+ always_show);
+ }
+ chrome::MigrateObsoleteProfilePrefs(browser()->profile());
+ }
+
protected:
ToolbarActionsBar* toolbar_actions_bar_ = nullptr;
@@ -324,4 +342,17 @@ IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest,
EXPECT_TRUE(ActionExists());
}
+IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest, MigrateToolbarIconShownPref) {
+ MigrateToolbarIconPref(true);
+ EXPECT_TRUE(MediaRouterActionController::GetAlwaysShowActionPref(
+ browser()->profile()));
+}
+
+IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest,
+ MigrateToolbarIconUnshownPref) {
+ MigrateToolbarIconPref(false);
+ EXPECT_FALSE(MediaRouterActionController::GetAlwaysShowActionPref(
+ browser()->profile()));
+}
+
} // namespace media_router
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698