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); |
249 [tab_ webController:mock_web_controller_ titleDidChange:title]; | 251 [tab_ webController:mock_web_controller_ titleDidChange:title]; |
250 [[[(id)mock_web_controller_ expect] | 252 [[[(id)mock_web_controller_ expect] |
251 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; | 253 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; |
252 web_state_impl_->OnPageLoaded(redirectUrl, true); | 254 web_state_impl_->OnPageLoaded(redirectUrl, true); |
253 } | 255 } |
254 | 256 |
255 void BrowseToNewTab() { | 257 void BrowseToNewTab() { |
256 DCHECK_EQ(tab_.get().webState, web_state_impl_); | 258 DCHECK_EQ(tab_.get().webState, web_state_impl_); |
257 const GURL url(kNewTabUrl); | 259 const GURL url(kNewTabUrl); |
258 // TODO(crbug.com/661992): This will not work with a mock CRWWebController. | 260 // 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... |
551 [[FakeNativeAppMetadata alloc] init]); | 553 [[FakeNativeAppMetadata alloc] init]); |
552 | 554 |
553 // Turn auto open on. | 555 // Turn auto open on. |
554 [metadata setShouldAutoOpenLinks:YES]; | 556 [metadata setShouldAutoOpenLinks:YES]; |
555 int expectedCallCount = 2; | 557 int expectedCallCount = 2; |
556 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); | 558 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); |
557 EXPECT_FALSE([metadata shouldAutoOpenLinks]); | 559 EXPECT_FALSE([metadata shouldAutoOpenLinks]); |
558 } | 560 } |
559 | 561 |
560 } // namespace | 562 } // namespace |
OLD | NEW |