| 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_icon_factory.h" | 6 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_tab_util.h" | 9 #include "chrome/browser/extensions/extension_tab_util.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/sessions/session_tab_helper.h" | 11 #include "chrome/browser/sessions/session_tab_helper.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_tabstrip.h" | 13 #include "chrome/browser/ui/browser_tabstrip.h" |
| 14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
| 15 #include "chrome/browser/ui/omnibox/location_bar.h" | 15 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 18 #include "chrome/common/extensions/extension_action.h" | 18 #include "chrome/common/extensions/extension_action.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 "ui/gfx/image/image_skia.h" | |
| 22 | 21 |
| 23 using extensions::Extension; | 22 using extensions::Extension; |
| 24 | 23 |
| 25 namespace { | |
| 26 | |
| 27 gfx::Image CreateNonEmptyImage() { | |
| 28 SkBitmap bitmap; | |
| 29 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); | |
| 30 bitmap.allocPixels(); | |
| 31 return gfx::Image(bitmap); | |
| 32 } | |
| 33 | |
| 34 } // namespace | |
| 35 | |
| 36 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PageAction) { | 24 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PageAction) { |
| 37 ASSERT_TRUE(test_server()->Start()); | 25 ASSERT_TRUE(test_server()->Start()); |
| 38 ASSERT_TRUE(RunExtensionTest("page_action/basics")) << message_; | 26 ASSERT_TRUE(RunExtensionTest("page_action/basics")) << message_; |
| 39 const Extension* extension = GetSingleLoadedExtension(); | 27 const Extension* extension = GetSingleLoadedExtension(); |
| 40 ASSERT_TRUE(extension) << message_; | 28 ASSERT_TRUE(extension) << message_; |
| 41 { | 29 { |
| 42 // Tell the extension to update the page action state. | 30 // Tell the extension to update the page action state. |
| 43 ResultCatcher catcher; | 31 ResultCatcher catcher; |
| 44 ui_test_utils::NavigateToURL(browser(), | 32 ui_test_utils::NavigateToURL(browser(), |
| 45 GURL(extension->GetResourceURL("update.html"))); | 33 GURL(extension->GetResourceURL("update.html"))); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Getters) { | 209 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Getters) { |
| 222 ASSERT_TRUE(RunExtensionTest("page_action/getters")) << message_; | 210 ASSERT_TRUE(RunExtensionTest("page_action/getters")) << message_; |
| 223 const Extension* extension = GetSingleLoadedExtension(); | 211 const Extension* extension = GetSingleLoadedExtension(); |
| 224 ASSERT_TRUE(extension) << message_; | 212 ASSERT_TRUE(extension) << message_; |
| 225 | 213 |
| 226 ResultCatcher catcher; | 214 ResultCatcher catcher; |
| 227 ui_test_utils::NavigateToURL(browser(), | 215 ui_test_utils::NavigateToURL(browser(), |
| 228 GURL(extension->GetResourceURL("update.html"))); | 216 GURL(extension->GetResourceURL("update.html"))); |
| 229 ASSERT_TRUE(catcher.GetNextResult()); | 217 ASSERT_TRUE(catcher.GetNextResult()); |
| 230 } | 218 } |
| OLD | NEW |