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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/extensions/browser_action_test_util.h" | 6 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 7 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_tab_util.h" | 11 #include "chrome/browser/extensions/extension_tab_util.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_tabstrip.h" | 14 #include "chrome/browser/ui/browser_tabstrip.h" |
14 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/omnibox/location_bar.h" | 16 #include "chrome/browser/ui/omnibox/location_bar.h" |
16 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 87 } |
87 | 88 |
88 { | 89 { |
89 // Tell the extension to update the page action state again. | 90 // Tell the extension to update the page action state again. |
90 ResultCatcher catcher; | 91 ResultCatcher catcher; |
91 ui_test_utils::NavigateToURL(browser(), | 92 ui_test_utils::NavigateToURL(browser(), |
92 GURL(extension->GetResourceURL("update2.html"))); | 93 GURL(extension->GetResourceURL("update2.html"))); |
93 ASSERT_TRUE(catcher.GetNextResult()); | 94 ASSERT_TRUE(catcher.GetNextResult()); |
94 } | 95 } |
95 | 96 |
| 97 // We should not be creating icons asynchronously, so we don't need an |
| 98 // observer. |
| 99 ExtensionActionIconFactory icon_factory(extension, action, NULL); |
| 100 |
96 // Test that we received the changes. | 101 // Test that we received the changes. |
97 EXPECT_FALSE(action->GetIcon(tab_id).IsEmpty()); | 102 EXPECT_FALSE(icon_factory.GetIcon(tab_id).IsEmpty()); |
98 } | 103 } |
99 | 104 |
100 // Test that calling chrome.pageAction.setPopup() can enable a popup. | 105 // Test that calling chrome.pageAction.setPopup() can enable a popup. |
101 IN_PROC_BROWSER_TEST_F(PageAsBrowserActionApiTest, AddPopup) { | 106 IN_PROC_BROWSER_TEST_F(PageAsBrowserActionApiTest, AddPopup) { |
102 // Load the extension, which has no default popup. | 107 // Load the extension, which has no default popup. |
103 ASSERT_TRUE(RunExtensionTest("page_action/add_popup")) << message_; | 108 ASSERT_TRUE(RunExtensionTest("page_action/add_popup")) << message_; |
104 const Extension* extension = GetSingleLoadedExtension(); | 109 const Extension* extension = GetSingleLoadedExtension(); |
105 ASSERT_TRUE(extension) << message_; | 110 ASSERT_TRUE(extension) << message_; |
106 | 111 |
107 int tab_id = ExtensionTabUtil::GetTabId( | 112 int tab_id = ExtensionTabUtil::GetTabId( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const Extension* extension = GetSingleLoadedExtension(); | 183 const Extension* extension = GetSingleLoadedExtension(); |
179 ASSERT_TRUE(extension) << message_; | 184 ASSERT_TRUE(extension) << message_; |
180 | 185 |
181 ResultCatcher catcher; | 186 ResultCatcher catcher; |
182 ui_test_utils::NavigateToURL(browser(), | 187 ui_test_utils::NavigateToURL(browser(), |
183 GURL(extension->GetResourceURL("update.html"))); | 188 GURL(extension->GetResourceURL("update.html"))); |
184 ASSERT_TRUE(catcher.GetNextResult()); | 189 ASSERT_TRUE(catcher.GetNextResult()); |
185 } | 190 } |
186 | 191 |
187 } | 192 } |
OLD | NEW |