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 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h" | 6 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h" |
7 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 7 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 8 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #import "testing/gtest_mac.h" | 10 #import "testing/gtest_mac.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 scoped_nsobject<NSView> parentView([[NSView alloc] | 101 scoped_nsobject<NSView> parentView([[NSView alloc] |
102 initWithFrame:NSMakeRect(0,0,100,100)]); | 102 initWithFrame:NSMakeRect(0,0,100,100)]); |
103 scoped_nsobject<NSView> webView([[NSView alloc] | 103 scoped_nsobject<NSView> webView([[NSView alloc] |
104 initWithFrame:NSMakeRect(0,0,100,100)]); | 104 initWithFrame:NSMakeRect(0,0,100,100)]); |
105 scoped_nsobject<NSView> infoBarsView( | 105 scoped_nsobject<NSView> infoBarsView( |
106 [[NSView alloc] initWithFrame:NSMakeRect(0,0,100,100)]); | 106 [[NSView alloc] initWithFrame:NSMakeRect(0,0,100,100)]); |
107 | 107 |
108 scoped_nsobject<FakeBookmarkBarController> | 108 scoped_nsobject<FakeBookmarkBarController> |
109 controller([[FakeBookmarkBarController alloc] initWithBrowser:browser()]); | 109 controller([[FakeBookmarkBarController alloc] initWithBrowser:browser()]); |
110 EXPECT_TRUE(controller.get()); | 110 EXPECT_TRUE(controller.get()); |
111 scoped_ptr<BookmarkBarBridge> bridge(new BookmarkBarBridge(controller.get(), | 111 scoped_ptr<BookmarkBarBridge> bridge(new BookmarkBarBridge(profile(), |
| 112 controller.get(), |
112 model)); | 113 model)); |
113 EXPECT_TRUE(bridge.get()); | 114 EXPECT_TRUE(bridge.get()); |
114 | 115 |
115 bridge->Loaded(NULL, false); | 116 bridge->Loaded(NULL, false); |
116 bridge->BookmarkModelBeingDeleted(NULL); | 117 bridge->BookmarkModelBeingDeleted(NULL); |
117 bridge->BookmarkNodeMoved(NULL, NULL, 0, NULL, 0); | 118 bridge->BookmarkNodeMoved(NULL, NULL, 0, NULL, 0); |
118 bridge->BookmarkNodeAdded(NULL, NULL, 0); | 119 bridge->BookmarkNodeAdded(NULL, NULL, 0); |
119 bridge->BookmarkNodeChanged(NULL, NULL); | 120 bridge->BookmarkNodeChanged(NULL, NULL); |
120 bridge->BookmarkNodeFaviconChanged(NULL, NULL); | 121 bridge->BookmarkNodeFaviconChanged(NULL, NULL); |
121 bridge->BookmarkNodeChildrenReordered(NULL, NULL); | 122 bridge->BookmarkNodeChildrenReordered(NULL, NULL); |
122 bridge->BookmarkNodeRemoved(NULL, NULL, 0, NULL); | 123 bridge->BookmarkNodeRemoved(NULL, NULL, 0, NULL); |
123 | 124 |
124 // 8 calls above plus an initial Loaded() in init routine makes 9 | 125 // 8 calls above plus an initial Loaded() in init routine makes 9 |
125 EXPECT_TRUE([controller.get()->callbacks_ count] == 9); | 126 EXPECT_TRUE([controller.get()->callbacks_ count] == 9); |
126 | 127 |
127 for (int x = 1; x < 9; x++) { | 128 for (int x = 1; x < 9; x++) { |
128 NSNumber* num = [NSNumber numberWithInt:x-1]; | 129 NSNumber* num = [NSNumber numberWithInt:x-1]; |
129 EXPECT_NSEQ(num, [controller.get()->callbacks_ objectAtIndex:x]); | 130 EXPECT_NSEQ(num, [controller.get()->callbacks_ objectAtIndex:x]); |
130 } | 131 } |
131 } | 132 } |
OLD | NEW |