OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/toolbar/mock_component_toolbar_actions_factory.h" |
| 6 |
| 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/toolbar/test_toolbar_action_view_controller.h" |
| 9 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
| 10 |
| 11 MockComponentToolbarActionsFactory::MockComponentToolbarActionsFactory( |
| 12 Browser* browser) { |
| 13 ComponentToolbarActionsFactory::SetTestingFactory(this); |
| 14 |
| 15 ScopedVector<ToolbarActionViewController> actions = |
| 16 GetComponentToolbarActions(browser); |
| 17 for (auto it = actions.begin(); it != actions.end(); ++it) { |
| 18 action_ids_.push_back((*it)->GetId()); |
| 19 } |
| 20 } |
| 21 |
| 22 MockComponentToolbarActionsFactory::~MockComponentToolbarActionsFactory() { |
| 23 ComponentToolbarActionsFactory::SetTestingFactory(nullptr); |
| 24 } |
| 25 |
| 26 ScopedVector<ToolbarActionViewController> |
| 27 MockComponentToolbarActionsFactory::GetComponentToolbarActions( |
| 28 Browser* browser) { |
| 29 ScopedVector<ToolbarActionViewController> component_actions; |
| 30 TestToolbarActionViewController* action = |
| 31 new TestToolbarActionViewController( |
| 32 ComponentToolbarActionsFactory::kMockActionId); |
| 33 component_actions.push_back(action); |
| 34 return component_actions.Pass(); |
| 35 } |
OLD | NEW |