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