| 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 #include "chrome/browser/bookmarks/bookmark_model.h" | 5 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 6 #import "chrome/browser/cocoa/bookmarks/bookmark_bar_controller.h" | 6 #import "chrome/browser/cocoa/bookmarks/bookmark_bar_controller.h" |
| 7 #import "chrome/browser/cocoa/bookmarks/bookmark_bar_folder_controller.h" | 7 #import "chrome/browser/cocoa/bookmarks/bookmark_bar_folder_controller.h" |
| 8 #import "chrome/browser/cocoa/bookmarks/bookmark_folder_target.h" | 8 #import "chrome/browser/cocoa/bookmarks/bookmark_folder_target.h" |
| 9 #include "chrome/browser/cocoa/bookmarks/bookmark_button.h" | 9 #include "chrome/browser/cocoa/bookmarks/bookmark_button.h" |
| 10 #include "chrome/browser/cocoa/browser_test_helper.h" | 10 #include "chrome/browser/cocoa/browser_test_helper.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | 36 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); |
| 37 bmbNode_ = model->GetBookmarkBarNode(); | 37 bmbNode_ = model->GetBookmarkBarNode(); |
| 38 } | 38 } |
| 39 virtual void TearDown() { | 39 virtual void TearDown() { |
| 40 pool_.Recycle(); | 40 pool_.Recycle(); |
| 41 CocoaTest::TearDown(); | 41 CocoaTest::TearDown(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 BrowserTestHelper helper_; | 44 BrowserTestHelper helper_; |
| 45 const BookmarkNode* bmbNode_; | 45 const BookmarkNode* bmbNode_; |
| 46 base::ScopedNSAutoreleasePool pool_; | 46 base::mac::ScopedNSAutoreleasePool pool_; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 TEST_F(BookmarkFolderTargetTest, StartWithNothing) { | 49 TEST_F(BookmarkFolderTargetTest, StartWithNothing) { |
| 50 // Need a fake "button" which has a bookmark node. | 50 // Need a fake "button" which has a bookmark node. |
| 51 id sender = [OCMockObject mockForClass:[BookmarkButton class]]; | 51 id sender = [OCMockObject mockForClass:[BookmarkButton class]]; |
| 52 [[[sender stub] andReturnValue:OCMOCK_VALUE(bmbNode_)] bookmarkNode]; | 52 [[[sender stub] andReturnValue:OCMOCK_VALUE(bmbNode_)] bookmarkNode]; |
| 53 | 53 |
| 54 // Fake controller | 54 // Fake controller |
| 55 id controller = [OCMockObject mockForClass:[BookmarkBarFolderController | 55 id controller = [OCMockObject mockForClass:[BookmarkBarFolderController |
| 56 class]]; | 56 class]]; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 scoped_nsobject<BookmarkFolderTarget> target( | 117 scoped_nsobject<BookmarkFolderTarget> target( |
| 118 [[BookmarkFolderTarget alloc] initWithController:controller]); | 118 [[BookmarkFolderTarget alloc] initWithController:controller]); |
| 119 | 119 |
| 120 [target openBookmarkFolderFromButton:sender]; | 120 [target openBookmarkFolderFromButton:sender]; |
| 121 [controller verify]; | 121 [controller verify]; |
| 122 | 122 |
| 123 // Break retain cycles. | 123 // Break retain cycles. |
| 124 [controller clearRecordersAndExpectations]; | 124 [controller clearRecordersAndExpectations]; |
| 125 } | 125 } |
| OLD | NEW |