#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
-#include "chrome/browser/bookmarks/bookmark_test_helpers.h"
+#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/bookmarks/bookmark_utils.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
+#include "chrome/common/chrome_content_client.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/scoped_testing_local_state.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/base/view_event_test_base.h"
+#include "components/bookmarks/core/browser/bookmark_model.h"
+#include "components/bookmarks/core/test/bookmark_test_helpers.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/test/test_browser_thread.h"
#include "grit/generated_resources.h"
-#include "ui/base/accessibility/accessibility_types.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/test/ui_controls.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/views/controls/menu/submenu_view.h"
#include "ui/views/widget/widget.h"
+using base::ASCIIToUTF16;
using content::BrowserThread;
using content::OpenURLParams;
using content::PageNavigator;
GURL url_;
};
-// TODO(jschuh): Fix bookmark DND tests on Win64. crbug.com/244605
// TODO(erg): Fix bookmark DBD tests on linux_aura. crbug.com/163931
-#if (defined(OS_WIN) && defined(ARCH_CPU_X86_64)) || \
- (defined(OS_LINUX) && defined(USE_AURA))
+#if defined(OS_LINUX) && defined(USE_AURA)
#define MAYBE(x) DISABLED_##x
#else
#define MAYBE(x) x
model_(NULL) {}
virtual void SetUp() OVERRIDE {
+ content_client_.reset(new ChromeContentClient);
+ content::SetContentClient(content_client_.get());
+ browser_content_client_.reset(new chrome::ChromeContentBrowserClient());
+ content::SetBrowserClientForTesting(browser_content_client_.get());
+
views::MenuController::TurnOffMenuSelectionHoldForTest();
BookmarkBarView::DisableAnimationsForTesting(true);
ViewEventTestBase::TearDown();
BookmarkBarView::DisableAnimationsForTesting(false);
+
+ browser_content_client_.reset();
+ content_client_.reset();
+ content::SetContentClient(NULL);
}
protected:
}
gfx::Size bb_view_pref_;
+ scoped_ptr<ChromeContentClient> content_client_;
+ scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_;
scoped_ptr<TestingProfile> profile_;
scoped_ptr<Browser> browser_;
scoped_ptr<ScopedTestingLocalState> local_state_;
// Observer that posts task upon the context menu creation.
// This is necessary for Linux as the context menu has to check
// the clipboard, which invokes the event loop.
-class ContextMenuNotificationObserver : public content::NotificationObserver {
+class BookmarkContextMenuNotificationObserver
+ : public content::NotificationObserver {
public:
- explicit ContextMenuNotificationObserver(const base::Closure& task)
+ explicit BookmarkContextMenuNotificationObserver(const base::Closure& task)
: task_(task) {
registrar_.Add(this,
chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN,
content::NotificationRegistrar registrar_;
base::Closure task_;
- DISALLOW_COPY_AND_ASSIGN(ContextMenuNotificationObserver);
+ DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuNotificationObserver);
};
// Tests context menus by way of opening a context menu for a bookmark,
// Right click on the first child to get its context menu.
ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::RIGHT,
ui_controls::DOWN | ui_controls::UP, base::Closure());
- // Step3 will be invoked by ContextMenuNotificationObserver.
+ // Step3 will be invoked by BookmarkContextMenuNotificationObserver.
}
void Step3() {
Done();
}
- ContextMenuNotificationObserver observer_;
+ BookmarkContextMenuNotificationObserver observer_;
};
VIEW_TEST(BookmarkBarViewTest4, ContextMenus)
GURL url_dragging_;
};
-#if !(defined(OS_WIN) && defined(USE_AURA))
+#if !defined(OS_WIN)
// This test passes locally (on aero and non-aero) but fails on the trybots and
// buildbot.
// http://crbug.com/154081
GURL url_dragging_;
};
-#if !(defined(OS_WIN) && defined(USE_AURA))
+#if !defined(OS_WIN)
// This test passes locally (on aero and non-aero) but fails on the trybots and
// buildbot.
// http://crbug.com/154081
// Right click on the first child to get its context menu.
ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::RIGHT,
ui_controls::DOWN | ui_controls::UP, base::Closure());
- // Step3 will be invoked by ContextMenuNotificationObserver.
+ // Step3 will be invoked by BookmarkContextMenuNotificationObserver.
}
void Step3() {
Done();
}
- ContextMenuNotificationObserver observer_;
+ BookmarkContextMenuNotificationObserver observer_;
};
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
// Right click on the first child to get its context menu.
ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::RIGHT,
ui_controls::DOWN | ui_controls::UP, base::Closure());
- // Step3 will be invoked by ContextMenuNotificationObserver.
+ // Step3 will be invoked by BookmarkContextMenuNotificationObserver.
}
void Step3() {
Done();
}
- ContextMenuNotificationObserver observer_;
+ BookmarkContextMenuNotificationObserver observer_;
};
VIEW_TEST(BookmarkBarViewTest13, ClickOnContextMenuSeparator)
views::TextButton* button = GetBookmarkButton(0);
ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::RIGHT,
ui_controls::DOWN | ui_controls::UP, base::Closure());
- // Step2 will be invoked by ContextMenuNotificationObserver.
+ // Step2 will be invoked by BookmarkContextMenuNotificationObserver.
}
private:
Done();
}
- ContextMenuNotificationObserver observer_;
+ BookmarkContextMenuNotificationObserver observer_;
};
VIEW_TEST(BookmarkBarViewTest14, ContextMenus2)
// Right click on the second child to get its context menu.
ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::RIGHT,
ui_controls::DOWN | ui_controls::UP, base::Closure());
- // Step3 will be invoked by ContextMenuNotificationObserver.
+ // Step3 will be invoked by BookmarkContextMenuNotificationObserver.
}
void Step3() {
}
int deleted_menu_id_;
- ContextMenuNotificationObserver observer_;
+ BookmarkContextMenuNotificationObserver observer_;
};
VIEW_TEST(BookmarkBarViewTest15, MenuStaysVisibleAfterDelete)
ASSERT_TRUE(child_menu != NULL);
ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::RIGHT,
ui_controls::DOWN | ui_controls::UP, base::Closure());
- // Step3 will be invoked by ContextMenuNotificationObserver.
+ // Step3 will be invoked by BookmarkContextMenuNotificationObserver.
}
void Step3() {
observer_.set_task(CreateEventTask(this, &BookmarkBarViewTest17::Step4));
MoveMouseAndPress(clickable_rect.CenterPoint(), ui_controls::RIGHT,
ui_controls::DOWN | ui_controls::UP, base::Closure());
- // Step4 will be invoked by ContextMenuNotificationObserver.
+ // Step4 will be invoked by BookmarkContextMenuNotificationObserver.
}
void Step4() {
Done();
}
- ContextMenuNotificationObserver observer_;
+ BookmarkContextMenuNotificationObserver observer_;
};
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
TestViewForMenuExit* test_view_;
};
-#if defined(OS_WIN) && !defined(USE_AURA)
-#define MAYBE_ContextMenuExitTest DISABLED_ContextMenuExitTest
-#elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
// TODO(erg): linux_aura bringup: http://crbug.com/163931
#define MAYBE_ContextMenuExitTest DISABLED_ContextMenuExitTest
#else
// Right click on the first child to get its context menu.
ui_test_utils::MoveMouseToCenterAndPress(view, ui_controls::RIGHT,
ui_controls::DOWN | ui_controls::UP, base::Closure());
- // Step3 will be invoked by ContextMenuNotificationObserver.
+ // Step3 will be invoked by BookmarkContextMenuNotificationObserver.
}
// Confirm that context menu shows and click REMOVE menu.
Done();
}
- ContextMenuNotificationObserver observer_;
+ BookmarkContextMenuNotificationObserver observer_;
};
VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder)