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

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

Issue 2260343002: Revert of Show the Cast toolbar icon ephemerally when Cast is in use (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 base::RunLoop().RunUntilIdle(); 1301 base::RunLoop().RunUntilIdle();
1302 1302
1303 // The new order should be reflected in the model. 1303 // The new order should be reflected in the model.
1304 EXPECT_EQ(browser_action_b()->id(), GetActionIdAtIndex(0)); 1304 EXPECT_EQ(browser_action_b()->id(), GetActionIdAtIndex(0));
1305 EXPECT_EQ(browser_action_c()->id(), GetActionIdAtIndex(1)); 1305 EXPECT_EQ(browser_action_c()->id(), GetActionIdAtIndex(1));
1306 EXPECT_EQ(browser_action_a()->id(), GetActionIdAtIndex(2)); 1306 EXPECT_EQ(browser_action_a()->id(), GetActionIdAtIndex(2));
1307 EXPECT_EQ(inserted_and_removed_difference, 1307 EXPECT_EQ(inserted_and_removed_difference,
1308 observer()->inserted_count() - observer()->removed_count()); 1308 observer()->inserted_count() - observer()->removed_count());
1309 } 1309 }
1310 1310
1311 TEST_F(ToolbarActionsModelUnitTest, ComponentExtensionsAddedToEnd) {
1312 Init();
1313
1314 ASSERT_TRUE(AddBrowserActionExtensions());
1315
1316 EXPECT_EQ(browser_action_a()->id(), GetActionIdAtIndex(0));
1317 EXPECT_EQ(browser_action_b()->id(), GetActionIdAtIndex(1));
1318 EXPECT_EQ(browser_action_c()->id(), GetActionIdAtIndex(2));
1319
1320 const char kName[] = "component";
1321 extensions::DictionaryBuilder manifest;
1322 manifest.Set("name", kName)
1323 .Set("description", "An extension")
1324 .Set("manifest_version", 2)
1325 .Set("version", "1.0.0")
1326 .Set("browser_action", extensions::DictionaryBuilder().Build());
1327 scoped_refptr<const extensions::Extension> component_extension =
1328 extensions::ExtensionBuilder()
1329 .SetManifest(manifest.Build())
1330 .SetID(crx_file::id_util::GenerateId(kName))
1331 .SetLocation(extensions::Manifest::COMPONENT)
1332 .Build();
1333 service()->AddExtension(component_extension.get());
1334
1335 EXPECT_EQ(component_extension.get()->id(), GetActionIdAtIndex(0));
1336 EXPECT_EQ(browser_action_a()->id(), GetActionIdAtIndex(1));
1337 EXPECT_EQ(browser_action_b()->id(), GetActionIdAtIndex(2));
1338 EXPECT_EQ(browser_action_c()->id(), GetActionIdAtIndex(3));
1339 }
1340
1311 // Test various different reorderings, removals, and reinsertions of the 1341 // Test various different reorderings, removals, and reinsertions of the
1312 // toolbar with component actions. 1342 // toolbar with component actions.
1313 TEST_F(ToolbarActionsModelUnitTest, 1343 TEST_F(ToolbarActionsModelUnitTest,
1314 ActionsToolbarReorderAndReinsertWithSwitchAndComponentActions) { 1344 ActionsToolbarReorderAndReinsertWithSwitchAndComponentActions) {
1315 extensions::FeatureSwitch::ScopedOverride enable_redesign( 1345 extensions::FeatureSwitch::ScopedOverride enable_redesign(
1316 extensions::FeatureSwitch::extension_action_redesign(), true); 1346 extensions::FeatureSwitch::extension_action_redesign(), true);
1317 SetMockActionsFactory(new MockComponentToolbarActionsFactory(nullptr)); 1347 SetMockActionsFactory(new MockComponentToolbarActionsFactory(nullptr));
1318 Init(); 1348 Init();
1319 1349
1320 // One component action was added when the model was initialized. 1350 // One component action was added when the model was initialized.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 } 1533 }
1504 1534
1505 TEST_F(ToolbarActionsModelUnitTest, 1535 TEST_F(ToolbarActionsModelUnitTest,
1506 MigrationToExtensionWithoutExtensionActionRedesign) { 1536 MigrationToExtensionWithoutExtensionActionRedesign) {
1507 InitForMigrationTest(MigrationStatus::FEATURE_DISABLED_WITH_PREF_TRUE); 1537 InitForMigrationTest(MigrationStatus::FEATURE_DISABLED_WITH_PREF_TRUE);
1508 1538
1509 // Initialization re-enables the extension. 1539 // Initialization re-enables the extension.
1510 EXPECT_EQ(1u, num_toolbar_items()); 1540 EXPECT_EQ(1u, num_toolbar_items());
1511 EXPECT_EQ(browser_action_migrated()->id(), GetActionIdAtIndex(0u)); 1541 EXPECT_EQ(browser_action_migrated()->id(), GetActionIdAtIndex(0u));
1512 } 1542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698