summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 03:22:32 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 03:22:32 +0000
commitac7342fb9a1ccd1f5c86be0a68004e5d75eb5518 (patch)
tree365537ca35cf934bfab9d6d29488ff406e2cd144
parent79b6fa6123a8877eb25a600a01a8a0fd3de7560e (diff)
downloadchromium_src-ac7342fb9a1ccd1f5c86be0a68004e5d75eb5518.zip
chromium_src-ac7342fb9a1ccd1f5c86be0a68004e5d75eb5518.tar.gz
chromium_src-ac7342fb9a1ccd1f5c86be0a68004e5d75eb5518.tar.bz2
Port Browser Actions browsertest to linux.
BUG=23882 TEST=run it Review URL: http://codereview.chromium.org/274025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28941 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/browser_action_test.cc33
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.cc4
-rw-r--r--chrome/browser/gtk/view_id_util.cc3
-rw-r--r--chrome/browser/view_ids.h1
-rw-r--r--chrome/browser/views/browser_actions_container.cc2
-rwxr-xr-xchrome/chrome.gyp13
6 files changed, 42 insertions, 14 deletions
diff --git a/chrome/browser/extensions/browser_action_test.cc b/chrome/browser/extensions/browser_action_test.cc
index acf0c94..27206fd 100644
--- a/chrome/browser/extensions/browser_action_test.cc
+++ b/chrome/browser/extensions/browser_action_test.cc
@@ -13,6 +13,29 @@
#include "chrome/common/extensions/extension_action.h"
#include "chrome/test/ui_test_utils.h"
+#if defined(OS_LINUX)
+#include "chrome/browser/gtk/view_id_util.h"
+#endif
+
+static void CheckButtonCount(Browser* browser, const int expected_count) {
+#if defined(OS_WIN)
+ BrowserActionsContainer* browser_actions =
+ browser->window()->GetBrowserWindowTesting()->GetToolbarView()->
+ browser_actions();
+ int num_buttons = browser_actions->num_browser_actions();
+#elif defined(OS_LINUX)
+ GtkWidget* widget = ViewIDUtil::GetWidget(
+ GTK_WIDGET(browser->window()->GetNativeHandle()),
+ VIEW_ID_BROWSER_ACTION_TOOLBAR);
+ ASSERT_TRUE(widget);
+ GList* children = gtk_container_get_children(GTK_CONTAINER(widget));
+ int num_buttons = g_list_length(children);
+ g_list_free(children);
+#endif
+
+ EXPECT_EQ(expected_count, num_buttons);
+}
+
static void TestAction(Browser* browser) {
// Navigate to a page we have permission to modify.
ui_test_utils::NavigateToURL(browser,
@@ -43,10 +66,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, BrowserAction) {
.AppendASCII("make_page_red")));
// Test that there is a browser action in the toolbar.
- BrowserActionsContainer* browser_actions =
- browser()->window()->GetBrowserWindowTesting()->GetToolbarView()->
- browser_actions();
- ASSERT_EQ(1, browser_actions->num_browser_actions());
+ CheckButtonCount(browser(), 1);
TestAction(browser());
}
@@ -59,10 +79,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, BrowserActionNoIcon) {
.AppendASCII("make_page_red_no_icon")));
// Test that there is a *not* a browser action in the toolbar.
- BrowserActionsContainer* browser_actions =
- browser()->window()->GetBrowserWindowTesting()->GetToolbarView()->
- browser_actions();
- ASSERT_EQ(0, browser_actions->num_browser_actions());
+ CheckButtonCount(browser(), 0);
TestAction(browser());
}
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc
index 4908773..fa5d34e 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_toolbar_gtk.cc
@@ -265,6 +265,10 @@ void BrowserToolbarGtk::SetViewIDs() {
ViewIDUtil::SetID(go_->widget(), VIEW_ID_GO_BUTTON);
ViewIDUtil::SetID(page_menu_button_.get(), VIEW_ID_PAGE_MENU);
ViewIDUtil::SetID(app_menu_button_.get(), VIEW_ID_APP_MENU);
+ if (actions_toolbar_.get()) {
+ ViewIDUtil::SetID(actions_toolbar_->widget(),
+ VIEW_ID_BROWSER_ACTION_TOOLBAR);
+ }
}
void BrowserToolbarGtk::Show() {
diff --git a/chrome/browser/gtk/view_id_util.cc b/chrome/browser/gtk/view_id_util.cc
index 264c91a..9d44ea8 100644
--- a/chrome/browser/gtk/view_id_util.cc
+++ b/chrome/browser/gtk/view_id_util.cc
@@ -86,6 +86,9 @@ const char* GetNameFromID(ViewID id) {
case VIEW_ID_GO_BUTTON:
return "chrome-toolbar-go-button";
+ case VIEW_ID_BROWSER_ACTION_TOOLBAR:
+ return "chrome-toolbar-browser-actions-container";
+
case VIEW_ID_PAGE_MENU:
return "chrome-page-menu";
diff --git a/chrome/browser/view_ids.h b/chrome/browser/view_ids.h
index 29787ac..b495605 100644
--- a/chrome/browser/view_ids.h
+++ b/chrome/browser/view_ids.h
@@ -42,6 +42,7 @@ enum ViewID {
VIEW_ID_APP_MENU,
VIEW_ID_AUTOCOMPLETE,
VIEW_ID_BOOKMARK_MENU,
+ VIEW_ID_BROWSER_ACTION_TOOLBAR,
// The Bookmark Bar.
VIEW_ID_BOOKMARK_BAR,
diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc
index 4d28f75..d7b610d 100644
--- a/chrome/browser/views/browser_actions_container.cc
+++ b/chrome/browser/views/browser_actions_container.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/extensions/extension_tabs_module.h"
#include "chrome/browser/extensions/image_loading_tracker.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/extensions/extension_popup.h"
#include "chrome/browser/views/toolbar_view.h"
#include "chrome/common/extensions/extension_action.h"
@@ -390,6 +391,7 @@ BrowserActionsContainer::BrowserActionsContainer(
Source<ExtensionsService>(extension_service));
RefreshBrowserActionViews();
+ SetID(VIEW_ID_BROWSER_ACTION_TOOLBAR);
}
BrowserActionsContainer::~BrowserActionsContainer() {
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 00c06e7..c5cca5c 100755
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -58,10 +58,7 @@
'browser/browser_init_browsertest.cc',
'browser/crash_recovery_browsertest.cc',
'browser/download/save_page_browsertest.cc',
- 'browser/gtk/bookmark_manager_browsertest.cc',
- 'browser/gtk/view_id_util_browsertest.cc',
- 'browser/net/ftp_browsertest.cc',
- 'browser/ssl/ssl_browser_tests.cc',
+ 'browser/extensions/browser_action_test.cc',
'browser/extensions/autoupdate_interceptor.cc',
'browser/extensions/autoupdate_interceptor.h',
'browser/extensions/cross_origin_xhr_apitest.cc',
@@ -75,10 +72,13 @@
'browser/extensions/extension_browsertests_misc.cc',
'browser/extensions/extension_override_apitest.cc',
'browser/extensions/extension_toolstrip_apitest.cc',
- 'browser/extensions/isolated_world_apitest.cc'
+ 'browser/extensions/isolated_world_apitest.cc',
+ 'browser/gtk/bookmark_manager_browsertest.cc',
+ 'browser/gtk/view_id_util_browsertest.cc',
+ 'browser/net/ftp_browsertest.cc',
+ 'browser/ssl/ssl_browser_tests.cc',
],
'browser_tests_sources_win_specific': [
- 'browser/extensions/browser_action_test.cc',
'browser/extensions/extension_devtools_browsertest.cc',
'browser/extensions/extension_devtools_browsertest.h',
'browser/extensions/extension_devtools_browsertests.cc',
@@ -98,6 +98,7 @@
'browser/task_manager_browsertest.cc',
],
'browser_tests_sources_exclude_on_mac': [
+ 'browser/extensions/browser_action_test.cc',
'browser/extensions/cross_origin_xhr_apitest.cc',
'browser/extensions/execute_script_apitest.cc',
'browser/extensions/extension_apitest.cc',