| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 [tab_ webWillAddPendingURL:redirectUrl | 232 [tab_ webWillAddPendingURL:redirectUrl |
| 233 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT]; | 233 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT]; |
| 234 | 234 |
| 235 web::Referrer empty_referrer; | 235 web::Referrer empty_referrer; |
| 236 [tab_ navigationManagerImpl]->AddPendingItem( | 236 [tab_ navigationManagerImpl]->AddPendingItem( |
| 237 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT, | 237 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT, |
| 238 web::NavigationInitiationType::RENDERER_INITIATED); | 238 web::NavigationInitiationType::RENDERER_INITIATED); |
| 239 | 239 |
| 240 web_state_impl_->OnProvisionalNavigationStarted(redirectUrl); | 240 web_state_impl_->OnProvisionalNavigationStarted(redirectUrl); |
| 241 [[tab_ navigationManagerImpl]->GetSessionController() commitPendingItem]; | 241 [[tab_ navigationManagerImpl]->GetSessionController() commitPendingItem]; |
| 242 [[tab_ webController] webStateImpl]->UpdateHttpResponseHeaders(redirectUrl); |
| 242 [[tab_ webController] webStateImpl]->OnNavigationCommitted(redirectUrl); | 243 [[tab_ webController] webStateImpl]->OnNavigationCommitted(redirectUrl); |
| 243 [tab_ webDidStartLoadingURL:redirectUrl shouldUpdateHistory:YES]; | |
| 244 | 244 |
| 245 base::string16 new_title = base::SysNSStringToUTF16(title); | 245 base::string16 new_title = base::SysNSStringToUTF16(title); |
| 246 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title); | 246 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title); |
| 247 | 247 |
| 248 web_state_impl_->OnTitleChanged(); | 248 web_state_impl_->OnTitleChanged(); |
| 249 [[[(id)mock_web_controller_ expect] | 249 [[[(id)mock_web_controller_ expect] |
| 250 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; | 250 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; |
| 251 web_state_impl_->OnPageLoaded(redirectUrl, true); | 251 web_state_impl_->OnPageLoaded(redirectUrl, true); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void BrowseToNewTab() { | 254 void BrowseToNewTab() { |
| 255 DCHECK_EQ(tab_.get().webState, web_state_impl_); | 255 DCHECK_EQ(tab_.get().webState, web_state_impl_); |
| 256 const GURL url(kNewTabUrl); | 256 const GURL url(kNewTabUrl); |
| 257 // TODO(crbug.com/661992): This will not work with a mock CRWWebController. | 257 // TODO(crbug.com/661992): This will not work with a mock CRWWebController. |
| 258 // The only test that uses it is currently disabled. | 258 // The only test that uses it is currently disabled. |
| 259 web::NavigationManager::WebLoadParams params(url); | 259 web::NavigationManager::WebLoadParams params(url); |
| 260 params.transition_type = ui::PAGE_TRANSITION_TYPED; | 260 params.transition_type = ui::PAGE_TRANSITION_TYPED; |
| 261 [[tab_ webController] loadWithParams:params]; | 261 [[tab_ webController] loadWithParams:params]; |
| 262 [[[(id)mock_web_controller_ expect] | 262 [[[(id)mock_web_controller_ expect] |
| 263 andReturnValue:OCMOCK_VALUE(kPageLoading)] loadPhase]; | 263 andReturnValue:OCMOCK_VALUE(kPageLoading)] loadPhase]; |
| 264 [tab_ webDidStartLoadingURL:url shouldUpdateHistory:YES]; | |
| 265 [[[(id)mock_web_controller_ expect] | 264 [[[(id)mock_web_controller_ expect] |
| 266 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; | 265 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; |
| 267 web_state_impl_->OnPageLoaded(url, true); | 266 web_state_impl_->OnPageLoaded(url, true); |
| 268 web_state_impl_->OnTitleChanged(); | 267 web_state_impl_->OnTitleChanged(); |
| 269 } | 268 } |
| 270 | 269 |
| 271 void QueryAllHistory(history::QueryResults* results) { | 270 void QueryAllHistory(history::QueryResults* results) { |
| 272 base::CancelableTaskTracker tracker; | 271 base::CancelableTaskTracker tracker; |
| 273 base::RunLoop run_loop; | 272 base::RunLoop run_loop; |
| 274 scoped_refptr<HistoryQueryResultsObserver> observer( | 273 scoped_refptr<HistoryQueryResultsObserver> observer( |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 [[FakeNativeAppMetadata alloc] init]); | 549 [[FakeNativeAppMetadata alloc] init]); |
| 551 | 550 |
| 552 // Turn auto open on. | 551 // Turn auto open on. |
| 553 [metadata setShouldAutoOpenLinks:YES]; | 552 [metadata setShouldAutoOpenLinks:YES]; |
| 554 int expectedCallCount = 2; | 553 int expectedCallCount = 2; |
| 555 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); | 554 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); |
| 556 EXPECT_FALSE([metadata shouldAutoOpenLinks]); | 555 EXPECT_FALSE([metadata shouldAutoOpenLinks]); |
| 557 } | 556 } |
| 558 | 557 |
| 559 } // namespace | 558 } // namespace |
| OLD | NEW |