| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_UI_TOOLBAR_MOCK_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_MOCK_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_MOCK_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_MOCK_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h" | 9 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h" |
| 10 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" | 10 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" |
| 11 | 11 |
| 12 class Browser; | 12 class Browser; |
| 13 | 13 |
| 14 // Mock class used to substitute ComponentToolbarActionsFactory in tests. | 14 // Mock class used to substitute ComponentToolbarActionsFactory in tests. |
| 15 class MockComponentToolbarActionsFactory | 15 class MockComponentToolbarActionsFactory |
| 16 : public ComponentToolbarActionsFactory { | 16 : public ComponentToolbarActionsFactory { |
| 17 public: | 17 public: |
| 18 static const char kActionIdForTesting[]; | 18 static const char kActionIdForTesting[]; |
| 19 | 19 |
| 20 explicit MockComponentToolbarActionsFactory(Browser* browser); | 20 explicit MockComponentToolbarActionsFactory(Browser* browser); |
| 21 ~MockComponentToolbarActionsFactory() override; | 21 ~MockComponentToolbarActionsFactory() override; |
| 22 | 22 |
| 23 // ComponentToolbarActionsFactory: | 23 // ComponentToolbarActionsFactory: |
| 24 std::set<std::string> GetInitialComponentIds(Profile* profile) override; | 24 std::set<std::string> GetInitialComponentIds(Profile* profile) override; |
| 25 std::unique_ptr<ToolbarActionViewController> GetComponentToolbarActionForId( | 25 std::unique_ptr<ToolbarActionViewController> GetComponentToolbarActionForId( |
| 26 const std::string& id, | 26 const std::string& id, |
| 27 Browser* browser, | 27 Browser* browser, |
| 28 ToolbarActionsBar* bar) override; | 28 ToolbarActionsBar* bar) override; |
| 29 | 29 |
| 30 void RegisterComponentMigrations( | |
| 31 extensions::ComponentMigrationHelper* helper) const override; | |
| 32 | |
| 33 void HandleComponentMigrations(extensions::ComponentMigrationHelper* helper, | |
| 34 Profile* profile) const override; | |
| 35 | |
| 36 void set_migrated_extension_id(const extensions::ExtensionId& extension_id) { | |
| 37 migrated_extension_id_ = extension_id; | |
| 38 } | |
| 39 | |
| 40 void set_migrated_feature_enabled(bool enabled) { | |
| 41 migrated_feature_enabled_ = enabled; | |
| 42 } | |
| 43 | |
| 44 private: | 30 private: |
| 45 extensions::ExtensionId migrated_extension_id_; | |
| 46 bool migrated_feature_enabled_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(MockComponentToolbarActionsFactory); | 31 DISALLOW_COPY_AND_ASSIGN(MockComponentToolbarActionsFactory); |
| 49 }; | 32 }; |
| 50 | 33 |
| 51 #endif // CHROME_BROWSER_UI_TOOLBAR_MOCK_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ | 34 #endif // CHROME_BROWSER_UI_TOOLBAR_MOCK_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ |
| OLD | NEW |