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_controller.h" | 6 #import "chrome/browser/cocoa/bookmark_bar_controller.h" |
7 #import "chrome/browser/cocoa/bookmark_bar_view.h" | 7 #import "chrome/browser/cocoa/bookmark_bar_view.h" |
8 #import "chrome/browser/cocoa/bookmark_button.h" | 8 #import "chrome/browser/cocoa/bookmark_button.h" |
9 #import "chrome/browser/cocoa/bookmark_folder_target.h" | 9 #import "chrome/browser/cocoa/bookmark_folder_target.h" |
10 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
13 #import "third_party/mozilla/NSPasteboard+Utils.h" | 13 #import "third_party/mozilla/NSPasteboard+Utils.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 const CGFloat kFakeIndicatorPos = 7.0; | 16 const CGFloat kFakeIndicatorPos = 7.0; |
17 }; | 17 }; |
18 | 18 |
19 // Fake DraggingInfo, fake BookmarkBarController, fake NSPasteboard... | 19 // Fake DraggingInfo, fake BookmarkBarController, fake NSPasteboard... |
20 @interface FakeBookmarkDraggingInfo : NSObject { | 20 @interface FakeBookmarkDraggingInfo : NSObject { |
21 @public | 21 @public |
22 BOOL dragButtonToPong_; | 22 BOOL dragButtonToPong_; |
23 BOOL dragURLsPong_; | 23 BOOL dragURLsPong_; |
24 BOOL dragBookmarkDataPong_; | 24 BOOL dragBookmarkDataPong_; |
25 BOOL dropIndicatorShown_; | 25 BOOL dropIndicatorShown_; |
26 BOOL draggingEnteredCalled_; | 26 BOOL draggingEnteredCalled_; |
27 // Only mock one type of drag data at a time. | 27 // Only mock one type of drag data at a time. |
28 NSString* dragDataType_; | 28 NSString* dragDataType_; |
29 } | 29 } |
30 @property (readwrite) BOOL dropIndicatorShown; | 30 @property (nonatomic) BOOL dropIndicatorShown; |
31 @property (readwrite) BOOL draggingEnteredCalled; | 31 @property (nonatomic) BOOL draggingEnteredCalled; |
32 @property (copy) NSString* dragDataType; | 32 @property (nonatomic, copy) NSString* dragDataType; |
33 @end | 33 @end |
34 | 34 |
35 @implementation FakeBookmarkDraggingInfo | 35 @implementation FakeBookmarkDraggingInfo |
36 | 36 |
37 @synthesize dropIndicatorShown = dropIndicatorShown_; | 37 @synthesize dropIndicatorShown = dropIndicatorShown_; |
38 @synthesize draggingEnteredCalled = draggingEnteredCalled_; | 38 @synthesize draggingEnteredCalled = draggingEnteredCalled_; |
39 @synthesize dragDataType = dragDataType_; | 39 @synthesize dragDataType = dragDataType_; |
40 | 40 |
41 - (id)init { | 41 - (id)init { |
42 if ((self = [super init])) { | 42 if ((self = [super init])) { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 EXPECT_TRUE([info draggingEnteredCalled]); // Ensure controller pinged. | 230 EXPECT_TRUE([info draggingEnteredCalled]); // Ensure controller pinged. |
231 EXPECT_TRUE([view_ dropIndicatorShown]); | 231 EXPECT_TRUE([view_ dropIndicatorShown]); |
232 EXPECT_EQ([view_ dropIndicatorPosition], kFakeIndicatorPos); | 232 EXPECT_EQ([view_ dropIndicatorPosition], kFakeIndicatorPos); |
233 | 233 |
234 [info setDropIndicatorShown:NO]; | 234 [info setDropIndicatorShown:NO]; |
235 EXPECT_EQ([view_ draggingEntered:(id)info.get()], NSDragOperationMove); | 235 EXPECT_EQ([view_ draggingEntered:(id)info.get()], NSDragOperationMove); |
236 EXPECT_FALSE([view_ dropIndicatorShown]); | 236 EXPECT_FALSE([view_ dropIndicatorShown]); |
237 } | 237 } |
238 | 238 |
239 } // namespace | 239 } // namespace |
OLD | NEW |