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

Side by Side Diff: ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller_unittest.mm

Issue 2742713007: [ObjC ARC] Converts ios/chrome/browser/ui/bookmarks:unit_tests to ARC. (Closed)
Patch Set: rebase Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/mac/scoped_nsobject.h"
6 #include "components/bookmarks/browser/bookmark_model.h" 5 #include "components/bookmarks/browser/bookmark_model.h"
7 #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" 6 #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
8 #import "ios/chrome/browser/ui/bookmarks/bookmark_home_handset_view_controller.h " 7 #import "ios/chrome/browser/ui/bookmarks/bookmark_home_handset_view_controller.h "
9 #include "ios/chrome/browser/ui/bookmarks/bookmark_ios_unittest.h" 8 #include "ios/chrome/browser/ui/bookmarks/bookmark_ios_unittest.h"
10 #import "ios/chrome/browser/ui/bookmarks/bookmark_promo_controller.h" 9 #import "ios/chrome/browser/ui/bookmarks/bookmark_promo_controller.h"
11 #import "ios/chrome/browser/ui/bookmarks/bookmark_utils_ios.h" 10 #import "ios/chrome/browser/ui/bookmarks/bookmark_utils_ios.h"
12 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support."
14 #endif
15
13 using bookmarks::BookmarkNode; 16 using bookmarks::BookmarkNode;
14 17
15 // A partial mock subclass that doesn't load any heavy weight subclasses. 18 // A partial mock subclass that doesn't load any heavy weight subclasses.
16 @interface MockBookmarkHomeHandsetViewController 19 @interface MockBookmarkHomeHandsetViewController
17 : BookmarkHomeHandsetViewController 20 : BookmarkHomeHandsetViewController
18 @end 21 @end
19 22
20 @implementation MockBookmarkHomeHandsetViewController 23 @implementation MockBookmarkHomeHandsetViewController
21 24
22 - (void)hideEditingBarAnimated:(BOOL)animated { 25 - (void)hideEditingBarAnimated:(BOOL)animated {
(...skipping 29 matching lines...) Expand all
52 AddBookmark(f1, @"f1c"); 55 AddBookmark(f1, @"f1c");
53 const BookmarkNode* f2a = AddBookmark(f2, @"f2a"); 56 const BookmarkNode* f2a = AddBookmark(f2, @"f2a");
54 AddBookmark(f2, @"f2b"); 57 AddBookmark(f2, @"f2b");
55 58
56 std::set<const BookmarkNode*> toDelete; 59 std::set<const BookmarkNode*> toDelete;
57 toDelete.insert(b); 60 toDelete.insert(b);
58 toDelete.insert(f1a); 61 toDelete.insert(f1a);
59 toDelete.insert(f1); 62 toDelete.insert(f1);
60 toDelete.insert(f2a); 63 toDelete.insert(f2a);
61 64
62 base::scoped_nsobject<MockBookmarkHomeHandsetViewController> controller( 65 MockBookmarkHomeHandsetViewController* controller =
63 [[MockBookmarkHomeHandsetViewController alloc] 66 [[MockBookmarkHomeHandsetViewController alloc]
64 initWithLoader:nil 67 initWithLoader:nil
65 browserState:chrome_browser_state_.get()]); 68 browserState:chrome_browser_state_.get()];
66 69
67 [controller resetEditNodes]; 70 [controller resetEditNodes];
68 [controller insertEditNode:f1 atIndexPath:nil]; 71 [controller insertEditNode:f1 atIndexPath:nil];
69 [controller insertEditNode:a atIndexPath:nil]; 72 [controller insertEditNode:a atIndexPath:nil];
70 [controller insertEditNode:f2 atIndexPath:nil]; 73 [controller insertEditNode:f2 atIndexPath:nil];
71 74
72 bookmark_utils_ios::DeleteBookmarks(toDelete, _bookmarkModel); 75 bookmark_utils_ios::DeleteBookmarks(toDelete, _bookmarkModel);
73 76
74 // After the deletion, only 'a' and 'f2' should be left. 77 // After the deletion, only 'a' and 'f2' should be left.
75 std::set<const BookmarkNode*> editingNodes = [controller editNodes]; 78 std::set<const BookmarkNode*> editingNodes = [controller editNodes];
76 EXPECT_EQ(editingNodes.size(), 2u); 79 EXPECT_EQ(editingNodes.size(), 2u);
77 EXPECT_TRUE(editingNodes.find(a) != editingNodes.end()); 80 EXPECT_TRUE(editingNodes.find(a) != editingNodes.end());
78 EXPECT_TRUE(editingNodes.find(f2) != editingNodes.end()); 81 EXPECT_TRUE(editingNodes.find(f2) != editingNodes.end());
79 } 82 }
80 } 83 }
81 84
82 } // anonymous namespace 85 } // anonymous namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/bookmarks/BUILD.gn ('k') | ios/chrome/browser/ui/bookmarks/bookmark_ios_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698