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

Unified Diff: ios/chrome/browser/ui/browser_view_controller_unittest.mm

Issue 2770223003: [ios] Switches ToolbarModelDelegateIOS to use WebStateList. (Closed)
Patch Set: Review 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/browser_view_controller.mm ('k') | ios/chrome/browser/ui/omnibox_perftest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/browser_view_controller_unittest.mm
diff --git a/ios/chrome/browser/ui/browser_view_controller_unittest.mm b/ios/chrome/browser/ui/browser_view_controller_unittest.mm
index 65003711fffb8c2768d6848b40b23e71d7eb6150..a22d722fc835546d7ef64ab6455736a798aa4510 100644
--- a/ios/chrome/browser/ui/browser_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/browser_view_controller_unittest.mm
@@ -48,6 +48,8 @@
#include "ios/chrome/test/block_cleanup_test.h"
#include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h"
#include "ios/chrome/test/testing_application_context.h"
+#include "ios/shared/chrome/browser/tabs/fake_web_state_list_delegate.h"
+#include "ios/shared/chrome/browser/tabs/web_state_list.h"
#import "ios/testing/ocmock_complex_type_helper.h"
#include "ios/web/public/referrer.h"
#include "ios/web/public/test/test_web_thread_bundle.h"
@@ -113,6 +115,30 @@ using web::WebStateImpl;
}
@end
+@interface BVCTestTabModel : OCMockComplexTypeHelper
+- (instancetype)init NS_DESIGNATED_INITIALIZER;
+@end
+
+@implementation BVCTestTabModel {
+ FakeWebStateListDelegate _webStateListDelegate;
+ std::unique_ptr<WebStateList> _webStateList;
+}
+
+- (instancetype)init {
+ if ((self = [super
+ initWithRepresentedObject:[OCMockObject
+ niceMockForClass:[TabModel class]]])) {
+ _webStateList = base::MakeUnique<WebStateList>(&_webStateListDelegate,
+ WebStateList::WebStateOwned);
+ }
+ return self;
+}
+
+- (WebStateList*)webStateList {
+ return _webStateList.get();
+}
+@end
+
#pragma mark -
namespace {
@@ -146,7 +172,7 @@ class BrowserViewControllerTest : public BlockCleanupTest {
bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model);
// Set up mock TabModel, Tab, and CRWWebController.
- id tabModel = [OCMockObject mockForClass:[TabModel class]];
+ base::scoped_nsobject<id> tabModel([[BVCTestTabModel alloc] init]);
base::scoped_nsobject<id> currentTab([[BVCTestTabMock alloc]
initWithRepresentedObject:[OCMockObject niceMockForClass:[Tab class]]]);
id webControllerMock =
« no previous file with comments | « ios/chrome/browser/ui/browser_view_controller.mm ('k') | ios/chrome/browser/ui/omnibox_perftest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698