| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 void BrowseTo(const GURL& userUrl, const GURL& redirectUrl, NSString* title) { | 228 void BrowseTo(const GURL& userUrl, const GURL& redirectUrl, NSString* title) { |
| 229 DCHECK_EQ(tab_.get().webState, web_state_impl_); | 229 DCHECK_EQ(tab_.get().webState, web_state_impl_); |
| 230 | 230 |
| 231 [tab_ webWillAddPendingURL:userUrl transition:ui::PAGE_TRANSITION_TYPED]; | 231 [tab_ webWillAddPendingURL:userUrl transition:ui::PAGE_TRANSITION_TYPED]; |
| 232 web_state_impl_->OnProvisionalNavigationStarted(userUrl); | 232 web_state_impl_->OnProvisionalNavigationStarted(userUrl); |
| 233 [tab_ webWillAddPendingURL:redirectUrl | 233 [tab_ webWillAddPendingURL:redirectUrl |
| 234 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT]; | 234 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT]; |
| 235 | 235 |
| 236 web::Referrer empty_referrer; | 236 web::Referrer empty_referrer; |
| 237 [tab_ navigationManager]->AddPendingItem( | 237 [tab_ navigationManagerImpl]->AddPendingItem( |
| 238 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT, | 238 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT, |
| 239 web::NavigationInitiationType::RENDERER_INITIATED); | 239 web::NavigationInitiationType::RENDERER_INITIATED); |
| 240 | 240 |
| 241 web_state_impl_->OnProvisionalNavigationStarted(redirectUrl); | 241 web_state_impl_->OnProvisionalNavigationStarted(redirectUrl); |
| 242 [[tab_ navigationManager]->GetSessionController() commitPendingItem]; | 242 [[tab_ navigationManagerImpl]->GetSessionController() commitPendingItem]; |
| 243 [[tab_ webController] webStateImpl]->OnNavigationCommitted(redirectUrl); | 243 [[tab_ webController] webStateImpl]->OnNavigationCommitted(redirectUrl); |
| 244 [tab_ webDidStartLoadingURL:redirectUrl shouldUpdateHistory:YES]; | 244 [tab_ webDidStartLoadingURL:redirectUrl shouldUpdateHistory:YES]; |
| 245 | 245 |
| 246 base::string16 new_title = base::SysNSStringToUTF16(title); | 246 base::string16 new_title = base::SysNSStringToUTF16(title); |
| 247 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title); | 247 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title); |
| 248 | 248 |
| 249 [tab_ webController:mock_web_controller_ titleDidChange:title]; | 249 [tab_ webController:mock_web_controller_ titleDidChange:title]; |
| 250 [[[(id)mock_web_controller_ expect] | 250 [[[(id)mock_web_controller_ expect] |
| 251 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; | 251 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; |
| 252 web_state_impl_->OnPageLoaded(redirectUrl, true); | 252 web_state_impl_->OnPageLoaded(redirectUrl, true); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 [[FakeNativeAppMetadata alloc] init]); | 551 [[FakeNativeAppMetadata alloc] init]); |
| 552 | 552 |
| 553 // Turn auto open on. | 553 // Turn auto open on. |
| 554 [metadata setShouldAutoOpenLinks:YES]; | 554 [metadata setShouldAutoOpenLinks:YES]; |
| 555 int expectedCallCount = 2; | 555 int expectedCallCount = 2; |
| 556 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); | 556 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); |
| 557 EXPECT_FALSE([metadata shouldAutoOpenLinks]); | 557 EXPECT_FALSE([metadata shouldAutoOpenLinks]); |
| 558 } | 558 } |
| 559 | 559 |
| 560 } // namespace | 560 } // namespace |
| OLD | NEW |