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

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

Issue 10827060: Removing instances of profile_->GetBookmarkModel() as part of converting BookmarkModel to a PKS. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/string16.h" 5 #include "base/string16.h"
6 #import "base/memory/scoped_nsobject.h" 6 #import "base/memory/scoped_nsobject.h"
7 #include "chrome/browser/bookmarks/bookmark_model.h" 7 #include "chrome/browser/bookmarks/bookmark_model.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/bookmarks/bookmark_utils.h" 9 #include "chrome/browser/bookmarks/bookmark_utils.h"
9 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h" 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h"
11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 @interface FakeBookmarkMenuController : BookmarkMenuCocoaController { 15 @interface FakeBookmarkMenuController : BookmarkMenuCocoaController {
15 @public 16 @public
16 const BookmarkNode* nodes_[2]; 17 const BookmarkNode* nodes_[2];
17 BOOL opened_[2]; 18 BOOL opened_[2];
18 BOOL opened_new_foreground_tab; 19 BOOL opened_new_foreground_tab;
19 BOOL opened_new_window; 20 BOOL opened_new_window;
20 BOOL opened_off_the_record; 21 BOOL opened_off_the_record;
21 } 22 }
22 - (id)initWithProfile:(Profile*)profile; 23 - (id)initWithProfile:(Profile*)profile;
23 @end 24 @end
24 25
25 @implementation FakeBookmarkMenuController 26 @implementation FakeBookmarkMenuController
26 27
27 - (id)initWithProfile:(Profile*)profile { 28 - (id)initWithProfile:(Profile*)profile {
28 if ((self = [super init])) { 29 if ((self = [super init])) {
29 string16 empty; 30 string16 empty;
30 BookmarkModel* model = profile->GetBookmarkModel(); 31 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
31 const BookmarkNode* bookmark_bar = model->bookmark_bar_node(); 32 const BookmarkNode* bookmark_bar = model->bookmark_bar_node();
32 nodes_[0] = model->AddURL(bookmark_bar, 0, empty, GURL("http://0.com")); 33 nodes_[0] = model->AddURL(bookmark_bar, 0, empty, GURL("http://0.com"));
33 nodes_[1] = model->AddURL(bookmark_bar, 1, empty, GURL("http://1.com")); 34 nodes_[1] = model->AddURL(bookmark_bar, 1, empty, GURL("http://1.com"));
34 } 35 }
35 return self; 36 return self;
36 } 37 }
37 38
38 - (const BookmarkNode*)nodeForIdentifier:(int)identifier { 39 - (const BookmarkNode*)nodeForIdentifier:(int)identifier {
39 if ((identifier < 0) || (identifier >= 2)) 40 if ((identifier < 0) || (identifier >= 2))
40 return NULL; 41 return NULL;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 EXPECT_NE(c->opened_new_foreground_tab, NO); 97 EXPECT_NE(c->opened_new_foreground_tab, NO);
97 98
98 EXPECT_EQ(c->opened_new_window, NO); 99 EXPECT_EQ(c->opened_new_window, NO);
99 [c openAllBookmarksNewWindow:item]; 100 [c openAllBookmarksNewWindow:item];
100 EXPECT_NE(c->opened_new_window, NO); 101 EXPECT_NE(c->opened_new_window, NO);
101 102
102 EXPECT_EQ(c->opened_off_the_record, NO); 103 EXPECT_EQ(c->opened_off_the_record, NO);
103 [c openAllBookmarksIncognitoWindow:item]; 104 [c openAllBookmarksIncognitoWindow:item];
104 EXPECT_NE(c->opened_off_the_record, NO); 105 EXPECT_NE(c->opened_off_the_record, NO);
105 } 106 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698