OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_factory.h" | 5 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
6 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 6 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" | 7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" |
8 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 8 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" | 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" |
10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 @end | 34 @end |
35 | 35 |
36 | 36 |
37 class BookmarkFolderTargetTest : public CocoaProfileTest { | 37 class BookmarkFolderTargetTest : public CocoaProfileTest { |
38 public: | 38 public: |
39 void SetUp() override { | 39 void SetUp() override { |
40 CocoaProfileTest::SetUp(); | 40 CocoaProfileTest::SetUp(); |
41 ASSERT_TRUE(profile()); | 41 ASSERT_TRUE(profile()); |
42 | 42 |
43 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); | 43 BookmarkModel* model = |
| 44 BookmarkModelFactory::GetForBrowserContext(profile()); |
44 bmbNode_ = model->bookmark_bar_node(); | 45 bmbNode_ = model->bookmark_bar_node(); |
45 } | 46 } |
46 | 47 |
47 const BookmarkNode* bmbNode_; | 48 const BookmarkNode* bmbNode_; |
48 }; | 49 }; |
49 | 50 |
50 TEST_F(BookmarkFolderTargetTest, StartWithNothing) { | 51 TEST_F(BookmarkFolderTargetTest, StartWithNothing) { |
51 // Need a fake "button" which has a bookmark node. | 52 // Need a fake "button" which has a bookmark node. |
52 id sender = [OCMockObject mockForClass:[BookmarkButton class]]; | 53 id sender = [OCMockObject mockForClass:[BookmarkButton class]]; |
53 [[[sender stub] andReturnValue:OCMOCK_VALUE(bmbNode_)] bookmarkNode]; | 54 [[[sender stub] andReturnValue:OCMOCK_VALUE(bmbNode_)] bookmarkNode]; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 base::scoped_nsobject<BookmarkFolderTarget> target( | 121 base::scoped_nsobject<BookmarkFolderTarget> target( |
121 [[BookmarkFolderTarget alloc] initWithController:controller | 122 [[BookmarkFolderTarget alloc] initWithController:controller |
122 profile:profile()]); | 123 profile:profile()]); |
123 | 124 |
124 [target openBookmarkFolderFromButton:sender]; | 125 [target openBookmarkFolderFromButton:sender]; |
125 EXPECT_OCMOCK_VERIFY(controller); | 126 EXPECT_OCMOCK_VERIFY(controller); |
126 | 127 |
127 // Break retain cycles. | 128 // Break retain cycles. |
128 [controller clearRecordersAndExpectations]; | 129 [controller clearRecordersAndExpectations]; |
129 } | 130 } |
OLD | NEW |