OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "chrome/browser/extensions/browser_action_test_util.h" | 11 #include "chrome/browser/extensions/browser_action_test_util.h" |
12 #include "chrome/browser/extensions/extension_apitest.h" | 12 #include "chrome/browser/extensions/extension_apitest.h" |
13 #include "chrome/browser/extensions/extension_browser_event_router.h" | 13 #include "chrome/browser/extensions/extension_browser_event_router.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/extensions/extension_tabs_module.h" | 15 #include "chrome/browser/extensions/extension_tabs_module.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/common/chrome_notification_types.h" |
19 #include "chrome/common/extensions/extension_action.h" | 20 #include "chrome/common/extensions/extension_action.h" |
20 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
21 #include "chrome/test/ui_test_utils.h" | 22 #include "chrome/test/ui_test_utils.h" |
22 #include "content/browser/tab_contents/tab_contents.h" | 23 #include "content/browser/tab_contents/tab_contents.h" |
23 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
24 #include "ui/gfx/size.h" | 25 #include "ui/gfx/size.h" |
25 | 26 |
26 class BrowserActionApiTest : public ExtensionApiTest { | 27 class BrowserActionApiTest : public ExtensionApiTest { |
27 public: | 28 public: |
28 BrowserActionApiTest() {} | 29 BrowserActionApiTest() {} |
29 virtual ~BrowserActionApiTest() {} | 30 virtual ~BrowserActionApiTest() {} |
30 | 31 |
31 protected: | 32 protected: |
32 BrowserActionTestUtil GetBrowserActionsBar() { | 33 BrowserActionTestUtil GetBrowserActionsBar() { |
33 return BrowserActionTestUtil(browser()); | 34 return BrowserActionTestUtil(browser()); |
34 } | 35 } |
35 | 36 |
36 bool OpenPopup(int index) { | 37 bool OpenPopup(int index) { |
37 ResultCatcher catcher; | 38 ResultCatcher catcher; |
38 GetBrowserActionsBar().Press(index); | 39 GetBrowserActionsBar().Press(index); |
39 ui_test_utils::WaitForNotification( | 40 ui_test_utils::WaitForNotification( |
40 NotificationType::EXTENSION_POPUP_VIEW_READY); | 41 chrome::NOTIFICATION_EXTENSION_POPUP_VIEW_READY); |
41 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 42 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
42 return GetBrowserActionsBar().HasPopup(); | 43 return GetBrowserActionsBar().HasPopup(); |
43 } | 44 } |
44 }; | 45 }; |
45 | 46 |
46 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, Basic) { | 47 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, Basic) { |
47 ASSERT_TRUE(test_server()->Start()); | 48 ASSERT_TRUE(test_server()->Start()); |
48 ASSERT_TRUE(RunExtensionTest("browser_action/basics")) << message_; | 49 ASSERT_TRUE(RunExtensionTest("browser_action/basics")) << message_; |
49 const Extension* extension = GetSingleLoadedExtension(); | 50 const Extension* extension = GetSingleLoadedExtension(); |
50 ASSERT_TRUE(extension) << message_; | 51 ASSERT_TRUE(extension) << message_; |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 service->toolbar_model()->MoveBrowserAction( | 372 service->toolbar_model()->MoveBrowserAction( |
372 service->extensions()->at(size_before + 1), 1); | 373 service->extensions()->at(size_before + 1), 1); |
373 | 374 |
374 EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0)); | 375 EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0)); |
375 EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1)); | 376 EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1)); |
376 EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(2)); | 377 EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(2)); |
377 | 378 |
378 EXPECT_EQ(kTooltipC, incognito_bar.GetTooltip(0)); | 379 EXPECT_EQ(kTooltipC, incognito_bar.GetTooltip(0)); |
379 EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1)); | 380 EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1)); |
380 } | 381 } |
OLD | NEW |