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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm

Issue 1855503002: Mac: Update the tooltip view tooltip when a tab's title changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160329-Mac-DeploymentTarget
Patch Set: Unit test.. Created 4 years, 9 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/cocoa/tabs/tab_strip_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm
index d7345ca57c98ba8eb71e394de6b2e90171c82e98..deaa7919673d55c40745601726709a979812202f 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm
@@ -280,12 +280,25 @@ TEST_F(TabStripControllerTest, CorrectTitleAndToolTipTextFromSetTabTitle) {
TabController* const tabController = [tab controller];
WebContents* const contents = model_->GetActiveWebContents();
+ // For the duration of the test, assume the tab has been hovered. This adds a
+ // subview containing the actual source of the tooltip.
+ [controller_ setHoveredTab:tab];
+ // Note -[NSView hitTest:] takes superview coordinates. Then, find a spot that
+ // is outside the mask image, but inside the tab.
+ NSPoint centerPoint = NSMakePoint(5, NSMidY([tab bounds]));
+ NSPoint hitPoint = [tab convertPoint:centerPoint
+ toView:[tab_strip_ superview]];
+ NSView* toolTipView = [tab_strip_ hitTest:hitPoint];
+ EXPECT_TRUE(toolTipView);
+ EXPECT_NE(toolTipView, tab);
+
// Initially, tab title and tooltip text are equivalent.
EXPECT_EQ(TabAlertState::NONE,
chrome::GetTabAlertStateForContents(contents));
[controller_ setTabTitle:tabController withContents:contents];
NSString* const baseTitle = [tabController title];
EXPECT_NSEQ(baseTitle, [tabController toolTip]);
+ EXPECT_NSEQ([tabController toolTip], [toolTipView toolTip]);
// Simulate the start of tab video capture. Tab title remains the same, but
// the tooltip text should include the following appended: 1) a line break;
@@ -303,6 +316,7 @@ TEST_F(TabStripControllerTest, CorrectTitleAndToolTipTextFromSetTabTitle) {
[controller_ setTabTitle:tabController withContents:contents];
EXPECT_NSEQ(baseTitle, [tabController title]);
NSString* const toolTipText = [tabController toolTip];
+ EXPECT_NSEQ(toolTipText, [toolTipView toolTip]);
tapted 2016/04/01 21:50:35 Verified this fails without the fix, with ../../c
if ([baseTitle length] > 0) {
EXPECT_TRUE(NSEqualRanges(NSMakeRange(0, [baseTitle length]),
[toolTipText rangeOfString:baseTitle]));
@@ -321,6 +335,7 @@ TEST_F(TabStripControllerTest, CorrectTitleAndToolTipTextFromSetTabTitle) {
[controller_ setTabTitle:tabController withContents:contents];
EXPECT_NSEQ(baseTitle, [tabController title]);
EXPECT_NSEQ(baseTitle, [tabController toolTip]);
+ EXPECT_NSEQ(baseTitle, [toolTipView toolTip]);
}
TEST_F(TabStripControllerTest, TabCloseDuringDrag) {
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698