OLD | NEW |
---|---|
(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 #import <Cocoa/Cocoa.h> | |
6 | |
7 #include "base/mac/mac_util.h" | |
8 #include "base/mac/scoped_nsobject.h" | |
9 #include "chrome/app/chrome_command_ids.h" | |
10 #import "chrome/browser/ui/cocoa/browser_window_touch_bar.h" | |
11 #include "chrome/browser/ui/cocoa/test/cocoa_profile_test.h" | |
12 #include "testing/gtest/include/gtest/gtest.h" | |
13 | |
14 class BrowserWindowTouchBarUnitTest : public CocoaProfileTest { | |
15 public: | |
16 void SetUp() override { | |
17 CocoaProfileTest::SetUp(); | |
18 ASSERT_TRUE(browser()); | |
19 browserWindowTouchBar_.reset( | |
20 [[BrowserWindowTouchBar alloc] initWithBrowser:browser()]); | |
21 } | |
22 | |
23 void TearDown() override { CocoaProfileTest::TearDown(); } | |
24 | |
25 base::scoped_nsobject<BrowserWindowTouchBar> browserWindowTouchBar_; | |
26 }; | |
27 | |
28 TEST_F(BrowserWindowTouchBarUnitTest, TouchBarItems) { | |
29 if (base::mac::IsAtMostOS10_12()) | |
30 return; | |
31 | |
32 NSTouchBar* touchBar = [browserWindowTouchBar_ makeTouchBar]; | |
33 NSArray* touchBarItemIds = [touchBar itemIdentifiers]; | |
34 DCHECK([touchBarItemIds containsObject:@"BackForwardTouchId"]); | |
Robert Sesek
2017/02/16 19:13:39
Change DCHECK -> EXPECT_TRUE
spqchan
2017/02/16 19:27:48
Done.
| |
35 DCHECK([touchBarItemIds containsObject:@"ReloadOrStopTouchId"]); | |
36 DCHECK([touchBarItemIds containsObject:@"SearchTouchId"]); | |
37 DCHECK([touchBarItemIds containsObject:@"NewTabTouchId"]); | |
38 DCHECK([touchBarItemIds containsObject:@"StarTouchId"]); | |
39 } | |
40 | |
41 TEST_F(BrowserWindowTouchBarUnitTest, ReloadOrStopTouchBarItem) { | |
42 if (base::mac::IsAtMostOS10_12()) | |
43 return; | |
44 | |
45 NSTouchBar* touchBar = [browserWindowTouchBar_ makeTouchBar]; | |
46 [browserWindowTouchBar_ setIsPageLoading:NO]; | |
47 NSTouchBarItem* item = | |
48 [browserWindowTouchBar_ touchBar:touchBar | |
49 makeItemForIdentifier:@"ReloadOrStopTouchId"]; | |
50 | |
51 DCHECK_EQ(IDC_RELOAD, [[item view] tag]); | |
Robert Sesek
2017/02/16 19:13:38
DCHECK_EQ -> EXPECT_EQ
spqchan
2017/02/16 19:27:48
Done.
| |
52 | |
53 [browserWindowTouchBar_ setIsPageLoading:YES]; | |
54 item = [browserWindowTouchBar_ touchBar:touchBar | |
55 makeItemForIdentifier:@"ReloadOrStopTouchId"]; | |
56 | |
57 DCHECK_EQ(IDC_STOP, [[item view] tag]); | |
Robert Sesek
2017/02/16 19:13:39
Same.
spqchan
2017/02/16 19:27:48
Done.
| |
58 } | |
OLD | NEW |