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

Unified Diff: chrome/browser/ui/cocoa/browser_window_touch_bar_unittest.mm

Issue 2860163004: [Mac] Fix for Tab Fullscreen Touch Bar (Closed)
Patch Set: Nits Created 3 years, 7 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/browser_window_touch_bar.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/browser_window_touch_bar_unittest.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_touch_bar_unittest.mm b/chrome/browser/ui/cocoa/browser_window_touch_bar_unittest.mm
index 94b131aca749137e2aa705031cef26543f85549a..0f8d1cbad6df6d682b9b74c5125771b21d052355 100644
--- a/chrome/browser/ui/cocoa/browser_window_touch_bar_unittest.mm
+++ b/chrome/browser/ui/cocoa/browser_window_touch_bar_unittest.mm
@@ -39,6 +39,16 @@ class BrowserWindowTouchBarUnitTest : public CocoaProfileTest {
id bwc() const { return bwc_; }
+ NSString* GetFullscreenTouchBarItemId(NSString* id) {
+ return [BrowserWindowTouchBar identifierForTouchBarId:@"tab-fullscreen"
+ itemId:id];
+ }
+
+ NSString* GetBrowserTouchBarItemId(NSString* id) {
+ return [BrowserWindowTouchBar identifierForTouchBarId:@"browser-window"
Avi (use Gerrit) 2017/05/05 19:09:34 :( Can't we reuse the constants that you declared?
spqchan 2017/05/05 22:38:09 Done.
+ itemId:id];
+ }
+
void TearDown() override { CocoaProfileTest::TearDown(); }
// A mock BrowserWindowController object.
@@ -68,44 +78,40 @@ TEST_F(BrowserWindowTouchBarUnitTest, TouchBarItems) {
NSTouchBar* touch_bar = [touch_bar_ makeTouchBar];
NSArray* touch_bar_items = [touch_bar itemIdentifiers];
EXPECT_TRUE([touch_bar_items
- containsObject:[BrowserWindowTouchBar
- touchBarIdForItemId:@"FULLSCREEN-ORIGIN-LABEL"]]);
+ containsObject:GetFullscreenTouchBarItemId(@"FULLSCREEN-ORIGIN-LABEL")]);
EXPECT_TRUE([[touch_bar escapeKeyReplacementItemIdentifier]
- isEqualToString:[BrowserWindowTouchBar
- touchBarIdForItemId:@"EXIT-FULLSCREEN"]]);
+ isEqualToString:GetFullscreenTouchBarItemId(@"EXIT-FULLSCREEN")]);
BOOL no = NO;
[[[bwc() stub] andReturnValue:OCMOCK_VALUE(no)]
isFullscreenForTabContentOrExtension];
touch_bar_items = [[touch_bar_ makeTouchBar] itemIdentifiers];
- EXPECT_TRUE([touch_bar_items
- containsObject:[BrowserWindowTouchBar touchBarIdForItemId:@"BACK-FWD"]]);
EXPECT_TRUE(
- [touch_bar_items containsObject:[BrowserWindowTouchBar
- touchBarIdForItemId:@"RELOAD-STOP"]]);
+ [touch_bar_items containsObject:GetBrowserTouchBarItemId(@"BACK-FWD")]);
EXPECT_TRUE([touch_bar_items
- containsObject:[BrowserWindowTouchBar touchBarIdForItemId:@"HOME"]]);
- EXPECT_TRUE([touch_bar_items
- containsObject:[BrowserWindowTouchBar touchBarIdForItemId:@"SEARCH"]]);
- EXPECT_TRUE([touch_bar_items
- containsObject:[BrowserWindowTouchBar touchBarIdForItemId:@"BOOKMARK"]]);
- EXPECT_TRUE([touch_bar_items
- containsObject:[BrowserWindowTouchBar touchBarIdForItemId:@"NEW-TAB"]]);
+ containsObject:GetBrowserTouchBarItemId(@"RELOAD-STOP")]);
+ EXPECT_TRUE(
+ [touch_bar_items containsObject:GetBrowserTouchBarItemId(@"HOME")]);
+ EXPECT_TRUE(
+ [touch_bar_items containsObject:GetBrowserTouchBarItemId(@"SEARCH")]);
+ EXPECT_TRUE(
+ [touch_bar_items containsObject:GetBrowserTouchBarItemId(@"BOOKMARK")]);
+ EXPECT_TRUE(
+ [touch_bar_items containsObject:GetBrowserTouchBarItemId(@"NEW-TAB")]);
prefs->SetBoolean(prefs::kShowHomeButton, false);
touch_bar_items = [[touch_bar_ makeTouchBar] itemIdentifiers];
- EXPECT_TRUE([touch_bar_items
- containsObject:[BrowserWindowTouchBar touchBarIdForItemId:@"BACK-FWD"]]);
EXPECT_TRUE(
- [touch_bar_items containsObject:[BrowserWindowTouchBar
- touchBarIdForItemId:@"RELOAD-STOP"]]);
- EXPECT_TRUE([touch_bar_items
- containsObject:[BrowserWindowTouchBar touchBarIdForItemId:@"SEARCH"]]);
+ [touch_bar_items containsObject:GetBrowserTouchBarItemId(@"BACK-FWD")]);
EXPECT_TRUE([touch_bar_items
- containsObject:[BrowserWindowTouchBar touchBarIdForItemId:@"BOOKMARK"]]);
- EXPECT_TRUE([touch_bar_items
- containsObject:[BrowserWindowTouchBar touchBarIdForItemId:@"NEW-TAB"]]);
+ containsObject:GetBrowserTouchBarItemId(@"RELOAD-STOP")]);
+ EXPECT_TRUE(
+ [touch_bar_items containsObject:GetBrowserTouchBarItemId(@"SEARCH")]);
+ EXPECT_TRUE(
+ [touch_bar_items containsObject:GetBrowserTouchBarItemId(@"BOOKMARK")]);
+ EXPECT_TRUE(
+ [touch_bar_items containsObject:GetBrowserTouchBarItemId(@"NEW-TAB")]);
}
// Tests the reload or stop touch bar item.
@@ -122,13 +128,11 @@ TEST_F(BrowserWindowTouchBarUnitTest, ReloadOrStopTouchBarItem) {
NSTouchBarItem* item =
[touch_bar_ touchBar:touch_bar
- makeItemForIdentifier:[BrowserWindowTouchBar
- touchBarIdForItemId:@"RELOAD-STOP"]];
+ makeItemForIdentifier:GetBrowserTouchBarItemId(@"RELOAD-STOP")];
EXPECT_EQ(IDC_RELOAD, [[item view] tag]);
[touch_bar_ setIsPageLoading:YES];
item = [touch_bar_ touchBar:touch_bar
- makeItemForIdentifier:[BrowserWindowTouchBar
- touchBarIdForItemId:@"RELOAD-STOP"]];
+ makeItemForIdentifier:GetBrowserTouchBarItemId(@"RELOAD-STOP")];
EXPECT_EQ(IDC_STOP, [[item view] tag]);
}
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_touch_bar.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698