| 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 29 matching lines...) Expand all Loading... |
| 40 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_
metadata.h" | 40 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_
metadata.h" |
| 41 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_
whitelist_manager.h" | 41 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_
whitelist_manager.h" |
| 42 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h" | 42 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h" |
| 43 #import "ios/testing/ocmock_complex_type_helper.h" | 43 #import "ios/testing/ocmock_complex_type_helper.h" |
| 44 #import "ios/web/navigation/crw_session_controller.h" | 44 #import "ios/web/navigation/crw_session_controller.h" |
| 45 #import "ios/web/navigation/navigation_manager_impl.h" | 45 #import "ios/web/navigation/navigation_manager_impl.h" |
| 46 #include "ios/web/public/navigation_item.h" | 46 #include "ios/web/public/navigation_item.h" |
| 47 #import "ios/web/public/navigation_manager.h" | 47 #import "ios/web/public/navigation_manager.h" |
| 48 #include "ios/web/public/referrer.h" | 48 #include "ios/web/public/referrer.h" |
| 49 #include "ios/web/public/test/test_web_thread_bundle.h" | 49 #include "ios/web/public/test/test_web_thread_bundle.h" |
| 50 #include "ios/web/web_state/navigation_context_impl.h" |
| 50 #import "ios/web/web_state/ui/crw_web_controller.h" | 51 #import "ios/web/web_state/ui/crw_web_controller.h" |
| 51 #import "ios/web/web_state/web_state_impl.h" | 52 #import "ios/web/web_state/web_state_impl.h" |
| 52 #import "net/base/mac/url_conversions.h" | 53 #import "net/base/mac/url_conversions.h" |
| 53 #include "net/http/http_response_headers.h" | 54 #include "net/http/http_response_headers.h" |
| 54 #include "testing/gtest/include/gtest/gtest.h" | 55 #include "testing/gtest/include/gtest/gtest.h" |
| 55 #include "testing/gtest_mac.h" | 56 #include "testing/gtest_mac.h" |
| 56 #import "third_party/ocmock/OCMock/OCMock.h" | 57 #import "third_party/ocmock/OCMock/OCMock.h" |
| 57 | 58 |
| 58 using web::WebStateImpl; | 59 using web::WebStateImpl; |
| 59 | 60 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 238 |
| 238 web::Referrer empty_referrer; | 239 web::Referrer empty_referrer; |
| 239 [tab_ navigationManagerImpl]->AddPendingItem( | 240 [tab_ navigationManagerImpl]->AddPendingItem( |
| 240 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT, | 241 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT, |
| 241 web::NavigationInitiationType::RENDERER_INITIATED, | 242 web::NavigationInitiationType::RENDERER_INITIATED, |
| 242 web::NavigationManager::UserAgentOverrideOption::INHERIT); | 243 web::NavigationManager::UserAgentOverrideOption::INHERIT); |
| 243 | 244 |
| 244 web_state_impl_->OnProvisionalNavigationStarted(redirectUrl); | 245 web_state_impl_->OnProvisionalNavigationStarted(redirectUrl); |
| 245 [[tab_ navigationManagerImpl]->GetSessionController() commitPendingItem]; | 246 [[tab_ navigationManagerImpl]->GetSessionController() commitPendingItem]; |
| 246 web_state_impl_->UpdateHttpResponseHeaders(redirectUrl); | 247 web_state_impl_->UpdateHttpResponseHeaders(redirectUrl); |
| 247 web_state_impl_->OnNavigationCommitted(redirectUrl); | 248 std::unique_ptr<web::NavigationContext> context = |
| 249 web::NavigationContextImpl::CreateNavigationContext( |
| 250 web_state_impl_.get(), redirectUrl); |
| 251 web_state_impl_->OnNavigationFinished(context.get()); |
| 248 | 252 |
| 249 base::string16 new_title = base::SysNSStringToUTF16(title); | 253 base::string16 new_title = base::SysNSStringToUTF16(title); |
| 250 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title); | 254 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title); |
| 251 | 255 |
| 252 web_state_impl_->OnTitleChanged(); | 256 web_state_impl_->OnTitleChanged(); |
| 253 [[[(id)mock_web_controller_ expect] | 257 [[[(id)mock_web_controller_ expect] |
| 254 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; | 258 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; |
| 255 web_state_impl_->OnPageLoaded(redirectUrl, true); | 259 web_state_impl_->OnPageLoaded(redirectUrl, true); |
| 256 } | 260 } |
| 257 | 261 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 [[FakeNativeAppMetadata alloc] init]); | 590 [[FakeNativeAppMetadata alloc] init]); |
| 587 | 591 |
| 588 // Turn auto open on. | 592 // Turn auto open on. |
| 589 [metadata setShouldAutoOpenLinks:YES]; | 593 [metadata setShouldAutoOpenLinks:YES]; |
| 590 int expectedCallCount = 2; | 594 int expectedCallCount = 2; |
| 591 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); | 595 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); |
| 592 EXPECT_FALSE([metadata shouldAutoOpenLinks]); | 596 EXPECT_FALSE([metadata shouldAutoOpenLinks]); |
| 593 } | 597 } |
| 594 | 598 |
| 595 } // namespace | 599 } // namespace |
| OLD | NEW |