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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
6
7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view_test_helper.h"
11 #include "chrome/browser/ui/views/frame/browser_view.h"
12 #include "chrome/test/base/in_process_browser_test.h"
13 #include "components/bookmarks/browser/bookmark_model.h"
14 #include "components/bookmarks/test/bookmark_test_helpers.h"
15 #include "ui/gfx/geometry/point.h"
16 #include "ui/views/controls/button/label_button.h"
17
18 dusing BookmarkBarViewTest = InProcessBrowserTest;
19
20 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
21 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window());
22 BookmarkBarViewTestHelper helper(browser_view->bookmark_bar());
23 bookmarks::BookmarkModel* model =
24 BookmarkModelFactory::GetForBrowserContext(browser()->profile());
25 bookmarks::test::AddNodesFromModelString(model, model->bookmark_bar_node(),
26 "a b");
27 ASSERT_EQ(1, helper.GetBookmarkButtonCount());
28
29 views::LabelButton* button = helper.GetBookmarkButton(0);
30
31 gfx::Point p;
32 base::string16 text;
33 button->GetTooltipText(p, &text);
34 EXPECT_EQ(base::ASCIIToUTF16("a\na.com"), text);
35 button->SetText(base::ASCIIToUTF16("new title"));
36 button->GetTooltipText(p, &text);
37 EXPECT_EQ(base::ASCIIToUTF16("new title\na.com"), text);
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698