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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm

Issue 2798113002: [Mac] Remove more dead code from bookmark bar controller (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 659
660 [bar_ updateState:BookmarkBar::SHOW 660 [bar_ updateState:BookmarkBar::SHOW
661 changeType:BookmarkBar::DONT_ANIMATE_STATE_CHANGE]; 661 changeType:BookmarkBar::DONT_ANIMATE_STATE_CHANGE];
662 EXPECT_TRUE([bar_ dragShouldLockBarVisibility]); 662 EXPECT_TRUE([bar_ dragShouldLockBarVisibility]);
663 663
664 [bar_ updateState:BookmarkBar::DETACHED 664 [bar_ updateState:BookmarkBar::DETACHED
665 changeType:BookmarkBar::DONT_ANIMATE_STATE_CHANGE]; 665 changeType:BookmarkBar::DONT_ANIMATE_STATE_CHANGE];
666 EXPECT_FALSE([bar_ dragShouldLockBarVisibility]); 666 EXPECT_FALSE([bar_ dragShouldLockBarVisibility]);
667 } 667 }
668 668
669 TEST_F(BookmarkBarControllerTest, TagMap) {
670 int64_t ids[] = {1, 3, 4, 40, 400, 4000, 800000000, 2, 123456789};
671 std::vector<int32_t> tags;
672
673 // Generate some tags
674 for (unsigned int i = 0; i < arraysize(ids); i++) {
675 tags.push_back([bar_ menuTagFromNodeId:ids[i]]);
676 }
677
678 // Confirm reverse mapping.
679 for (unsigned int i = 0; i < arraysize(ids); i++) {
680 EXPECT_EQ(ids[i], [bar_ nodeIdFromMenuTag:tags[i]]);
681 }
682
683 // Confirm uniqueness.
684 std::sort(tags.begin(), tags.end());
685 for (unsigned int i=0; i<(tags.size()-1); i++) {
686 EXPECT_NE(tags[i], tags[i+1]);
687 }
688 }
689
690 // Confirm openBookmark: forwards the request to the controller's delegate 669 // Confirm openBookmark: forwards the request to the controller's delegate
691 TEST_F(BookmarkBarControllerTest, OpenBookmark) { 670 TEST_F(BookmarkBarControllerTest, OpenBookmark) {
692 GURL gurl("http://walla.walla.ding.dong.com"); 671 GURL gurl("http://walla.walla.ding.dong.com");
693 std::unique_ptr<BookmarkNode> node(new BookmarkNode(gurl)); 672 std::unique_ptr<BookmarkNode> node(new BookmarkNode(gurl));
694 673
695 base::scoped_nsobject<BookmarkButtonCell> cell( 674 base::scoped_nsobject<BookmarkButtonCell> cell(
696 [[BookmarkButtonCell alloc] init]); 675 [[BookmarkButtonCell alloc] init]);
697 [cell setBookmarkNode:node.get()]; 676 [cell setBookmarkNode:node.get()];
698 base::scoped_nsobject<BookmarkButton> button([[BookmarkButton alloc] init]); 677 base::scoped_nsobject<BookmarkButton> button([[BookmarkButton alloc] init]);
699 [button setCell:cell.get()]; 678 [button setCell:cell.get()];
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 "2f3b ] 4b "); 2153 "2f3b ] 4b ");
2175 actual = bookmarks::test::ModelStringFromNode(root); 2154 actual = bookmarks::test::ModelStringFromNode(root);
2176 EXPECT_EQ(expected, actual); 2155 EXPECT_EQ(expected, actual);
2177 2156
2178 // Verify that the other bookmark folder can't be deleted. 2157 // Verify that the other bookmark folder can't be deleted.
2179 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; 2158 BookmarkButton *otherButton = [bar_ otherBookmarksButton];
2180 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); 2159 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]);
2181 } 2160 }
2182 2161
2183 } // namespace 2162 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698