| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 [bbfc setRealTopLeft:YES]; | 255 [bbfc setRealTopLeft:YES]; |
| 256 NSPoint pt = [bbfc windowTopLeftForWidth:0]; // screen coords | 256 NSPoint pt = [bbfc windowTopLeftForWidth:0]; // screen coords |
| 257 NSPoint buttonOriginInScreen = | 257 NSPoint buttonOriginInScreen = |
| 258 [[parentButton window] | 258 [[parentButton window] |
| 259 convertBaseToScreen:[parentButton | 259 convertBaseToScreen:[parentButton |
| 260 convertRectToBase:[parentButton frame]].origin]; | 260 convertRectToBase:[parentButton frame]].origin]; |
| 261 // Within margin | 261 // Within margin |
| 262 EXPECT_LE(abs(pt.x - buttonOriginInScreen.x), 2); | 262 EXPECT_LE(abs(pt.x - buttonOriginInScreen.x), 2); |
| 263 EXPECT_LE(abs(pt.y - buttonOriginInScreen.y), 2); | 263 EXPECT_LE(abs(pt.y - buttonOriginInScreen.y), 2); |
| 264 | 264 |
| 265 // Make sure we see the window shift left if it spills off the screen |
| 266 pt = [bbfc windowTopLeftForWidth:0]; |
| 267 NSPoint shifted = [bbfc windowTopLeftForWidth:9999999]; |
| 268 EXPECT_LT(shifted.x, pt.x); |
| 269 |
| 265 // If parent is a BookmarkBarFolderController, grow right. | 270 // If parent is a BookmarkBarFolderController, grow right. |
| 266 scoped_nsobject<BookmarkBarFolderControllerLow> bbfc2; | 271 scoped_nsobject<BookmarkBarFolderControllerLow> bbfc2; |
| 267 bbfc2.reset([[BookmarkBarFolderControllerLow alloc] | 272 bbfc2.reset([[BookmarkBarFolderControllerLow alloc] |
| 268 initWithParentButton:[[bbfc buttons] objectAtIndex:0] | 273 initWithParentButton:[[bbfc buttons] objectAtIndex:0] |
| 269 parentController:bbfc.get() | 274 parentController:bbfc.get() |
| 270 barController:parentBarController_]); | 275 barController:parentBarController_]); |
| 271 [bbfc2 window]; | 276 [bbfc2 window]; |
| 272 [bbfc2 setRealTopLeft:YES]; | 277 [bbfc2 setRealTopLeft:YES]; |
| 273 pt = [bbfc2 windowTopLeftForWidth:0]; | 278 pt = [bbfc2 windowTopLeftForWidth:0]; |
| 274 // We're now overlapping the window a bit. | 279 // We're now overlapping the window a bit. |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 [folder deleteBookmark:folder]; | 1363 [folder deleteBookmark:folder]; |
| 1359 EXPECT_FALSE([folder folderController]); | 1364 EXPECT_FALSE([folder folderController]); |
| 1360 } | 1365 } |
| 1361 | 1366 |
| 1362 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so | 1367 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so |
| 1363 // they are hard to test. Factor out "fire timers" into routines | 1368 // they are hard to test. Factor out "fire timers" into routines |
| 1364 // which can be overridden to fire immediately to make behavior | 1369 // which can be overridden to fire immediately to make behavior |
| 1365 // confirmable. | 1370 // confirmable. |
| 1366 // There is a similar problem with mouseEnteredButton: and | 1371 // There is a similar problem with mouseEnteredButton: and |
| 1367 // mouseExitedButton:. | 1372 // mouseExitedButton:. |
| OLD | NEW |