Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge_unittest.mm

Issue 2216713002: Use BookmarkModelFactory::GetForBrowserContext everywhere (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bookmarks
Patch Set: Replace in .mm files Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 @end 95 @end
96 96
97 97
98 class BookmarkBarBridgeTest : public CocoaProfileTest { 98 class BookmarkBarBridgeTest : public CocoaProfileTest {
99 }; 99 };
100 100
101 // Call all the callbacks; make sure they are all redirected to the objc object. 101 // Call all the callbacks; make sure they are all redirected to the objc object.
102 TEST_F(BookmarkBarBridgeTest, TestRedirect) { 102 TEST_F(BookmarkBarBridgeTest, TestRedirect) {
103 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); 103 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
104 104
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()]);
(...skipping 12 matching lines...) Expand all
126 bridge->BookmarkNodeRemoved(NULL, NULL, 0, NULL, std::set<GURL>()); 126 bridge->BookmarkNodeRemoved(NULL, NULL, 0, NULL, std::set<GURL>());
127 127
128 // 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
129 EXPECT_TRUE([controller.get()->callbacks_ count] == 9); 129 EXPECT_TRUE([controller.get()->callbacks_ count] == 9);
130 130
131 for (int x = 1; x < 9; x++) { 131 for (int x = 1; x < 9; x++) {
132 NSNumber* num = [NSNumber numberWithInt:x-1]; 132 NSNumber* num = [NSNumber numberWithInt:x-1];
133 EXPECT_NSEQ(num, [controller.get()->callbacks_ objectAtIndex:x]); 133 EXPECT_NSEQ(num, [controller.get()->callbacks_ objectAtIndex:x]);
134 } 134 }
135 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698