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