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

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

Issue 9424024: Force browser action icon size to always be 19px (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed unnecessary #include Created 8 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 | chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/browser_action_apitest.cc
diff --git a/chrome/browser/extensions/browser_action_apitest.cc b/chrome/browser/extensions/browser_action_apitest.cc
index 9c98df79a81a722ffecb6e6123aab37a4695c690..c6d15ff50f4b1f54b2af909a10c76818799de870 100644
--- a/chrome/browser/extensions/browser_action_apitest.cc
+++ b/chrome/browser/extensions/browser_action_apitest.cc
@@ -96,9 +96,12 @@ 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));
+
+ // Get the generation ID of the original SkBitmap. This will be the default
+ // browser action icon.
+ uint32_t prev_id = extension->browser_action()->GetIcon(0).getGenerationID();
// Tell the extension to update the icon using setIcon({imageData:...}).
ResultCatcher catcher;
@@ -109,15 +112,20 @@ 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:...});
+ // Test to make sure the images are different.
Aaron Boodman 2012/03/02 20:16:39 If you just want to ensure that the icons are diff
cduvall 2012/03/02 22:18:30 That would also work. I just wanted to make sure t
Aaron Boodman 2012/03/02 22:34:46 Hm, I thought there was functionality in SkBitmap
+ EXPECT_TRUE(prev_id !=
+ extension->browser_action()->GetIcon(0).getGenerationID());
+
+ // Reset prev_id to use in the next test and repeat the process using
+ // setIcon({path:...}).
+ prev_id = extension->browser_action()->GetIcon(0).getGenerationID();
+
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.
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698