OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/scoped_nsobject.h" | 8 #include "base/scoped_nsobject.h" |
9 #import "chrome/browser/cocoa/bookmark_bar_constants.h" // namespace bookmarks | 9 #import "chrome/browser/cocoa/bookmark_bar_constants.h" // namespace bookmarks |
10 #import "chrome/browser/cocoa/bookmark_bar_controller.h" | 10 #import "chrome/browser/cocoa/bookmark_bar_controller.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | 139 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); |
140 for (int i = 0; i < kLotsOfNodesCount; i++) { | 140 for (int i = 0; i < kLotsOfNodesCount; i++) { |
141 model->AddURL(folderA_, folderA_->GetChildCount(), L"repeated title", | 141 model->AddURL(folderA_, folderA_->GetChildCount(), L"repeated title", |
142 GURL("http://www.google.com/repeated/url")); | 142 GURL("http://www.google.com/repeated/url")); |
143 } | 143 } |
144 return kLotsOfNodesCount; | 144 return kLotsOfNodesCount; |
145 } | 145 } |
146 | 146 |
147 | 147 |
148 // Return a simple BookmarkBarFolderController. | 148 // Return a simple BookmarkBarFolderController. |
149 BookmarkBarFolderController* SimpleBookmarkBarFolderController() { | 149 BookmarkBarFolderControllerPong* SimpleBookmarkBarFolderController() { |
150 BookmarkButton* parentButton = [[parentBarController_ buttons] | 150 BookmarkButton* parentButton = [[parentBarController_ buttons] |
151 objectAtIndex:0]; | 151 objectAtIndex:0]; |
152 BookmarkBarFolderController* c = | 152 BookmarkBarFolderControllerPong* c = |
153 [[BookmarkBarFolderControllerPong alloc] | 153 [[BookmarkBarFolderControllerPong alloc] |
154 initWithParentButton:parentButton | 154 initWithParentButton:parentButton |
155 parentController:nil | 155 parentController:nil |
156 barController:parentBarController_]; | 156 barController:parentBarController_]; |
157 [c window]; // Force nib load. | 157 [c window]; // Force nib load. |
158 return c; | 158 return c; |
159 } | 159 } |
160 }; | 160 }; |
161 | 161 |
162 TEST_F(BookmarkBarFolderControllerTest, InitCreateAndDelete) { | 162 TEST_F(BookmarkBarFolderControllerTest, InitCreateAndDelete) { |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 [[toFolder target] performSelector:@selector(openBookmarkFolderFromButton:) | 631 [[toFolder target] performSelector:@selector(openBookmarkFolderFromButton:) |
632 withObject:toFolder]; | 632 withObject:toFolder]; |
633 BookmarkBarFolderController* folderController = [bar_ folderController]; | 633 BookmarkBarFolderController* folderController = [bar_ folderController]; |
634 EXPECT_TRUE(folderController); | 634 EXPECT_TRUE(folderController); |
635 NSWindow* toWindow = [folderController window]; | 635 NSWindow* toWindow = [folderController window]; |
636 EXPECT_TRUE(toWindow); | 636 EXPECT_TRUE(toWindow); |
637 NSRect oldToWindowFrame = [toWindow frame]; | 637 NSRect oldToWindowFrame = [toWindow frame]; |
638 BookmarkButton* toSubfolder = | 638 BookmarkButton* toSubfolder = |
639 [folderController buttonWithTitleEqualTo:@"4f2f"]; | 639 [folderController buttonWithTitleEqualTo:@"4f2f"]; |
640 ASSERT_TRUE(toSubfolder); | 640 ASSERT_TRUE(toSubfolder); |
641 NSRect oldToSubfolderFrame = [toSubfolder frame]; | |
642 [[toSubfolder target] performSelector:@selector(openBookmarkFolderFromButton:) | 641 [[toSubfolder target] performSelector:@selector(openBookmarkFolderFromButton:) |
643 withObject:toSubfolder]; | 642 withObject:toSubfolder]; |
644 BookmarkBarFolderController* subfolderController = | 643 BookmarkBarFolderController* subfolderController = |
645 [folderController folderController]; | 644 [folderController folderController]; |
646 EXPECT_TRUE(subfolderController); | 645 EXPECT_TRUE(subfolderController); |
647 NSWindow* toSubwindow = [subfolderController window]; | 646 NSWindow* toSubwindow = [subfolderController window]; |
648 EXPECT_TRUE(toSubwindow); | 647 EXPECT_TRUE(toSubwindow); |
649 NSRect oldToSubwindowFrame = [toSubwindow frame]; | 648 NSRect oldToSubwindowFrame = [toSubwindow frame]; |
650 // Drag a bar button onto a bookmark (i.e. not a folder) in a folder | 649 // Drag a bar button onto a bookmark (i.e. not a folder) in a folder |
651 // so it should end up below the target bookmark. | 650 // so it should end up below the target bookmark. |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 [folder deleteBookmark:folder]; | 1244 [folder deleteBookmark:folder]; |
1246 EXPECT_FALSE([folder folderController]); | 1245 EXPECT_FALSE([folder folderController]); |
1247 } | 1246 } |
1248 | 1247 |
1249 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so | 1248 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so |
1250 // they are hard to test. Factor out "fire timers" into routines | 1249 // they are hard to test. Factor out "fire timers" into routines |
1251 // which can be overridden to fire immediately to make behavior | 1250 // which can be overridden to fire immediately to make behavior |
1252 // confirmable. | 1251 // confirmable. |
1253 // There is a similar problem with mouseEnteredButton: and | 1252 // There is a similar problem with mouseEnteredButton: and |
1254 // mouseExitedButton:. | 1253 // mouseExitedButton:. |
OLD | NEW |