summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 03:18:45 +0000
committercduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 03:18:45 +0000
commitde82f9e2035c4259ff38c4a045abe4f549f71a62 (patch)
tree9b4fe0113a99557ba6be8805b347588716e8de3c
parentc8d4f606b39ba14e5329355d655c3e80b1bde8ec (diff)
downloadchromium_src-de82f9e2035c4259ff38c4a045abe4f549f71a62.zip
chromium_src-de82f9e2035c4259ff38c4a045abe4f549f71a62.tar.gz
chromium_src-de82f9e2035c4259ff38c4a045abe4f549f71a62.tar.bz2
Force browser action icon size to always be 19px
Fixed the browser action bar so that it will render the icon normal size if an icon is not specified. Also re-worked a test case for dynamically changing the browser action icon (BrowserActionApiTest.DynamicBrowserAction). Made the test more robust by checking the pixels of the icon to make sure it is actually changed. Screenshots of before and after are posted on the bug. BUG=111301 TEST=Load an extension with a browser action and no icon specified. The icon now should be the default extension icon. Review URL: http://codereview.chromium.org/9424024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125314 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/browser_action_apitest.cc14
-rw-r--r--chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc2
2 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/extensions/browser_action_apitest.cc b/chrome/browser/extensions/browser_action_apitest.cc
index 9c98df7..5f98595 100644
--- a/chrome/browser/extensions/browser_action_apitest.cc
+++ b/chrome/browser/extensions/browser_action_apitest.cc
@@ -96,7 +96,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) {
const Extension* extension = GetSingleLoadedExtension();
ASSERT_TRUE(extension) << message_;
- // Test that there is a browser action in the toolbar and that it has no icon.
+ // Test that there is a browser action in the toolbar.
ASSERT_EQ(1, GetBrowserActionsBar().NumberOfBrowserActions());
EXPECT_FALSE(GetBrowserActionsBar().HasIcon(0));
@@ -109,15 +109,17 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) {
// Test that we received the changes.
EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0));
- // Tell the extension to update using setIcon({path:...});
+ // Set prev_id which holds the id of the previous image, and use it in the
+ // next test to see if the image changes.
+ uint32_t prev_id = extension->browser_action()->GetIcon(0).getGenerationID();
+
+ // Tell the extension to update the icon using setIcon({path:...}).
ui_test_utils::NavigateToURL(browser(),
GURL(extension->GetResourceURL("update2.html")));
ASSERT_TRUE(catcher.GetNextResult());
-
- // Test that we received the changes.
EXPECT_TRUE(GetBrowserActionsBar().HasIcon(0));
-
- // TODO(aa): Would be nice here to actually compare that the pixels change.
+ EXPECT_TRUE(prev_id !=
+ extension->browser_action()->GetIcon(0).getGenerationID());
}
// This test is flaky as per http://crbug.com/74557.
diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc
index 3c8f616..2db368c 100644
--- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h"
#include <algorithm>
+#include <gtk/gtk.h>
#include <vector>
#include "base/bind.h"
@@ -102,6 +103,7 @@ class BrowserActionButton : public content::NotificationObserver,
IDR_BROWSER_ACTION_H,
0,
NULL));
+ gtk_widget_set_size_request(button(), kButtonWidth, kButtonWidth);
alignment_.Own(gtk_alignment_new(0, 0, 1, 1));
gtk_container_add(GTK_CONTAINER(alignment_.get()), button());
gtk_widget_show(button());