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