| 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 virtual void SetUp() { | 74 virtual void SetUp() { |
| 70 CocoaTest::SetUp(); | 75 CocoaTest::SetUp(); |
| 71 view_.reset([[BookmarkBarView alloc] init]); | 76 view_.reset([[BookmarkBarView alloc] init]); |
| 72 } | 77 } |
| 73 | 78 |
| 74 scoped_nsobject<BookmarkBarView> view_; | 79 scoped_nsobject<BookmarkBarView> view_; |
| 75 }; | 80 }; |
| 76 | 81 |
| 77 TEST_F(BookmarkBarViewTest, CanDragWindow) { | 82 TEST_F(BookmarkBarViewTest, CanDragWindow) { |
| 78 EXPECT_FALSE([view_ mouseDownCanMoveWindow]); | 83 EXPECT_FALSE([view_ mouseDownCanMoveWindow]); |
| 79 } | 84 } |
| 80 | 85 |
| 81 TEST_F(BookmarkBarViewTest, BookmarkButtonDragAndDrop) { | 86 TEST_F(BookmarkBarViewTest, BookmarkButtonDragAndDrop) { |
| 82 scoped_nsobject<FakeBookmarkDraggingInfo> | 87 scoped_nsobject<FakeBookmarkDraggingInfo> |
| 83 info([[FakeBookmarkDraggingInfo alloc] init]); | 88 info([[FakeBookmarkDraggingInfo alloc] init]); |
| 84 | 89 |
| 85 [view_ setController:info.get()]; | 90 [view_ setController:info.get()]; |
| 86 EXPECT_EQ([view_ draggingEntered:(id)info.get()], NSDragOperationMove); | 91 EXPECT_EQ([view_ draggingEntered:(id)info.get()], NSDragOperationMove); |
| 87 EXPECT_TRUE([view_ performDragOperation:(id)info.get()]); | 92 EXPECT_TRUE([view_ performDragOperation:(id)info.get()]); |
| 88 EXPECT_TRUE([info dragButtonToPong]); | 93 EXPECT_TRUE([info dragButtonToPong]); |
| 89 } | 94 } |
| 90 | 95 |
| 91 } // namespace | 96 } // namespace |
| OLD | NEW |