OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/browser_event_router.h" | 5 #include "chrome/browser/extensions/browser_event_router.h" |
6 #include "chrome/browser/extensions/extension_action.h" | 6 #include "chrome/browser/extensions/extension_action.h" |
7 #include "chrome/browser/extensions/extension_action_manager.h" | 7 #include "chrome/browser/extensions/extension_action_manager.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" |
10 #include "chrome/browser/extensions/location_bar_controller.h" | 11 #include "chrome/browser/extensions/location_bar_controller.h" |
11 #include "chrome/browser/extensions/tab_helper.h" | 12 #include "chrome/browser/extensions/tab_helper.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
15 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
18 #include "chrome/common/extensions/features/feature.h" | 19 #include "chrome/common/extensions/features/feature.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 ASSERT_TRUE(catcher.GetNextResult()); | 71 ASSERT_TRUE(catcher.GetNextResult()); |
71 } | 72 } |
72 | 73 |
73 // Test that we received the changes. | 74 // Test that we received the changes. |
74 EXPECT_EQ(GURL(extension->GetResourceURL("set_popup.html")), | 75 EXPECT_EQ(GURL(extension->GetResourceURL("set_popup.html")), |
75 script_badge->GetPopupUrl(tab_id)); | 76 script_badge->GetPopupUrl(tab_id)); |
76 | 77 |
77 { | 78 { |
78 // Simulate the script badge being clicked. | 79 // Simulate the script badge being clicked. |
79 ResultCatcher catcher; | 80 ResultCatcher catcher; |
80 ExtensionService* service = browser()->profile()->GetExtensionService(); | 81 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 82 browser()->profile())->extension_service(); |
81 service->browser_event_router()->ScriptBadgeExecuted( | 83 service->browser_event_router()->ScriptBadgeExecuted( |
82 browser()->profile(), *script_badge, tab_id); | 84 browser()->profile(), *script_badge, tab_id); |
83 EXPECT_TRUE(catcher.GetNextResult()); | 85 EXPECT_TRUE(catcher.GetNextResult()); |
84 } | 86 } |
85 | 87 |
86 { | 88 { |
87 ResultCatcher catcher; | 89 ResultCatcher catcher; |
88 // Visit a non-extension page so the extension can run a content script and | 90 // Visit a non-extension page so the extension can run a content script and |
89 // cause the script badge to be animated in. | 91 // cause the script badge to be animated in. |
90 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("")); | 92 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("")); |
91 ASSERT_TRUE(catcher.GetNextResult()); | 93 ASSERT_TRUE(catcher.GetNextResult()); |
92 } | 94 } |
93 EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); | 95 EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); |
94 EXPECT_THAT(location_bar_controller->GetCurrentActions(), | 96 EXPECT_THAT(location_bar_controller->GetCurrentActions(), |
95 testing::ElementsAre(script_badge)); | 97 testing::ElementsAre(script_badge)); |
96 } | 98 } |
97 | 99 |
98 } // namespace | 100 } // namespace |
99 } // namespace extensions | 101 } // namespace extensions |
OLD | NEW |