OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
6 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" | 8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" |
8 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | 9 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h" |
10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
13 #import "third_party/ocmock/OCMock/OCMock.h" | 14 #import "third_party/ocmock/OCMock/OCMock.h" |
14 #include "third_party/ocmock/gtest_support.h" | 15 #include "third_party/ocmock/gtest_support.h" |
15 | 16 |
(...skipping 12 matching lines...) Expand all Loading... |
28 | 29 |
29 @end | 30 @end |
30 | 31 |
31 | 32 |
32 class BookmarkFolderTargetTest : public CocoaProfileTest { | 33 class BookmarkFolderTargetTest : public CocoaProfileTest { |
33 public: | 34 public: |
34 virtual void SetUp() { | 35 virtual void SetUp() { |
35 CocoaProfileTest::SetUp(); | 36 CocoaProfileTest::SetUp(); |
36 ASSERT_TRUE(profile()); | 37 ASSERT_TRUE(profile()); |
37 | 38 |
38 BookmarkModel* model = profile()->GetBookmarkModel(); | 39 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); |
39 bmbNode_ = model->bookmark_bar_node(); | 40 bmbNode_ = model->bookmark_bar_node(); |
40 } | 41 } |
41 | 42 |
42 const BookmarkNode* bmbNode_; | 43 const BookmarkNode* bmbNode_; |
43 }; | 44 }; |
44 | 45 |
45 TEST_F(BookmarkFolderTargetTest, StartWithNothing) { | 46 TEST_F(BookmarkFolderTargetTest, StartWithNothing) { |
46 // Need a fake "button" which has a bookmark node. | 47 // Need a fake "button" which has a bookmark node. |
47 id sender = [OCMockObject mockForClass:[BookmarkButton class]]; | 48 id sender = [OCMockObject mockForClass:[BookmarkButton class]]; |
48 [[[sender stub] andReturnValue:OCMOCK_VALUE(bmbNode_)] bookmarkNode]; | 49 [[[sender stub] andReturnValue:OCMOCK_VALUE(bmbNode_)] bookmarkNode]; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 113 |
113 scoped_nsobject<BookmarkFolderTarget> target( | 114 scoped_nsobject<BookmarkFolderTarget> target( |
114 [[BookmarkFolderTarget alloc] initWithController:controller]); | 115 [[BookmarkFolderTarget alloc] initWithController:controller]); |
115 | 116 |
116 [target openBookmarkFolderFromButton:sender]; | 117 [target openBookmarkFolderFromButton:sender]; |
117 EXPECT_OCMOCK_VERIFY(controller); | 118 EXPECT_OCMOCK_VERIFY(controller); |
118 | 119 |
119 // Break retain cycles. | 120 // Break retain cycles. |
120 [controller clearRecordersAndExpectations]; | 121 [controller clearRecordersAndExpectations]; |
121 } | 122 } |
OLD | NEW |