| 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 #include <cmath> | 5 #include <cmath> |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 BookmarkBarFolderController* folderController = [bar_ folderController]; | 766 BookmarkBarFolderController* folderController = [bar_ folderController]; |
| 767 EXPECT_TRUE(folderController); | 767 EXPECT_TRUE(folderController); |
| 768 NSWindow* toWindow = [folderController window]; | 768 NSWindow* toWindow = [folderController window]; |
| 769 EXPECT_TRUE(toWindow); | 769 EXPECT_TRUE(toWindow); |
| 770 NSRect oldToWindowFrame = [toWindow frame]; | 770 NSRect oldToWindowFrame = [toWindow frame]; |
| 771 // Drag a bar button onto a bookmark (i.e. not a folder) in a folder | 771 // Drag a bar button onto a bookmark (i.e. not a folder) in a folder |
| 772 // so it should end up below the target bookmark. | 772 // so it should end up below the target bookmark. |
| 773 BookmarkButton* draggedButton = [bar_ buttonWithTitleEqualTo:@"1b"]; | 773 BookmarkButton* draggedButton = [bar_ buttonWithTitleEqualTo:@"1b"]; |
| 774 ASSERT_TRUE(draggedButton); | 774 ASSERT_TRUE(draggedButton); |
| 775 CGFloat horizontalShift = | 775 CGFloat horizontalShift = |
| 776 NSWidth([draggedButton frame]) + bookmarks::kBookmarkHorizontalPadding; | 776 NSWidth([draggedButton frame]) + bookmarks::BookmarkHorizontalPadding(); |
| 777 BookmarkButton* targetButton = | 777 BookmarkButton* targetButton = |
| 778 [folderController buttonWithTitleEqualTo:@"2f1b"]; | 778 [folderController buttonWithTitleEqualTo:@"2f1b"]; |
| 779 ASSERT_TRUE(targetButton); | 779 ASSERT_TRUE(targetButton); |
| 780 [folderController dragButton:draggedButton | 780 [folderController dragButton:draggedButton |
| 781 to:[targetButton center] | 781 to:[targetButton center] |
| 782 copy:NO]; | 782 copy:NO]; |
| 783 // The button should have landed just after "2f1b". | 783 // The button should have landed just after "2f1b". |
| 784 const std::string expected_string("2f:[ 2f1b 1b 2f2f:[ 2f2f1b " | 784 const std::string expected_string("2f:[ 2f1b 1b 2f2f:[ 2f2f1b " |
| 785 "2f2f2b 2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ " | 785 "2f2f2b 2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ " |
| 786 "4f2f1b 4f2f2b 4f2f3b ] 4f3f:[ 4f3f1b 4f3f2b 4f3f3b ] ] 5b "); | 786 "4f2f1b 4f2f2b 4f2f3b ] 4f3f:[ 4f3f1b 4f3f2b 4f3f3b ] ] 5b "); |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 DeleteBookmark([folder parentButton], profile()); | 1662 DeleteBookmark([folder parentButton], profile()); |
| 1663 EXPECT_FALSE([folder folderController]); | 1663 EXPECT_FALSE([folder folderController]); |
| 1664 } | 1664 } |
| 1665 | 1665 |
| 1666 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so | 1666 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so |
| 1667 // they are hard to test. Factor out "fire timers" into routines | 1667 // they are hard to test. Factor out "fire timers" into routines |
| 1668 // which can be overridden to fire immediately to make behavior | 1668 // which can be overridden to fire immediately to make behavior |
| 1669 // confirmable. | 1669 // confirmable. |
| 1670 // There is a similar problem with mouseEnteredButton: and | 1670 // There is a similar problem with mouseEnteredButton: and |
| 1671 // mouseExitedButton:. | 1671 // mouseExitedButton:. |
| OLD | NEW |