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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.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/toolbar_action_view_controller.h" | 10 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
11 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
12 #include "chrome/browser/ui/views/toolbar/browser_action_view.h" | |
13 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 12 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 13 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" |
14 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 14 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "extensions/common/feature_switch.h" | 16 #include "extensions/common/feature_switch.h" |
17 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 const char kMockId[] = "mock_action"; | 22 const char kMockId[] = "mock_action"; |
23 | 23 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 // Test that Component Toolbar Actions appear in the browser actions container | 120 // Test that Component Toolbar Actions appear in the browser actions container |
121 // and can receive click events properly. | 121 // and can receive click events properly. |
122 IN_PROC_BROWSER_TEST_F(ComponentToolbarActionsBrowserTest, | 122 IN_PROC_BROWSER_TEST_F(ComponentToolbarActionsBrowserTest, |
123 ComponentToolbarActionsShowUpAndRespondToClicks) { | 123 ComponentToolbarActionsShowUpAndRespondToClicks) { |
124 BrowserActionsContainer* browser_actions_container = | 124 BrowserActionsContainer* browser_actions_container = |
125 BrowserView::GetBrowserViewForBrowser(browser()) | 125 BrowserView::GetBrowserViewForBrowser(browser()) |
126 ->toolbar()->browser_actions(); | 126 ->toolbar()->browser_actions(); |
127 | 127 |
128 // There should be only one component action view. | 128 // There should be only one component action view. |
129 ASSERT_EQ(1u, browser_actions_container->num_browser_actions()); | 129 ASSERT_EQ(1u, browser_actions_container->num_toolbar_actions()); |
130 | 130 |
131 BrowserActionView* view = | 131 ToolbarActionView* view = |
132 browser_actions_container->GetBrowserActionViewAt(0u); | 132 browser_actions_container->GetToolbarActionViewAt(0u); |
133 ASSERT_EQ(kMockId, view->view_controller()->GetId()); | 133 ASSERT_EQ(kMockId, view->view_controller()->GetId()); |
134 MockComponentAction* mock_component_action = | 134 MockComponentAction* mock_component_action = |
135 static_cast<MockComponentAction*>(view->view_controller()); | 135 static_cast<MockComponentAction*>(view->view_controller()); |
136 | 136 |
137 // Test that clicking on the component action works. | 137 // Test that clicking on the component action works. |
138 EXPECT_EQ(0u, mock_component_action->click_count()); | 138 EXPECT_EQ(0u, mock_component_action->click_count()); |
139 view->Activate(); | 139 view->Activate(); |
140 EXPECT_EQ(1u, mock_component_action->click_count()); | 140 EXPECT_EQ(1u, mock_component_action->click_count()); |
141 } | 141 } |
OLD | NEW |