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. |