| Index: chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
|
| diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
|
| index f331a6e1325c28de3f56f818812a16edfe3fad98..c0d4c65c469da40d704fbe4c4eb3edd74e421104 100644
|
| --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
|
| +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
|
| @@ -13,6 +13,7 @@
|
| #include "chrome/browser/prefs/pref_service.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ui/browser.h"
|
| +#include "chrome/browser/ui/browser_window.h"
|
| #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/pref_names.h"
|
| @@ -189,6 +190,7 @@ class BookmarkBarViewEventTestBase : public ViewEventTestBase {
|
| model_->ClearStore();
|
|
|
| bb_view_.reset(new BookmarkBarView(browser_.get()));
|
| + bb_view_->set_parent_owned(false);
|
| bb_view_->SetPageNavigator(&navigator_);
|
|
|
| AddTestData(CreateBigMenu());
|
| @@ -222,12 +224,10 @@ class BookmarkBarViewEventTestBase : public ViewEventTestBase {
|
| }
|
|
|
| virtual void TearDown() {
|
| - // Destroy everything, then run the message loop to ensure we delete all
|
| - // Tasks and fully shut down.
|
| - browser_->CloseAllTabs();
|
| - bb_view_.reset();
|
| - browser_.reset();
|
| + DestroyBrowser();
|
| profile_.reset();
|
| +
|
| + // Run the message loop to ensure we delete allTasks and fully shut down.
|
| MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
|
| MessageLoop::current()->Run();
|
|
|
| @@ -251,9 +251,20 @@ class BookmarkBarViewEventTestBase : public ViewEventTestBase {
|
| return bb_view_->GetBookmarkButton(view_index);
|
| }
|
|
|
| + void DestroyBrowser() {
|
| + if (!browser_.get())
|
| + return;
|
| +
|
| + browser_->CloseAllTabs();
|
| + bb_view_.reset();
|
| + browser_.reset();
|
| + }
|
| +
|
| // See comment above class description for what this does.
|
| virtual bool CreateBigMenu() { return false; }
|
|
|
| + Browser* browser() { return browser_.get(); }
|
| +
|
| BookmarkModel* model_;
|
| scoped_ptr<BookmarkBarView> bb_view_;
|
| TestingPageNavigator navigator_;
|
| @@ -1591,3 +1602,45 @@ class BookmarkBarViewTest19 : public BookmarkBarViewEventTestBase {
|
| };
|
|
|
| VIEW_TEST(BookmarkBarViewTest19, SiblingMenu)
|
| +
|
| +// Verifies mousing over an already open sibling menu doesn't prematurely cancel
|
| +// the menu.
|
| +class BookmarkBarViewTest20 : public BookmarkBarViewEventTestBase {
|
| + public:
|
| + BookmarkBarViewTest20() {}
|
| +
|
| + protected:
|
| + virtual void DoTestOnMessageLoop() OVERRIDE {
|
| + // Press the mouse button on the overflow button. Don't release it though.
|
| + /*
|
| + views::TextButton* button = bb_view_->overflow_button();
|
| + ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
|
| + ui_controls::DOWN, CreateEventTask(this,
|
| + &BookmarkBarViewTest20::Step2));
|
| + */
|
| + views::TextButton* button = bb_view_->other_bookmarked_button();
|
| + ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
|
| + ui_controls::DOWN | ui_controls::UP,
|
| + CreateEventTask(this, &BookmarkBarViewTest20::Step2));
|
| + }
|
| +
|
| + private:
|
| + void Step2() {
|
| + printf("menu showing\n");
|
| + // Menu should be showing.
|
| + views::MenuItemView* menu = bb_view_->GetMenu();
|
| + ASSERT_TRUE(menu != NULL);
|
| + ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
|
| +
|
| + // Destroy the window.
|
| + window_->Close();
|
| + window_ = NULL;
|
| +
|
| + MessageLoop::current()->PostTask(
|
| + FROM_HERE, CreateEventTask(this, &BookmarkBarViewTest12::Done));
|
| + }
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewTest20);
|
| +};
|
| +
|
| +VIEW_TEST(BookmarkBarViewTest20, DestroyBrowserWhileMenuRunning)
|
|
|