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_factory.h" |
5 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h" | 6 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h" |
6 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 7 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
7 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 #import "testing/gtest_mac.h" | 10 #import "testing/gtest_mac.h" |
10 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" |
11 | 12 |
12 // TODO(jrg): use OCMock. | 13 // TODO(jrg): use OCMock. |
13 | 14 |
14 namespace { | 15 namespace { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 89 } |
89 | 90 |
90 @end | 91 @end |
91 | 92 |
92 | 93 |
93 class BookmarkBarBridgeTest : public CocoaProfileTest { | 94 class BookmarkBarBridgeTest : public CocoaProfileTest { |
94 }; | 95 }; |
95 | 96 |
96 // Call all the callbacks; make sure they are all redirected to the objc object. | 97 // Call all the callbacks; make sure they are all redirected to the objc object. |
97 TEST_F(BookmarkBarBridgeTest, TestRedirect) { | 98 TEST_F(BookmarkBarBridgeTest, TestRedirect) { |
98 BookmarkModel* model = profile()->GetBookmarkModel(); | 99 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); |
99 | 100 |
100 scoped_nsobject<NSView> parentView([[NSView alloc] | 101 scoped_nsobject<NSView> parentView([[NSView alloc] |
101 initWithFrame:NSMakeRect(0,0,100,100)]); | 102 initWithFrame:NSMakeRect(0,0,100,100)]); |
102 scoped_nsobject<NSView> webView([[NSView alloc] | 103 scoped_nsobject<NSView> webView([[NSView alloc] |
103 initWithFrame:NSMakeRect(0,0,100,100)]); | 104 initWithFrame:NSMakeRect(0,0,100,100)]); |
104 scoped_nsobject<NSView> infoBarsView( | 105 scoped_nsobject<NSView> infoBarsView( |
105 [[NSView alloc] initWithFrame:NSMakeRect(0,0,100,100)]); | 106 [[NSView alloc] initWithFrame:NSMakeRect(0,0,100,100)]); |
106 | 107 |
107 scoped_nsobject<FakeBookmarkBarController> | 108 scoped_nsobject<FakeBookmarkBarController> |
108 controller([[FakeBookmarkBarController alloc] initWithBrowser:browser()]); | 109 controller([[FakeBookmarkBarController alloc] initWithBrowser:browser()]); |
(...skipping 12 matching lines...) Expand all Loading... |
121 bridge->BookmarkNodeRemoved(NULL, NULL, 0, NULL); | 122 bridge->BookmarkNodeRemoved(NULL, NULL, 0, NULL); |
122 | 123 |
123 // 8 calls above plus an initial Loaded() in init routine makes 9 | 124 // 8 calls above plus an initial Loaded() in init routine makes 9 |
124 EXPECT_TRUE([controller.get()->callbacks_ count] == 9); | 125 EXPECT_TRUE([controller.get()->callbacks_ count] == 9); |
125 | 126 |
126 for (int x = 1; x < 9; x++) { | 127 for (int x = 1; x < 9; x++) { |
127 NSNumber* num = [NSNumber numberWithInt:x-1]; | 128 NSNumber* num = [NSNumber numberWithInt:x-1]; |
128 EXPECT_NSEQ(num, [controller.get()->callbacks_ objectAtIndex:x]); | 129 EXPECT_NSEQ(num, [controller.get()->callbacks_ objectAtIndex:x]); |
129 } | 130 } |
130 } | 131 } |
OLD | NEW |