| OLD | NEW |
| 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 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 ToolbarActionsModel* toolbar_model = extensions::extension_action_test_util:: | 1254 ToolbarActionsModel* toolbar_model = extensions::extension_action_test_util:: |
| 1255 CreateToolbarModelForProfileWithoutWaitingForReady(profile()); | 1255 CreateToolbarModelForProfileWithoutWaitingForReady(profile()); |
| 1256 ToolbarActionsModelTestObserver model_observer(toolbar_model); | 1256 ToolbarActionsModelTestObserver model_observer(toolbar_model); |
| 1257 | 1257 |
| 1258 EXPECT_TRUE(AddBrowserActionExtensions()); | 1258 EXPECT_TRUE(AddBrowserActionExtensions()); |
| 1259 | 1259 |
| 1260 // Since the model hasn't been initialized (the ExtensionSystem::ready task | 1260 // Since the model hasn't been initialized (the ExtensionSystem::ready task |
| 1261 // hasn't been run), there should be no insertion notifications. | 1261 // hasn't been run), there should be no insertion notifications. |
| 1262 EXPECT_EQ(0u, model_observer.inserted_count()); | 1262 EXPECT_EQ(0u, model_observer.inserted_count()); |
| 1263 EXPECT_EQ(0u, model_observer.initialized_count()); | 1263 EXPECT_EQ(0u, model_observer.initialized_count()); |
| 1264 EXPECT_FALSE(toolbar_model->actions_initialized()); | 1264 EXPECT_FALSE(toolbar_model->ActionsInitialized()); |
| 1265 | 1265 |
| 1266 // Run the ready task. | 1266 // Run the ready task. |
| 1267 static_cast<extensions::TestExtensionSystem*>( | 1267 static_cast<extensions::TestExtensionSystem*>( |
| 1268 extensions::ExtensionSystem::Get(profile())) | 1268 extensions::ExtensionSystem::Get(profile())) |
| 1269 ->SetReady(); | 1269 ->SetReady(); |
| 1270 // Run tasks posted to TestExtensionSystem. | 1270 // Run tasks posted to TestExtensionSystem. |
| 1271 base::RunLoop().RunUntilIdle(); | 1271 base::RunLoop().RunUntilIdle(); |
| 1272 | 1272 |
| 1273 // We should still have no insertions, but should have an initialized count. | 1273 // We should still have no insertions, but should have an initialized count. |
| 1274 EXPECT_TRUE(toolbar_model->actions_initialized()); | 1274 EXPECT_TRUE(toolbar_model->ActionsInitialized()); |
| 1275 EXPECT_EQ(0u, model_observer.inserted_count()); | 1275 EXPECT_EQ(0u, model_observer.inserted_count()); |
| 1276 EXPECT_EQ(1u, model_observer.initialized_count()); | 1276 EXPECT_EQ(1u, model_observer.initialized_count()); |
| 1277 } | 1277 } |
| 1278 | 1278 |
| 1279 // Check that the toolbar model correctly clears and reorders when it detects | 1279 // Check that the toolbar model correctly clears and reorders when it detects |
| 1280 // a preference change. | 1280 // a preference change. |
| 1281 TEST_F(ToolbarActionsModelUnitTest, ToolbarModelPrefChange) { | 1281 TEST_F(ToolbarActionsModelUnitTest, ToolbarModelPrefChange) { |
| 1282 Init(); | 1282 Init(); |
| 1283 | 1283 |
| 1284 ASSERT_TRUE(AddBrowserActionExtensions()); | 1284 ASSERT_TRUE(AddBrowserActionExtensions()); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 } | 1507 } |
| 1508 | 1508 |
| 1509 TEST_F(ToolbarActionsModelUnitTest, | 1509 TEST_F(ToolbarActionsModelUnitTest, |
| 1510 MigrationToExtensionWithoutExtensionActionRedesign) { | 1510 MigrationToExtensionWithoutExtensionActionRedesign) { |
| 1511 InitForMigrationTest(MigrationStatus::FEATURE_DISABLED_WITH_PREF_TRUE); | 1511 InitForMigrationTest(MigrationStatus::FEATURE_DISABLED_WITH_PREF_TRUE); |
| 1512 | 1512 |
| 1513 // Initialization re-enables the extension. | 1513 // Initialization re-enables the extension. |
| 1514 EXPECT_EQ(1u, num_toolbar_items()); | 1514 EXPECT_EQ(1u, num_toolbar_items()); |
| 1515 EXPECT_EQ(browser_action_migrated()->id(), GetActionIdAtIndex(0u)); | 1515 EXPECT_EQ(browser_action_migrated()->id(), GetActionIdAtIndex(0u)); |
| 1516 } | 1516 } |
| OLD | NEW |