| 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/memory/scoped_nsobject.h" | 5 #include "base/memory/scoped_nsobject.h" |
| 6 #include "base/string16.h" | 6 #include "base/string16.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h" | 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h" |
| 13 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 13 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| 14 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" | 14 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
| 15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" | 15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" |
| 16 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 16 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 17 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 17 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 18 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 18 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
| 19 #include "chrome/test/base/ui_test_utils.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "testing/platform_test.h" | 21 #include "testing/platform_test.h" |
| 21 #import "third_party/mozilla/NSPasteboard+Utils.h" | 22 #import "third_party/mozilla/NSPasteboard+Utils.h" |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 // Some values used for mocks and fakes. | 25 // Some values used for mocks and fakes. |
| 25 const CGFloat kFakeIndicatorPos = 7.0; | 26 const CGFloat kFakeIndicatorPos = 7.0; |
| 26 const NSPoint kPoint = {10, 10}; | 27 const NSPoint kPoint = {10, 10}; |
| 27 }; | 28 }; |
| 28 | 29 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 TEST_F(BookmarkBarViewTest, BookmarkButtonDragAndDropAcrossProfiles) { | 245 TEST_F(BookmarkBarViewTest, BookmarkButtonDragAndDropAcrossProfiles) { |
| 245 scoped_nsobject<FakeBookmarkDraggingInfo> | 246 scoped_nsobject<FakeBookmarkDraggingInfo> |
| 246 info([[FakeBookmarkDraggingInfo alloc] init]); | 247 info([[FakeBookmarkDraggingInfo alloc] init]); |
| 247 [view_ setController:info.get()]; | 248 [view_ setController:info.get()]; |
| 248 [info reset]; | 249 [info reset]; |
| 249 | 250 |
| 250 // |other_profile| is owned by the |testing_profile_manager|. | 251 // |other_profile| is owned by the |testing_profile_manager|. |
| 251 TestingProfile* other_profile = | 252 TestingProfile* other_profile = |
| 252 testing_profile_manager()->CreateTestingProfile("other"); | 253 testing_profile_manager()->CreateTestingProfile("other"); |
| 253 other_profile->CreateBookmarkModel(true); | 254 other_profile->CreateBookmarkModel(true); |
| 254 other_profile->BlockUntilBookmarkModelLoaded(); | |
| 255 | 255 |
| 256 BookmarkModel* bookmark_model = | 256 BookmarkModel* bookmark_model = |
| 257 BookmarkModelFactory::GetForProfile(profile()); | 257 BookmarkModelFactory::GetForProfile(profile()); |
| 258 ui_test_utils::WaitForBookmarkModelToLoad(bookmark_model); |
| 259 |
| 258 const BookmarkNode* node = | 260 const BookmarkNode* node = |
| 259 bookmark_model->AddURL(bookmark_model->bookmark_bar_node(), | 261 bookmark_model->AddURL(bookmark_model->bookmark_bar_node(), |
| 260 0, | 262 0, |
| 261 ASCIIToUTF16("Test Bookmark"), | 263 ASCIIToUTF16("Test Bookmark"), |
| 262 GURL("http://www.exmaple.com")); | 264 GURL("http://www.exmaple.com")); |
| 263 | 265 |
| 264 scoped_nsobject<BookmarkButtonCell> button_cell( | 266 scoped_nsobject<BookmarkButtonCell> button_cell( |
| 265 [[BookmarkButtonCell buttonCellForNode:node | 267 [[BookmarkButtonCell buttonCellForNode:node |
| 266 text:nil | 268 text:nil |
| 267 image:nil | 269 image:nil |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 EXPECT_TRUE([info draggingEnteredCalled]); // Ensure controller pinged. | 314 EXPECT_TRUE([info draggingEnteredCalled]); // Ensure controller pinged. |
| 313 EXPECT_TRUE([view_ dropIndicatorShown]); | 315 EXPECT_TRUE([view_ dropIndicatorShown]); |
| 314 EXPECT_EQ([view_ dropIndicatorPosition], kFakeIndicatorPos); | 316 EXPECT_EQ([view_ dropIndicatorPosition], kFakeIndicatorPos); |
| 315 | 317 |
| 316 [info setDropIndicatorShown:NO]; | 318 [info setDropIndicatorShown:NO]; |
| 317 EXPECT_EQ([view_ draggingEntered:(id)info.get()], NSDragOperationMove); | 319 EXPECT_EQ([view_ draggingEntered:(id)info.get()], NSDragOperationMove); |
| 318 EXPECT_FALSE([view_ dropIndicatorShown]); | 320 EXPECT_FALSE([view_ dropIndicatorShown]); |
| 319 } | 321 } |
| 320 | 322 |
| 321 } // namespace | 323 } // namespace |
| OLD | NEW |