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

Side by Side Diff: ios/chrome/browser/ui/ntp/google_landing_controller_unittest.mm

Issue 2833513002: Replace TabModel with WebStateList in GoogleLandingController. (Closed)
Patch Set: Fix gn Created 3 years, 8 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 <memory> 5 #include <memory>
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "components/search_engines/template_url_service.h" 9 #include "components/search_engines/template_url_service.h"
10 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" 10 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
11 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" 11 #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
12 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" 12 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h"
13 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h" 13 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h"
14 #import "ios/chrome/browser/ui/ntp/google_landing_mediator.h" 14 #import "ios/chrome/browser/ui/ntp/google_landing_mediator.h"
15 #include "ios/chrome/browser/web_state_list/fake_web_state_list_delegate.h"
16 #include "ios/chrome/browser/web_state_list/web_state_list.h"
15 #include "ios/chrome/test/block_cleanup_test.h" 17 #include "ios/chrome/test/block_cleanup_test.h"
16 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" 18 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h"
17 #include "ios/web/public/test/test_web_thread.h" 19 #include "ios/web/public/test/test_web_thread.h"
18 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
19 #include "testing/gtest_mac.h" 21 #include "testing/gtest_mac.h"
20 #import "third_party/ocmock/OCMock/OCMock.h" 22 #import "third_party/ocmock/OCMock/OCMock.h"
21 23
22 #if !defined(__has_feature) || !__has_feature(objc_arc) 24 #if !defined(__has_feature) || !__has_feature(objc_arc)
23 #error "This file requires ARC support." 25 #error "This file requires ARC support."
24 #endif 26 #endif
(...skipping 23 matching lines...) Expand all
48 50
49 // Set up tab restore service. 51 // Set up tab restore service.
50 TemplateURLService* template_url_service = 52 TemplateURLService* template_url_service =
51 ios::TemplateURLServiceFactory::GetForBrowserState( 53 ios::TemplateURLServiceFactory::GetForBrowserState(
52 chrome_browser_state_.get()); 54 chrome_browser_state_.get());
53 template_url_service->Load(); 55 template_url_service->Load();
54 56
55 // Set up stub UrlLoader. 57 // Set up stub UrlLoader.
56 mockUrlLoader_ = [OCMockObject mockForProtocol:@protocol(UrlLoader)]; 58 mockUrlLoader_ = [OCMockObject mockForProtocol:@protocol(UrlLoader)];
57 controller_ = [[GoogleLandingController alloc] init]; 59 controller_ = [[GoogleLandingController alloc] init];
60 webStateList_ = base::MakeUnique<WebStateList>(&webStateListDelegate_);
58 mediator_ = [[GoogleLandingMediator alloc] 61 mediator_ = [[GoogleLandingMediator alloc]
59 initWithConsumer:controller_ 62 initWithConsumer:controller_
60 browserState:chrome_browser_state_.get() 63 browserState:chrome_browser_state_.get()
61 loader:(id<UrlLoader>)mockUrlLoader_ 64 loader:(id<UrlLoader>)mockUrlLoader_
62 focuser:nil 65 focuser:nil
63 webToolbarDelegate:nil 66 webToolbarDelegate:nil
64 tabModel:nil]; 67 webStateList:webStateList_.get()];
65 }; 68 };
66 69
67 base::MessageLoopForUI message_loop_; 70 base::MessageLoopForUI message_loop_;
68 web::TestWebThread ui_thread_; 71 web::TestWebThread ui_thread_;
69 web::TestWebThread io_thread_; 72 web::TestWebThread io_thread_;
70 IOSChromeScopedTestingLocalState local_state_; 73 IOSChromeScopedTestingLocalState local_state_;
71 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; 74 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_;
75 FakeWebStateListDelegate webStateListDelegate_;
76 std::unique_ptr<WebStateList> webStateList_;
72 OCMockObject* mockUrlLoader_; 77 OCMockObject* mockUrlLoader_;
73 GoogleLandingMediator* mediator_; 78 GoogleLandingMediator* mediator_;
74 GoogleLandingController* controller_; 79 GoogleLandingController* controller_;
75 }; 80 };
76 81
77 TEST_F(GoogleLandingControllerTest, TestConstructorDestructor) { 82 TEST_F(GoogleLandingControllerTest, TestConstructorDestructor) {
78 EXPECT_TRUE(controller_); 83 EXPECT_TRUE(controller_);
79 } 84 }
80 85
81 } // anonymous namespace 86 } // anonymous namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/ntp/google_landing_controller.mm ('k') | ios/chrome/browser/ui/ntp/google_landing_data_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698