| 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 ASSERT_TRUE(targetButton); | 783 ASSERT_TRUE(targetButton); |
| 784 [folderController dragButton:draggedButton | 784 [folderController dragButton:draggedButton |
| 785 to:[targetButton center] | 785 to:[targetButton center] |
| 786 copy:NO]; | 786 copy:NO]; |
| 787 // The button should have landed just after "2f1b". | 787 // The button should have landed just after "2f1b". |
| 788 const std::string expected_string("2f:[ 2f1b 1b 2f2f:[ 2f2f1b " | 788 const std::string expected_string("2f:[ 2f1b 1b 2f2f:[ 2f2f1b " |
| 789 "2f2f2b 2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ " | 789 "2f2f2b 2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ " |
| 790 "4f2f1b 4f2f2b 4f2f3b ] 4f3f:[ 4f3f1b 4f3f2b 4f3f3b ] ] 5b "); | 790 "4f2f1b 4f2f2b 4f2f3b ] 4f3f:[ 4f3f1b 4f3f2b 4f3f3b ] ] 5b "); |
| 791 EXPECT_EQ(expected_string, bookmarks::test::ModelStringFromNode(root)); | 791 EXPECT_EQ(expected_string, bookmarks::test::ModelStringFromNode(root)); |
| 792 | 792 |
| 793 // Verify the window still appears by looking for its controller. | 793 // Reopen the window. |
| 794 [[toFolder target] performSelector:@selector(openBookmarkFolderFromButton:) |
| 795 withObject:toFolder]; |
| 794 EXPECT_TRUE([bar_ folderController]); | 796 EXPECT_TRUE([bar_ folderController]); |
| 797 folderController = [bar_ folderController]; |
| 795 | 798 |
| 796 // Gather the new frames. | 799 // Gather the new frames. |
| 797 NSRect newToFolderFrame = [toFolder frame]; | 800 NSRect newToFolderFrame = [toFolder frame]; |
| 798 NSRect newToWindowFrame = [toWindow frame]; | 801 NSRect newToWindowFrame = [toWindow frame]; |
| 799 // The toFolder should have shifted left horizontally but not vertically. | 802 // The toFolder should have shifted left horizontally but not vertically. |
| 800 NSRect expectedToFolderFrame = | 803 NSRect expectedToFolderFrame = |
| 801 NSOffsetRect(oldToFolderFrame, -horizontalShift, 0); | 804 NSOffsetRect(oldToFolderFrame, -horizontalShift, 0); |
| 802 EXPECT_NSRECT_EQ(expectedToFolderFrame, newToFolderFrame); | 805 EXPECT_NSRECT_EQ(expectedToFolderFrame, newToFolderFrame); |
| 803 // The toWindow should have shifted left horizontally, down vertically, | 806 // The toWindow should have shifted left horizontally, down vertically, |
| 804 // and grown vertically. | 807 // and grown vertically. |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 DeleteBookmark([folder parentButton], profile()); | 1727 DeleteBookmark([folder parentButton], profile()); |
| 1725 EXPECT_FALSE([folder folderController]); | 1728 EXPECT_FALSE([folder folderController]); |
| 1726 } | 1729 } |
| 1727 | 1730 |
| 1728 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so | 1731 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so |
| 1729 // they are hard to test. Factor out "fire timers" into routines | 1732 // they are hard to test. Factor out "fire timers" into routines |
| 1730 // which can be overridden to fire immediately to make behavior | 1733 // which can be overridden to fire immediately to make behavior |
| 1731 // confirmable. | 1734 // confirmable. |
| 1732 // There is a similar problem with mouseEnteredButton: and | 1735 // There is a similar problem with mouseEnteredButton: and |
| 1733 // mouseExitedButton:. | 1736 // mouseExitedButton:. |
| OLD | NEW |