Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6721)

Unified Diff: chrome/browser/ui/views/frame/browser_view_unittest.cc

Issue 2946813002: Bookmark disappear first when closing browser (Closed)
Patch Set: Return back to earlier fix Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/browser_view_unittest.cc
diff --git a/chrome/browser/ui/views/frame/browser_view_unittest.cc b/chrome/browser/ui/views/frame/browser_view_unittest.cc
index de6477ba780cad74059087b6f168dfdb01c39d08..7ca7b09db3145ae8ba794efa139ec9278b1aa98a 100644
--- a/chrome/browser/ui/views/frame/browser_view_unittest.cc
+++ b/chrome/browser/ui/views/frame/browser_view_unittest.cc
@@ -8,6 +8,7 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h"
#include "chrome/browser/ui/browser_commands.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
#include "chrome/browser/ui/views/frame/browser_view_layout.h"
#include "chrome/browser/ui/views/frame/test_with_browser_view.h"
@@ -182,6 +183,30 @@ TEST_F(BrowserViewTest, RepeatedAccelerators) {
EXPECT_TRUE(browser_view()->AcceleratorPressed(kNextTabRepeatAccel));
}
+// Test that the bookmark bar view's parent is not set to nullptr when closing
+// the browser. If the parent is set to nullptr, then the bookmark bar
+// disappears before the browser is closed, which looks weird.
+TEST_F(BrowserViewTest, BookmarkBarParentIsNotNullOnShutdown) {
+ BookmarkBarView::DisableAnimationsForTesting(true);
+
+ Browser* browser = browser_view()->browser();
+ TabStripModel* tab_strip_model = browser->tab_strip_model();
+ EXPECT_EQ(0, tab_strip_model->count());
+
+ AddTab(browser, GURL("about:blank"));
+ EXPECT_EQ(1, tab_strip_model->count());
+
+ BookmarkBarView* bookmark_bar = browser_view()->GetBookmarkBarView();
+ chrome::ExecuteCommand(browser, IDC_SHOW_BOOKMARK_BAR);
+ EXPECT_NE(nullptr, bookmark_bar->parent());
+
+ tab_strip_model->CloseWebContentsAt(tab_strip_model->active_index(), 0);
+ EXPECT_EQ(0, tab_strip_model->count());
+ EXPECT_NE(nullptr, bookmark_bar->parent());
+
+ BookmarkBarView::DisableAnimationsForTesting(false);
+}
+
class BrowserViewHostedAppTest : public TestWithBrowserView {
public:
BrowserViewHostedAppTest() : TestWithBrowserView(Browser::TYPE_POPUP, true) {}
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698