| 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "chrome/browser/extensions/browser_action_test_util.h" | 7 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.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/test_toolbar_action_view_controller.h" | 10 #include "chrome/browser/ui/toolbar/test_toolbar_action_view_controller.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 // Even though the method says "ExtensionId", this actually refers to any id | 98 // Even though the method says "ExtensionId", this actually refers to any id |
| 99 // for the action. | 99 // for the action. |
| 100 EXPECT_EQ(kMockId, browser_actions_bar.GetExtensionId(0)); | 100 EXPECT_EQ(kMockId, browser_actions_bar.GetExtensionId(0)); |
| 101 | 101 |
| 102 // There should only have been one created component action. | 102 // There should only have been one created component action. |
| 103 const std::vector<std::string> action_ids = mock_factory()->action_ids(); | 103 const std::vector<std::string> action_ids = mock_factory()->action_ids(); |
| 104 ASSERT_EQ(1u, action_ids.size()); | 104 ASSERT_EQ(1u, action_ids.size()); |
| 105 | 105 |
| 106 const std::vector<ToolbarActionViewController*>& actions = | 106 const std::vector<ToolbarActionViewController*>& actions = |
| 107 browser_actions_bar.GetToolbarActionsBar()->toolbar_actions(); | 107 browser_actions_bar.GetToolbarActionsBar()->GetActions(); |
| 108 TestToolbarActionViewController* mock_component_action = | 108 TestToolbarActionViewController* mock_component_action = |
| 109 static_cast<TestToolbarActionViewController* const>(actions[0]); | 109 static_cast<TestToolbarActionViewController* const>(actions[0]); |
| 110 ASSERT_TRUE(mock_component_action); | 110 ASSERT_TRUE(mock_component_action); |
| 111 | 111 |
| 112 // Test that clicking on the component action works. | 112 // Test that clicking on the component action works. |
| 113 EXPECT_EQ(0, mock_component_action->execute_action_count()); | 113 EXPECT_EQ(0, mock_component_action->execute_action_count()); |
| 114 browser_actions_bar.Press(0); | 114 browser_actions_bar.Press(0); |
| 115 EXPECT_EQ(1, mock_component_action->execute_action_count()); | 115 EXPECT_EQ(1, mock_component_action->execute_action_count()); |
| 116 } | 116 } |
| OLD | NEW |