OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #import <UIKit/UIKit.h> | 5 #import <UIKit/UIKit.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 ASSERT_TRUE(chrome_browser_state_->CreateHistoryService(true)); | 186 ASSERT_TRUE(chrome_browser_state_->CreateHistoryService(true)); |
187 history_service_ = ios::HistoryServiceFactory::GetForBrowserState( | 187 history_service_ = ios::HistoryServiceFactory::GetForBrowserState( |
188 chrome_browser_state_.get(), ServiceAccessType::EXPLICIT_ACCESS); | 188 chrome_browser_state_.get(), ServiceAccessType::EXPLICIT_ACCESS); |
189 | 189 |
190 ios::ChromeBrowserState* browser_state = chrome_browser_state_.get(); | 190 ios::ChromeBrowserState* browser_state = chrome_browser_state_.get(); |
191 if (UseOffTheRecordBrowserState()) | 191 if (UseOffTheRecordBrowserState()) |
192 browser_state = browser_state->GetOffTheRecordChromeBrowserState(); | 192 browser_state = browser_state->GetOffTheRecordChromeBrowserState(); |
193 | 193 |
194 mock_web_controller_ = | 194 mock_web_controller_ = |
195 [OCMockObject niceMockForClass:[CRWWebController class]]; | 195 [OCMockObject niceMockForClass:[CRWWebController class]]; |
196 auto web_state_impl = base::MakeUnique<WebStateImpl>(browser_state); | 196 web::WebState::CreateParams create_params(browser_state); |
| 197 auto web_state_impl = base::MakeUnique<WebStateImpl>(create_params); |
197 web_state_impl->SetWebController(mock_web_controller_); | 198 web_state_impl->SetWebController(mock_web_controller_); |
198 web_state_impl->GetNavigationManagerImpl().InitializeSession(NO); | 199 web_state_impl->GetNavigationManagerImpl().InitializeSession(); |
199 web_state_impl_ = web_state_impl.get(); | 200 web_state_impl_ = web_state_impl.get(); |
200 [[[static_cast<OCMockObject*>(mock_web_controller_) stub] | 201 [[[static_cast<OCMockObject*>(mock_web_controller_) stub] |
201 andReturnValue:OCMOCK_VALUE(web_state_impl_)] webStateImpl]; | 202 andReturnValue:OCMOCK_VALUE(web_state_impl_)] webStateImpl]; |
202 web_controller_view_.reset([[UIView alloc] init]); | 203 web_controller_view_.reset([[UIView alloc] init]); |
203 [[[static_cast<OCMockObject*>(mock_web_controller_) stub] | 204 [[[static_cast<OCMockObject*>(mock_web_controller_) stub] |
204 andReturn:web_controller_view_.get()] view]; | 205 andReturn:web_controller_view_.get()] view]; |
205 tab_.reset([[Tab alloc] initWithWebState:std::move(web_state_impl) | 206 tab_.reset([[Tab alloc] initWithWebState:std::move(web_state_impl) |
206 model:nil | 207 model:nil |
207 attachTabHelpers:NO]); | 208 attachTabHelpers:NO]); |
208 web::NavigationManager::WebLoadParams params(GURL("chrome://version/")); | 209 web::NavigationManager::WebLoadParams load_params( |
209 [[tab_ webController] loadWithParams:params]; | 210 GURL("chrome://version/")); |
| 211 [[tab_ webController] loadWithParams:load_params]; |
210 | 212 |
211 // There should be no entries in the history at this point. | 213 // There should be no entries in the history at this point. |
212 history::QueryResults results; | 214 history::QueryResults results; |
213 QueryAllHistory(&results); | 215 QueryAllHistory(&results); |
214 EXPECT_EQ(0UL, results.size()); | 216 EXPECT_EQ(0UL, results.size()); |
215 mock_external_app_launcher_.reset([[ExternalAppLauncherMock alloc] | 217 mock_external_app_launcher_.reset([[ExternalAppLauncherMock alloc] |
216 initWithRepresentedObject: | 218 initWithRepresentedObject: |
217 [OCMockObject mockForClass:[ExternalAppLauncher class]]]); | 219 [OCMockObject mockForClass:[ExternalAppLauncher class]]]); |
218 [tab_ replaceExternalAppLauncher:mock_external_app_launcher_]; | 220 [tab_ replaceExternalAppLauncher:mock_external_app_launcher_]; |
219 } | 221 } |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 [[FakeNativeAppMetadata alloc] init]); | 551 [[FakeNativeAppMetadata alloc] init]); |
550 | 552 |
551 // Turn auto open on. | 553 // Turn auto open on. |
552 [metadata setShouldAutoOpenLinks:YES]; | 554 [metadata setShouldAutoOpenLinks:YES]; |
553 int expectedCallCount = 2; | 555 int expectedCallCount = 2; |
554 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); | 556 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); |
555 EXPECT_FALSE([metadata shouldAutoOpenLinks]); | 557 EXPECT_FALSE([metadata shouldAutoOpenLinks]); |
556 } | 558 } |
557 | 559 |
558 } // namespace | 560 } // namespace |
OLD | NEW |