| 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 "base/mac/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
| 6 #include "base/strings/string16.h" | 6 #include "base/strings/string16.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" | 9 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 EXPECT_EQ([view_ draggingEntered:drag_info], NSDragOperationMove); | 151 EXPECT_EQ([view_ draggingEntered:drag_info], NSDragOperationMove); |
| 152 EXPECT_TRUE([view_ performDragOperation:drag_info]); | 152 EXPECT_TRUE([view_ performDragOperation:drag_info]); |
| 153 } | 153 } |
| 154 | 154 |
| 155 // When dragging bookmarks across profiles, we should always copy, never move. | 155 // When dragging bookmarks across profiles, we should always copy, never move. |
| 156 TEST_F(BookmarkBarFolderViewTest, BookmarkButtonDragAndDropAcrossProfiles) { | 156 TEST_F(BookmarkBarFolderViewTest, BookmarkButtonDragAndDropAcrossProfiles) { |
| 157 // |other_profile| is owned by the |testing_profile_manager|. | 157 // |other_profile| is owned by the |testing_profile_manager|. |
| 158 TestingProfile* other_profile = | 158 TestingProfile* other_profile = |
| 159 testing_profile_manager()->CreateTestingProfile("other"); | 159 testing_profile_manager()->CreateTestingProfile("other"); |
| 160 other_profile->CreateBookmarkModel(true); | 160 other_profile->CreateBookmarkModel(true); |
| 161 test::WaitForBookmarkModelToLoad(other_profile); | 161 test::WaitForBookmarkModelToLoad( |
| 162 BookmarkModelFactory::GetForProfile(other_profile)); |
| 162 | 163 |
| 163 mock_controller_.reset(GetMockController( | 164 mock_controller_.reset(GetMockController( |
| 164 YES, BookmarkModelFactory::GetForProfile(other_profile))); | 165 YES, BookmarkModelFactory::GetForProfile(other_profile))); |
| 165 [view_ setController:mock_controller_]; | 166 [view_ setController:mock_controller_]; |
| 166 | 167 |
| 167 id drag_info = GetFakeDragInfoForType(kBookmarkButtonDragType); | 168 id drag_info = GetFakeDragInfoForType(kBookmarkButtonDragType); |
| 168 [[[mock_controller_ expect] andReturnUnsignedInteger:NSDragOperationNone] | 169 [[[mock_controller_ expect] andReturnUnsignedInteger:NSDragOperationNone] |
| 169 draggingEntered:drag_info]; | 170 draggingEntered:drag_info]; |
| 170 [[[mock_controller_ expect] andReturnBool:NO] dragBookmarkData:drag_info]; | 171 [[[mock_controller_ expect] andReturnBool:NO] dragBookmarkData:drag_info]; |
| 171 [[[mock_controller_ expect] andReturnBool:YES] dragButton:OCMOCK_ANY | 172 [[[mock_controller_ expect] andReturnBool:YES] dragButton:OCMOCK_ANY |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 mock_controller_.reset(GetMockController( | 204 mock_controller_.reset(GetMockController( |
| 204 NO, BookmarkModelFactory::GetForProfile(profile()))); | 205 NO, BookmarkModelFactory::GetForProfile(profile()))); |
| 205 [view_ setController:mock_controller_]; | 206 [view_ setController:mock_controller_]; |
| 206 [[[mock_controller_ expect] andReturnUnsignedInteger:NSDragOperationNone] | 207 [[[mock_controller_ expect] andReturnUnsignedInteger:NSDragOperationNone] |
| 207 draggingEntered:drag_info]; | 208 draggingEntered:drag_info]; |
| 208 EXPECT_EQ([view_ draggingEntered:drag_info], NSDragOperationMove); | 209 EXPECT_EQ([view_ draggingEntered:drag_info], NSDragOperationMove); |
| 209 EXPECT_FALSE([view_ dropIndicatorShown]); | 210 EXPECT_FALSE([view_ dropIndicatorShown]); |
| 210 } | 211 } |
| 211 | 212 |
| 212 } // namespace | 213 } // namespace |
| OLD | NEW |