OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/toolbar/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
6 | 6 |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 8 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
9 #include "chrome/browser/extensions/browser_action_test_util.h" | 9 #include "chrome/browser/extensions/browser_action_test_util.h" |
10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // Make sure extension with index |extension_index| has an icon. | 36 // Make sure extension with index |extension_index| has an icon. |
37 void EnsureExtensionHasIcon(int extension_index) { | 37 void EnsureExtensionHasIcon(int extension_index) { |
38 if (!browser_actions_bar_->HasIcon(extension_index)) { | 38 if (!browser_actions_bar_->HasIcon(extension_index)) { |
39 // The icon is loaded asynchronously and a notification is then sent to | 39 // The icon is loaded asynchronously and a notification is then sent to |
40 // observers. So we wait on it. | 40 // observers. So we wait on it. |
41 ExtensionAction* browser_action = | 41 ExtensionAction* browser_action = |
42 browser_actions_bar_->GetExtensionAction(extension_index); | 42 browser_actions_bar_->GetExtensionAction(extension_index); |
43 | 43 |
44 content::WindowedNotificationObserver observer( | 44 content::WindowedNotificationObserver observer( |
45 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, | 45 extensions::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, |
46 content::Source<ExtensionAction>(browser_action)); | 46 content::Source<ExtensionAction>(browser_action)); |
47 observer.Wait(); | 47 observer.Wait(); |
48 } | 48 } |
49 EXPECT_TRUE(browser_actions_bar()->HasIcon(extension_index)); | 49 EXPECT_TRUE(browser_actions_bar()->HasIcon(extension_index)); |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 scoped_ptr<BrowserActionTestUtil> browser_actions_bar_; | 53 scoped_ptr<BrowserActionTestUtil> browser_actions_bar_; |
54 }; | 54 }; |
55 | 55 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 action_view = container->GetBrowserActionViewAt(0); | 242 action_view = container->GetBrowserActionViewAt(0); |
243 EXPECT_FALSE(container->CanStartDragForView(action_view, point, point)); | 243 EXPECT_FALSE(container->CanStartDragForView(action_view, point, point)); |
244 | 244 |
245 // We should go back to normal after leaving highlight mode. | 245 // We should go back to normal after leaving highlight mode. |
246 model->StopHighlighting(); | 246 model->StopHighlighting(); |
247 EXPECT_EQ(3, browser_actions_bar()->VisibleBrowserActions()); | 247 EXPECT_EQ(3, browser_actions_bar()->VisibleBrowserActions()); |
248 EXPECT_EQ(3, browser_actions_bar()->NumberOfBrowserActions()); | 248 EXPECT_EQ(3, browser_actions_bar()->NumberOfBrowserActions()); |
249 action_view = container->GetBrowserActionViewAt(0); | 249 action_view = container->GetBrowserActionViewAt(0); |
250 EXPECT_TRUE(container->CanStartDragForView(action_view, point, point)); | 250 EXPECT_TRUE(container->CanStartDragForView(action_view, point, point)); |
251 } | 251 } |
OLD | NEW |