| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 | 740 |
| 741 base::scoped_nsobject<BookmarkButtonCell> cell( | 741 base::scoped_nsobject<BookmarkButtonCell> cell( |
| 742 [[BookmarkButtonCell alloc] init]); | 742 [[BookmarkButtonCell alloc] init]); |
| 743 [cell setBookmarkNode:node.get()]; | 743 [cell setBookmarkNode:node.get()]; |
| 744 base::scoped_nsobject<BookmarkButton> button([[BookmarkButton alloc] init]); | 744 base::scoped_nsobject<BookmarkButton> button([[BookmarkButton alloc] init]); |
| 745 [button setCell:cell.get()]; | 745 [button setCell:cell.get()]; |
| 746 [cell setRepresentedObject:[NSValue valueWithPointer:node.get()]]; | 746 [cell setRepresentedObject:[NSValue valueWithPointer:node.get()]]; |
| 747 | 747 |
| 748 [bar_ openBookmark:button]; | 748 [bar_ openBookmark:button]; |
| 749 EXPECT_EQ(noOpenBar()->urls_[0], node->url()); | 749 EXPECT_EQ(noOpenBar()->urls_[0], node->url()); |
| 750 EXPECT_EQ(noOpenBar()->dispositions_[0], CURRENT_TAB); | 750 EXPECT_EQ(noOpenBar()->dispositions_[0], WindowOpenDisposition::CURRENT_TAB); |
| 751 } | 751 } |
| 752 | 752 |
| 753 TEST_F(BookmarkBarControllerTest, TestAddRemoveAndClear) { | 753 TEST_F(BookmarkBarControllerTest, TestAddRemoveAndClear) { |
| 754 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile()); | 754 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile()); |
| 755 NSView* buttonView = [bar_ buttonView]; | 755 NSView* buttonView = [bar_ buttonView]; |
| 756 EXPECT_EQ(0U, [[bar_ buttons] count]); | 756 EXPECT_EQ(0U, [[bar_ buttons] count]); |
| 757 unsigned int initial_subview_count = [[buttonView subviews] count]; | 757 unsigned int initial_subview_count = [[buttonView subviews] count]; |
| 758 | 758 |
| 759 // Make sure a redundant call doesn't choke | 759 // Make sure a redundant call doesn't choke |
| 760 [bar_ clearBookmarkBar]; | 760 [bar_ clearBookmarkBar]; |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 id fakeApp = [OCMockObject partialMockForObject:NSApp]; | 1786 id fakeApp = [OCMockObject partialMockForObject:NSApp]; |
| 1787 [[[fakeApp stub] andReturn:commandClick] currentEvent]; | 1787 [[[fakeApp stub] andReturn:commandClick] currentEvent]; |
| 1788 id oldApp = NSApp; | 1788 id oldApp = NSApp; |
| 1789 NSApp = fakeApp; | 1789 NSApp = fakeApp; |
| 1790 size_t originalDispositionCount = noOpenBar()->dispositions_.size(); | 1790 size_t originalDispositionCount = noOpenBar()->dispositions_.size(); |
| 1791 | 1791 |
| 1792 // Click! | 1792 // Click! |
| 1793 [first performClick:first]; | 1793 [first performClick:first]; |
| 1794 | 1794 |
| 1795 size_t dispositionCount = noOpenBar()->dispositions_.size(); | 1795 size_t dispositionCount = noOpenBar()->dispositions_.size(); |
| 1796 EXPECT_EQ(originalDispositionCount+1, dispositionCount); | 1796 EXPECT_EQ(originalDispositionCount + 1, dispositionCount); |
| 1797 EXPECT_EQ(noOpenBar()->dispositions_[dispositionCount-1], NEW_BACKGROUND_TAB); | 1797 EXPECT_EQ(noOpenBar()->dispositions_[dispositionCount - 1], |
| 1798 WindowOpenDisposition::NEW_BACKGROUND_TAB); |
| 1798 | 1799 |
| 1799 // Replace NSApp | 1800 // Replace NSApp |
| 1800 NSApp = oldApp; | 1801 NSApp = oldApp; |
| 1801 } | 1802 } |
| 1802 | 1803 |
| 1803 class BookmarkBarControllerNotificationTest : public CocoaProfileTest { | 1804 class BookmarkBarControllerNotificationTest : public CocoaProfileTest { |
| 1804 public: | 1805 public: |
| 1805 void SetUp() override { | 1806 void SetUp() override { |
| 1806 CocoaProfileTest::SetUp(); | 1807 CocoaProfileTest::SetUp(); |
| 1807 ASSERT_TRUE(browser()); | 1808 ASSERT_TRUE(browser()); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2205 "2f3b ] 4b "); | 2206 "2f3b ] 4b "); |
| 2206 actual = bookmarks::test::ModelStringFromNode(root); | 2207 actual = bookmarks::test::ModelStringFromNode(root); |
| 2207 EXPECT_EQ(expected, actual); | 2208 EXPECT_EQ(expected, actual); |
| 2208 | 2209 |
| 2209 // Verify that the other bookmark folder can't be deleted. | 2210 // Verify that the other bookmark folder can't be deleted. |
| 2210 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; | 2211 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; |
| 2211 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); | 2212 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); |
| 2212 } | 2213 } |
| 2213 | 2214 |
| 2214 } // namespace | 2215 } // namespace |
| OLD | NEW |