OLD | NEW |
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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 TemplateURLService* template_url_service = | 52 TemplateURLService* template_url_service = |
53 ios::TemplateURLServiceFactory::GetForBrowserState( | 53 ios::TemplateURLServiceFactory::GetForBrowserState( |
54 chrome_browser_state_.get()); | 54 chrome_browser_state_.get()); |
55 template_url_service->Load(); | 55 template_url_service->Load(); |
56 | 56 |
57 // Set up stub UrlLoader. | 57 // Set up stub UrlLoader. |
58 mockUrlLoader_ = [OCMockObject mockForProtocol:@protocol(UrlLoader)]; | 58 mockUrlLoader_ = [OCMockObject mockForProtocol:@protocol(UrlLoader)]; |
59 controller_ = [[GoogleLandingController alloc] init]; | 59 controller_ = [[GoogleLandingController alloc] init]; |
60 webStateList_ = base::MakeUnique<WebStateList>(&webStateListDelegate_); | 60 webStateList_ = base::MakeUnique<WebStateList>(&webStateListDelegate_); |
61 mediator_ = [[GoogleLandingMediator alloc] | 61 mediator_ = [[GoogleLandingMediator alloc] |
62 initWithConsumer:controller_ | 62 initWithConsumer:controller_ |
63 browserState:chrome_browser_state_.get() | 63 browserState:chrome_browser_state_.get() |
64 loader:(id<UrlLoader>)mockUrlLoader_ | 64 dispatcher:nil |
65 focuser:nil | 65 webStateList:webStateList_.get()]; |
66 webToolbarDelegate:nil | |
67 webStateList:webStateList_.get()]; | |
68 }; | 66 }; |
69 | 67 |
70 void TearDown() override { [mediator_ shutdown]; } | 68 void TearDown() override { [mediator_ shutdown]; } |
71 | 69 |
72 base::MessageLoopForUI message_loop_; | 70 base::MessageLoopForUI message_loop_; |
73 web::TestWebThread ui_thread_; | 71 web::TestWebThread ui_thread_; |
74 web::TestWebThread io_thread_; | 72 web::TestWebThread io_thread_; |
75 IOSChromeScopedTestingLocalState local_state_; | 73 IOSChromeScopedTestingLocalState local_state_; |
76 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; | 74 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; |
77 FakeWebStateListDelegate webStateListDelegate_; | 75 FakeWebStateListDelegate webStateListDelegate_; |
78 std::unique_ptr<WebStateList> webStateList_; | 76 std::unique_ptr<WebStateList> webStateList_; |
79 OCMockObject* mockUrlLoader_; | 77 OCMockObject* mockUrlLoader_; |
80 GoogleLandingMediator* mediator_; | 78 GoogleLandingMediator* mediator_; |
81 GoogleLandingController* controller_; | 79 GoogleLandingController* controller_; |
82 }; | 80 }; |
83 | 81 |
84 TEST_F(GoogleLandingControllerTest, TestConstructorDestructor) { | 82 TEST_F(GoogleLandingControllerTest, TestConstructorDestructor) { |
85 EXPECT_TRUE(controller_); | 83 EXPECT_TRUE(controller_); |
86 } | 84 } |
87 | 85 |
88 } // anonymous namespace | 86 } // anonymous namespace |
OLD | NEW |