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/api/extension_action/extension_action_api.h" | 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
6 #include "chrome/browser/extensions/extension_action.h" | 6 #include "chrome/browser/extensions/extension_action.h" |
7 #include "chrome/browser/extensions/extension_action_icon_factory.h" | 7 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
8 #include "chrome/browser/extensions/extension_action_manager.h" | 8 #include "chrome/browser/extensions/extension_action_manager.h" |
| 9 #include "chrome/browser/extensions/extension_action_test_util.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/extension_tab_util.h" | 12 #include "chrome/browser/extensions/extension_tab_util.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/sessions/session_tab_helper.h" | 14 #include "chrome/browser/sessions/session_tab_helper.h" |
14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/browser/ui/location_bar/location_bar.h" | |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
21 #include "content/public/test/browser_test_utils.h" | 21 #include "content/public/test/browser_test_utils.h" |
22 #include "extensions/browser/extension_system.h" | 22 #include "extensions/browser/extension_system.h" |
23 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
24 | 24 |
25 using content::WebContents; | 25 using content::WebContents; |
26 | 26 |
27 namespace extensions { | 27 namespace extensions { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Flaky on the trybots. See http://crbug.com/96725. | 161 // Flaky on the trybots. See http://crbug.com/96725. |
162 IN_PROC_BROWSER_TEST_F(PageActionApiTest, DISABLED_ShowPageActionPopup) { | 162 IN_PROC_BROWSER_TEST_F(PageActionApiTest, DISABLED_ShowPageActionPopup) { |
163 ASSERT_TRUE(RunExtensionTest("page_action/popup")) << message_; | 163 ASSERT_TRUE(RunExtensionTest("page_action/popup")) << message_; |
164 const Extension* extension = GetSingleLoadedExtension(); | 164 const Extension* extension = GetSingleLoadedExtension(); |
165 ASSERT_TRUE(extension) << message_; | 165 ASSERT_TRUE(extension) << message_; |
166 | 166 |
167 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); | 167 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); |
168 | 168 |
169 { | 169 { |
170 ResultCatcher catcher; | 170 ResultCatcher catcher; |
171 LocationBarTesting* location_bar = | 171 ExtensionActionAPI::Get(browser()->profile())->ShowExtensionActionPopup( |
172 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); | 172 extension, browser(), true); |
173 location_bar->TestPageActionPressed(0); | |
174 ASSERT_TRUE(catcher.GetNextResult()); | 173 ASSERT_TRUE(catcher.GetNextResult()); |
175 } | 174 } |
176 } | 175 } |
177 | 176 |
178 // Test http://crbug.com/57333: that two page action extensions using the same | 177 // Test http://crbug.com/57333: that two page action extensions using the same |
179 // icon for the page action icon and the extension icon do not crash. | 178 // icon for the page action icon and the extension icon do not crash. |
180 IN_PROC_BROWSER_TEST_F(PageActionApiTest, TestCrash57333) { | 179 IN_PROC_BROWSER_TEST_F(PageActionApiTest, TestCrash57333) { |
181 // Load extension A. | 180 // Load extension A. |
182 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("page_action") | 181 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("page_action") |
183 .AppendASCII("crash_57333") | 182 .AppendASCII("crash_57333") |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 const std::string script = | 236 const std::string script = |
238 "window.domAutomationController.send(document.body.style." | 237 "window.domAutomationController.send(document.body.style." |
239 "backgroundColor);"; | 238 "backgroundColor);"; |
240 std::string result; | 239 std::string result; |
241 EXPECT_TRUE(content::ExecuteScriptAndExtractString(tab, script, &result)); | 240 EXPECT_TRUE(content::ExecuteScriptAndExtractString(tab, script, &result)); |
242 EXPECT_EQ(result, "red"); | 241 EXPECT_EQ(result, "red"); |
243 } | 242 } |
244 | 243 |
245 } // namespace | 244 } // namespace |
246 } // namespace extensions | 245 } // namespace extensions |
OLD | NEW |