| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT]; | 235 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT]; |
| 236 [[tab_ navigationManager]->GetSessionController() | 236 [[tab_ navigationManager]->GetSessionController() |
| 237 addPendingItem:redirectUrl | 237 addPendingItem:redirectUrl |
| 238 referrer:empty_referrer | 238 referrer:empty_referrer |
| 239 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT | 239 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT |
| 240 rendererInitiated:YES]; | 240 rendererInitiated:YES]; |
| 241 web_state_impl_->OnProvisionalNavigationStarted(redirectUrl); | 241 web_state_impl_->OnProvisionalNavigationStarted(redirectUrl); |
| 242 [[tab_ navigationManager]->GetSessionController() commitPendingItem]; | 242 [[tab_ navigationManager]->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 base::string16 new_title = base::SysNSStringToUTF16(title); |
| 246 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title); |
| 245 [tab_ webController:mock_web_controller_ titleDidChange:title]; | 247 [tab_ webController:mock_web_controller_ titleDidChange:title]; |
| 246 [[[(id)mock_web_controller_ expect] | 248 [[[(id)mock_web_controller_ expect] |
| 247 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; | 249 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; |
| 248 web_state_impl_->OnPageLoaded(redirectUrl, true); | 250 web_state_impl_->OnPageLoaded(redirectUrl, true); |
| 249 } | 251 } |
| 250 | 252 |
| 251 void BrowseToNewTab() { | 253 void BrowseToNewTab() { |
| 252 DCHECK_EQ(tab_.get().webState, web_state_impl_); | 254 DCHECK_EQ(tab_.get().webState, web_state_impl_); |
| 253 const GURL url(kNewTabUrl); | 255 const GURL url(kNewTabUrl); |
| 254 // TODO(crbug.com/661992): This will not work with a mock CRWWebController. | 256 // TODO(crbug.com/661992): This will not work with a mock CRWWebController. |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 [[FakeNativeAppMetadata alloc] init]); | 549 [[FakeNativeAppMetadata alloc] init]); |
| 548 | 550 |
| 549 // Turn auto open on. | 551 // Turn auto open on. |
| 550 [metadata setShouldAutoOpenLinks:YES]; | 552 [metadata setShouldAutoOpenLinks:YES]; |
| 551 int expectedCallCount = 2; | 553 int expectedCallCount = 2; |
| 552 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); | 554 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); |
| 553 EXPECT_FALSE([metadata shouldAutoOpenLinks]); | 555 EXPECT_FALSE([metadata shouldAutoOpenLinks]); |
| 554 } | 556 } |
| 555 | 557 |
| 556 } // namespace | 558 } // namespace |
| OLD | NEW |