Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: chrome/browser/extensions/api/extension_action/browser_action_apitest.cc

Issue 170843005: Fix BrowserActionApiTest.DynamicBrowserAction interaction with dev-mode highlighting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: , Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
index 3d63e470db08e38f6a124717f046bc820a669de7..1a39a35bdaf9f34b99a45c2fc0440f8730a9fdae 100644
--- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
+++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/browser_action_test_util.h"
+#include "chrome/browser/extensions/dev_mode_bubble_controller.h"
#include "chrome/browser/extensions/extension_action.h"
#include "chrome/browser/extensions/extension_action_icon_factory.h"
#include "chrome/browser/extensions/extension_action_manager.h"
@@ -48,10 +49,15 @@ const char kEmptyPathError[] = "The path property must not be empty.";
// Views implementation of browser action button will return icon whose
// background will be set.
-gfx::ImageSkia AddBackgroundForViews(const gfx::ImageSkia& icon) {
+gfx::ImageSkia AddBackgroundForViews(const Extension* extension,
+ const gfx::ImageSkia& icon) {
#if defined(TOOLKIT_VIEWS)
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
gfx::ImageSkia bg = *rb.GetImageSkiaNamed(IDR_BROWSER_ACTION);
+ // We may have a different background than the default - see
+ // BrowserActionButton::UpdateState.
+ if (extensions::DevModeBubbleController::IsDevModeExtension(extension))
+ bg = *rb.GetImageSkiaNamed(IDR_BROWSER_ACTION_HIGHLIGHT);
return gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon);
#endif
@@ -175,7 +181,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) {
EXPECT_FALSE(action_icon.ToImageSkia()->HasRepresentation(2.0f));
EXPECT_TRUE(ImagesAreEqualAtScale(
- AddBackgroundForViews(*action_icon.ToImageSkia()),
+ AddBackgroundForViews(extension, *action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
1.0f));
@@ -193,7 +199,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) {
action_icon.ToImageSkia()->HasRepresentation(2.0f));
EXPECT_TRUE(ImagesAreEqualAtScale(
- AddBackgroundForViews(*action_icon.ToImageSkia()),
+ AddBackgroundForViews(extension, *action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
1.0f));
@@ -211,7 +217,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) {
EXPECT_TRUE(action_icon.ToImageSkia()->HasRepresentation(2.0f));
EXPECT_TRUE(ImagesAreEqualAtScale(
- AddBackgroundForViews(*action_icon.ToImageSkia()),
+ AddBackgroundForViews(extension, *action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
1.0f));
@@ -228,7 +234,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) {
EXPECT_TRUE(action_icon.ToImageSkia()->HasRepresentation(2.0f));
EXPECT_TRUE(ImagesAreEqualAtScale(
- AddBackgroundForViews(*action_icon.ToImageSkia()),
+ AddBackgroundForViews(extension, *action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
1.0f));
@@ -246,7 +252,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) {
EXPECT_FALSE(action_icon.ToImageSkia()->HasRepresentation(2.0f));
EXPECT_TRUE(ImagesAreEqualAtScale(
- AddBackgroundForViews(*action_icon.ToImageSkia()),
+ AddBackgroundForViews(extension, *action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
1.0f));
@@ -264,7 +270,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) {
EXPECT_FALSE(action_icon.ToImageSkia()->HasRepresentation(2.0f));
EXPECT_TRUE(ImagesAreEqualAtScale(
- AddBackgroundForViews(*action_icon.ToImageSkia()),
+ AddBackgroundForViews(extension, *action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
1.0f));
@@ -288,10 +294,10 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) {
*action_icon.ToSkBitmap(),
action_icon_skia->GetRepresentation(2.0f).sk_bitmap()));
- EXPECT_TRUE(ImagesAreEqualAtScale(
- AddBackgroundForViews(*action_icon_skia),
- *GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
- 2.0f));
+ EXPECT_TRUE(
+ ImagesAreEqualAtScale(AddBackgroundForViews(extension, *action_icon_skia),
+ *GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
+ 2.0f));
// Try setting icon with empty dictionary of ImageData objects.
GetBrowserActionsBar().Press(0);
@@ -338,11 +344,10 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest,
// http://code.google.com/p/chromium/issues/detail?id=70829
// Mac used to be ok, but then mac 10.5 started failing too. =(
IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DISABLED_BrowserActionPopup) {
- ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(
- "browser_action/popup")));
- BrowserActionTestUtil actions_bar = GetBrowserActionsBar();
- const Extension* extension = GetSingleLoadedExtension();
+ const Extension* extension =
+ LoadExtension(test_data_dir_.AppendASCII("browser_action/popup"));
ASSERT_TRUE(extension) << message_;
+ BrowserActionTestUtil actions_bar = GetBrowserActionsBar();
// The extension's popup's size grows by |growFactor| each click.
const int growFactor = 500;
@@ -607,9 +612,9 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoSplit) {
// Disabled because of failures (crashes) on ASAN bot.
// See http://crbug.com/98861.
IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DISABLED_CloseBackgroundPage) {
- ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(
- "browser_action/close_background")));
- const Extension* extension = GetSingleLoadedExtension();
+ const Extension* extension = LoadExtension(
+ test_data_dir_.AppendASCII("browser_action/close_background"));
+ ASSERT_TRUE(extension) << message_;
// There is a background page and a browser action with no badge text.
extensions::ProcessManager* manager =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698