Chromium Code Reviews| Index: chrome/browser/extensions/browser_action_test_util_gtk.cc |
| diff --git a/chrome/browser/extensions/browser_action_test_util_gtk.cc b/chrome/browser/extensions/browser_action_test_util_gtk.cc |
| index ccf6411aec9ed0454053be61b6301f13c9f27990..fb5c06203e523a17312f5e211e752477dbccd473 100644 |
| --- a/chrome/browser/extensions/browser_action_test_util_gtk.cc |
| +++ b/chrome/browser/extensions/browser_action_test_util_gtk.cc |
| @@ -11,6 +11,7 @@ |
| #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" |
| #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" |
| #include "chrome/browser/ui/gtk/view_id_util.h" |
| +#include "ui/gfx/image/image.h" |
| namespace { |
| @@ -49,6 +50,16 @@ bool BrowserActionTestUtil::HasIcon(int index) { |
| return gtk_button_get_image(GTK_BUTTON(button)) != NULL; |
| } |
| +uint32 BrowserActionTestUtil::GetIconID(int index) { |
| + GtkWidget* button = GetButton(browser_, index); |
| + GtkWidget* image = gtk_button_get_image(GTK_BUTTON(button)); |
| + GdkPixbuf* pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image)); |
| + // gfx::Image will unref |pixbuf| when it goes away. Pair that unref here so |
|
Jeffrey Yasskin
2012/08/17 23:20:28
"will unref" is a bit lower-level than I'd expect.
tbarzic
2012/08/21 00:22:07
Done.
|
| + // |pixbuf| stays around. |
| + g_object_ref(pixbuf); |
| + return gfx::Image(pixbuf).AsBitmap().getGenerationID(); |
|
Jeffrey Yasskin
2012/08/17 23:20:28
Isn't this going to return a new ID each time it's
tbarzic
2012/08/21 00:22:07
Yeah, you're probably right, but doesn't matter af
|
| +} |
| + |
| void BrowserActionTestUtil::Press(int index) { |
| GtkWidget* button = GetButton(browser_, index); |
| gtk_button_clicked(GTK_BUTTON(button)); |