| 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 #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_bubble_controller.h" | 9 #import "chrome/browser/cocoa/bookmark_bubble_controller.h" |
| 10 #include "chrome/browser/cocoa/browser_test_helper.h" | 10 #include "chrome/browser/cocoa/browser_test_helper.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 @synthesize edits = edits_; | 29 @synthesize edits = edits_; |
| 30 | 30 |
| 31 - (NSPoint)topLeftForBubble { | 31 - (NSPoint)topLeftForBubble { |
| 32 return NSMakePoint(10, 300); | 32 return NSMakePoint(10, 300); |
| 33 } | 33 } |
| 34 | 34 |
| 35 - (void)editBookmarkNode:(const BookmarkNode*)node { | 35 - (void)editBookmarkNode:(const BookmarkNode*)node { |
| 36 edits_++; | 36 edits_++; |
| 37 } | 37 } |
| 38 | 38 |
| 39 // Tell us (a delegate) which controller it will "own". This sets up |
| 40 // the test classes (e.g. simulates what Chromium would do after |
| 41 // creating a BookmarkBubbleController). |
| 39 - (void)setWindowController:(NSWindowController *)controller { | 42 - (void)setWindowController:(NSWindowController *)controller { |
| 40 window_ = static_cast<InfoBubbleWindow*>([controller window]); | 43 window_ = static_cast<InfoBubbleWindow*>([controller window]); |
| 41 EXPECT_TRUE([window_ isKindOfClass:[InfoBubbleWindow class]]); | 44 [controller showWindow:self]; |
| 42 } | 45 } |
| 43 | 46 |
| 47 // The bubble tells the delegate when it will go away. |
| 48 - (void)bubbleWindowWillClose:(NSWindow*)window { |
| 49 // empty |
| 50 } |
| 51 |
| 44 - (BOOL)isWindowClosing { | 52 - (BOOL)isWindowClosing { |
| 45 return [window_ isClosing]; | 53 return [window_ isClosing]; |
| 46 } | 54 } |
| 47 | 55 |
| 48 @end | 56 @end |
| 49 | 57 |
| 50 namespace { | 58 namespace { |
| 51 | 59 |
| 52 class BookmarkBubbleControllerTest : public CocoaTest { | 60 class BookmarkBubbleControllerTest : public CocoaTest { |
| 53 public: | 61 public: |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 L"Bookie markie title", | 332 L"Bookie markie title", |
| 325 gurl); | 333 gurl); |
| 326 BookmarkBubbleController* controller = ControllerForNode(node); | 334 BookmarkBubbleController* controller = ControllerForNode(node); |
| 327 EXPECT_TRUE(controller); | 335 EXPECT_TRUE(controller); |
| 328 | 336 |
| 329 [(id)controller cancel:nil]; | 337 [(id)controller cancel:nil]; |
| 330 EXPECT_TRUE(model->IsBookmarked(gurl)); | 338 EXPECT_TRUE(model->IsBookmarked(gurl)); |
| 331 } | 339 } |
| 332 | 340 |
| 333 } // namespace | 341 } // namespace |
| OLD | NEW |