| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/scoped_nsobject.h" | 5 #include "base/scoped_nsobject.h" |
| 6 #import "chrome/browser/cocoa/bookmark_bar_view.h" | 6 #import "chrome/browser/cocoa/bookmark_bar_view.h" |
| 7 #import "chrome/browser/cocoa/bookmark_button.h" | 7 #import "chrome/browser/cocoa/bookmark_button.h" |
| 8 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 8 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 - (BOOL)dragButton:(BookmarkButton*)button to:(NSPoint)point { | 53 - (BOOL)dragButton:(BookmarkButton*)button to:(NSPoint)point { |
| 54 pong_ = YES; | 54 pong_ = YES; |
| 55 return YES; | 55 return YES; |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Confirm the pong. | 58 // Confirm the pong. |
| 59 - (BOOL)dragButtonToPong { | 59 - (BOOL)dragButtonToPong { |
| 60 return pong_; | 60 return pong_; |
| 61 } | 61 } |
| 62 | 62 |
| 63 - (CGFloat)indicatorPosForDragOfButton:(BookmarkButton*)sourceButton |
| 64 toPoint:(NSPoint)point { |
| 65 return 0; |
| 66 } |
| 67 |
| 63 @end | 68 @end |
| 64 | 69 |
| 65 namespace { | 70 namespace { |
| 66 | 71 |
| 67 class BookmarkBarViewTest : public CocoaTest { | 72 class BookmarkBarViewTest : public CocoaTest { |
| 68 public: | 73 public: |
| 69 scoped_nsobject<BookmarkBarView> view_; | 74 scoped_nsobject<BookmarkBarView> view_; |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 TEST_F(BookmarkBarViewTest, CanDragWindow) { | 77 TEST_F(BookmarkBarViewTest, CanDragWindow) { |
| 73 view_.reset([[BookmarkBarView alloc] init]); | 78 view_.reset([[BookmarkBarView alloc] init]); |
| 74 EXPECT_FALSE([view_.get() mouseDownCanMoveWindow]); | 79 EXPECT_FALSE([view_.get() mouseDownCanMoveWindow]); |
| 75 } | 80 } |
| 76 | 81 |
| 77 TEST_F(BookmarkBarViewTest, BookmarkButtonDragAndDrop) { | 82 TEST_F(BookmarkBarViewTest, BookmarkButtonDragAndDrop) { |
| 78 view_.reset([[BookmarkBarView alloc] init]); | 83 view_.reset([[BookmarkBarView alloc] init]); |
| 79 scoped_nsobject<FakeBookmarkDraggingInfo> | 84 scoped_nsobject<FakeBookmarkDraggingInfo> |
| 80 info([[FakeBookmarkDraggingInfo alloc] init]); | 85 info([[FakeBookmarkDraggingInfo alloc] init]); |
| 81 | 86 |
| 82 [view_ setController:info.get()]; | 87 [view_ setController:info.get()]; |
| 83 EXPECT_EQ([view_ draggingEntered:(id)info.get()], NSDragOperationMove); | 88 EXPECT_EQ([view_ draggingEntered:(id)info.get()], NSDragOperationMove); |
| 84 EXPECT_TRUE([view_ performDragOperation:(id)info.get()]); | 89 EXPECT_TRUE([view_ performDragOperation:(id)info.get()]); |
| 85 EXPECT_TRUE([info dragButtonToPong]); | 90 EXPECT_TRUE([info dragButtonToPong]); |
| 86 } | 91 } |
| 87 | 92 |
| 88 } // namespace | 93 } // namespace |
| OLD | NEW |