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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view_browsertest.cc

Issue 2687893002: Clear the text cache when the tooltip text is updated. (Closed)
Patch Set: . Created 3 years, 10 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
Index: chrome/browser/ui/views/bookmarks/bookmark_bar_view_browsertest.cc
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_browsertest.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e95ff6e566b0b81cf16a9cca4e144043d7fe0186
--- /dev/null
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_browsertest.cc
@@ -0,0 +1,38 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
+
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/bookmarks/bookmark_model_factory.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view_test_helper.h"
+#include "chrome/browser/ui/views/frame/browser_view.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "components/bookmarks/browser/bookmark_model.h"
+#include "components/bookmarks/test/bookmark_test_helpers.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/views/controls/button/label_button.h"
+
+dusing BookmarkBarViewTest = InProcessBrowserTest;
+
+IN_PROC_BROWSER_TEST_F(BookmarkBarViewTest, UpdateTooltipText) {
sky 2017/02/09 20:30:40 Are you sure you need a browsertest for this? I'm
oshima 2017/02/13 04:37:24 I moved to unit test. I had to create a fake widge
+ BrowserView* browser_view = static_cast<BrowserView*>(browser()->window());
+ BookmarkBarViewTestHelper helper(browser_view->bookmark_bar());
+ bookmarks::BookmarkModel* model =
+ BookmarkModelFactory::GetForBrowserContext(browser()->profile());
+ bookmarks::test::AddNodesFromModelString(model, model->bookmark_bar_node(),
+ "a b");
+ ASSERT_EQ(1, helper.GetBookmarkButtonCount());
+
+ views::LabelButton* button = helper.GetBookmarkButton(0);
+
+ gfx::Point p;
+ base::string16 text;
+ button->GetTooltipText(p, &text);
+ EXPECT_EQ(base::ASCIIToUTF16("a\na.com"), text);
+ button->SetText(base::ASCIIToUTF16("new title"));
+ button->GetTooltipText(p, &text);
+ EXPECT_EQ(base::ASCIIToUTF16("new title\na.com"), text);
+}

Powered by Google App Engine
This is Rietveld 408576698