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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc

Issue 2307803002: [Media Router] Enable MR by default now that it is at 100% in stable. (Closed)
Patch Set: Add MR FeatureSwitch to failing test cases Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" 5 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 EXPECT_EQ(num_toolbar_items(), toolbar_model()->visible_icon_count()); 895 EXPECT_EQ(num_toolbar_items(), toolbar_model()->visible_icon_count());
896 toolbar_model()->OnActionToolbarPrefChange(); 896 toolbar_model()->OnActionToolbarPrefChange();
897 // Should still be at max size. 897 // Should still be at max size.
898 EXPECT_TRUE(toolbar_model()->all_icons_visible()); 898 EXPECT_TRUE(toolbar_model()->all_icons_visible());
899 EXPECT_EQ(num_toolbar_items(), toolbar_model()->visible_icon_count()); 899 EXPECT_EQ(num_toolbar_items(), toolbar_model()->visible_icon_count());
900 } 900 }
901 901
902 // Test that, in the absence of the extension-action-redesign switch, the 902 // Test that, in the absence of the extension-action-redesign switch, the
903 // model only contains extensions with browser actions and component actions. 903 // model only contains extensions with browser actions and component actions.
904 TEST_F(ToolbarActionsModelUnitTest, TestToolbarExtensionTypesDisabledSwitch) { 904 TEST_F(ToolbarActionsModelUnitTest, TestToolbarExtensionTypesDisabledSwitch) {
905 // Disable Media Router first, since Extension Action Redesign would be force
906 // enabled otherwise.
907 extensions::FeatureSwitch::ScopedOverride enable_media_router(
908 extensions::FeatureSwitch::media_router(), false);
905 extensions::FeatureSwitch::ScopedOverride enable_redesign( 909 extensions::FeatureSwitch::ScopedOverride enable_redesign(
906 extensions::FeatureSwitch::extension_action_redesign(), false); 910 extensions::FeatureSwitch::extension_action_redesign(), false);
907 Init(); 911 Init();
908 ASSERT_TRUE(AddActionExtensions()); 912 ASSERT_TRUE(AddActionExtensions());
909 913
910 EXPECT_EQ(1u, num_toolbar_items()); 914 EXPECT_EQ(1u, num_toolbar_items());
911 EXPECT_EQ(browser_action()->id(), GetActionIdAtIndex(0u)); 915 EXPECT_EQ(browser_action()->id(), GetActionIdAtIndex(0u));
912 } 916 }
913 917
914 // Test that, with the extension-action-redesign switch, the model contains 918 // Test that, with the extension-action-redesign switch, the model contains
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 extensions::extension_action_test_util::NO_ACTION, 967 extensions::extension_action_test_util::NO_ACTION,
964 extensions::Manifest::INTERNAL); 968 extensions::Manifest::INTERNAL);
965 EXPECT_TRUE(AddExtension(internal_extension_no_action.get())); 969 EXPECT_TRUE(AddExtension(internal_extension_no_action.get()));
966 EXPECT_EQ(4u, num_toolbar_items()); 970 EXPECT_EQ(4u, num_toolbar_items());
967 EXPECT_TRUE(ModelHasActionForId(internal_extension_no_action->id())); 971 EXPECT_TRUE(ModelHasActionForId(internal_extension_no_action->id()));
968 } 972 }
969 973
970 // Test that hiding actions on the toolbar results in their removal from the 974 // Test that hiding actions on the toolbar results in their removal from the
971 // model when the redesign switch is not enabled. 975 // model when the redesign switch is not enabled.
972 TEST_F(ToolbarActionsModelUnitTest, ActionsToolbarActionsVisibilityNoSwitch) { 976 TEST_F(ToolbarActionsModelUnitTest, ActionsToolbarActionsVisibilityNoSwitch) {
977 // Disable Media Router first, since Extension Action Redesign would be force
978 // enabled otherwise.
979 extensions::FeatureSwitch::ScopedOverride enable_media_router(
980 extensions::FeatureSwitch::media_router(), false);
973 extensions::FeatureSwitch::ScopedOverride enable_redesign( 981 extensions::FeatureSwitch::ScopedOverride enable_redesign(
974 extensions::FeatureSwitch::extension_action_redesign(), false); 982 extensions::FeatureSwitch::extension_action_redesign(), false);
975 Init(); 983 Init();
976 984
977 extensions::ExtensionActionAPI* action_api = 985 extensions::ExtensionActionAPI* action_api =
978 extensions::ExtensionActionAPI::Get(profile()); 986 extensions::ExtensionActionAPI::Get(profile());
979 987
980 ASSERT_TRUE(AddBrowserActionExtensions()); 988 ASSERT_TRUE(AddBrowserActionExtensions());
981 // Sanity check: Order should start as A , B, C. 989 // Sanity check: Order should start as A , B, C.
982 EXPECT_EQ(3u, num_toolbar_items()); 990 EXPECT_EQ(3u, num_toolbar_items());
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 } 1541 }
1534 1542
1535 TEST_F(ToolbarActionsModelUnitTest, 1543 TEST_F(ToolbarActionsModelUnitTest,
1536 MigrationToExtensionWithoutExtensionActionRedesign) { 1544 MigrationToExtensionWithoutExtensionActionRedesign) {
1537 InitForMigrationTest(MigrationStatus::FEATURE_DISABLED_WITH_PREF_TRUE); 1545 InitForMigrationTest(MigrationStatus::FEATURE_DISABLED_WITH_PREF_TRUE);
1538 1546
1539 // Initialization re-enables the extension. 1547 // Initialization re-enables the extension.
1540 EXPECT_EQ(1u, num_toolbar_items()); 1548 EXPECT_EQ(1u, num_toolbar_items());
1541 EXPECT_EQ(browser_action_migrated()->id(), GetActionIdAtIndex(0u)); 1549 EXPECT_EQ(browser_action_migrated()->id(), GetActionIdAtIndex(0u));
1542 } 1550 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698