| 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 12 matching lines...) Expand all Loading... |
| 23 #import "ios/chrome/browser/chrome_url_util.h" | 23 #import "ios/chrome/browser/chrome_url_util.h" |
| 24 #include "ios/chrome/browser/history/history_service_factory.h" | 24 #include "ios/chrome/browser/history/history_service_factory.h" |
| 25 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" | 25 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" |
| 26 #import "ios/chrome/browser/tabs/tab.h" | 26 #import "ios/chrome/browser/tabs/tab.h" |
| 27 #import "ios/chrome/browser/tabs/tab_helper_util.h" | 27 #import "ios/chrome/browser/tabs/tab_helper_util.h" |
| 28 #import "ios/chrome/browser/tabs/tab_model.h" | 28 #import "ios/chrome/browser/tabs/tab_model.h" |
| 29 #import "ios/chrome/browser/tabs/tab_private.h" | 29 #import "ios/chrome/browser/tabs/tab_private.h" |
| 30 #import "ios/chrome/browser/ui/open_in_controller.h" | 30 #import "ios/chrome/browser/ui/open_in_controller.h" |
| 31 #import "ios/chrome/browser/ui/open_in_controller_testing.h" | 31 #import "ios/chrome/browser/ui/open_in_controller_testing.h" |
| 32 #import "ios/chrome/browser/web/external_app_launcher.h" | 32 #import "ios/chrome/browser/web/external_app_launcher.h" |
| 33 #import "ios/chrome/browser/web/tab_id_tab_helper.h" |
| 33 #include "ios/chrome/test/block_cleanup_test.h" | 34 #include "ios/chrome/test/block_cleanup_test.h" |
| 34 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager
.h" | 35 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager
.h" |
| 35 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" | 36 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" |
| 36 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h" | 37 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h" |
| 37 #import "ios/testing/ocmock_complex_type_helper.h" | 38 #import "ios/testing/ocmock_complex_type_helper.h" |
| 38 #import "ios/web/navigation/navigation_manager_impl.h" | 39 #import "ios/web/navigation/navigation_manager_impl.h" |
| 39 #include "ios/web/public/navigation_item.h" | 40 #include "ios/web/public/navigation_item.h" |
| 40 #import "ios/web/public/navigation_manager.h" | 41 #import "ios/web/public/navigation_manager.h" |
| 41 #include "ios/web/public/referrer.h" | 42 #include "ios/web/public/referrer.h" |
| 42 #include "ios/web/public/test/test_web_thread_bundle.h" | 43 #include "ios/web/public/test/test_web_thread_bundle.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 web::WebState::CreateParams create_params(browser_state); | 174 web::WebState::CreateParams create_params(browser_state); |
| 174 web_state_impl_ = base::MakeUnique<web::WebStateImpl>(create_params); | 175 web_state_impl_ = base::MakeUnique<web::WebStateImpl>(create_params); |
| 175 web_state_impl_->SetWebController(mock_web_controller_); | 176 web_state_impl_->SetWebController(mock_web_controller_); |
| 176 web_state_impl_->GetNavigationManagerImpl().InitializeSession(); | 177 web_state_impl_->GetNavigationManagerImpl().InitializeSession(); |
| 177 web::WebStateImpl* web_state_impl = web_state_impl_.get(); | 178 web::WebStateImpl* web_state_impl = web_state_impl_.get(); |
| 178 [[[static_cast<OCMockObject*>(mock_web_controller_) stub] | 179 [[[static_cast<OCMockObject*>(mock_web_controller_) stub] |
| 179 andReturnValue:OCMOCK_VALUE(web_state_impl)] webStateImpl]; | 180 andReturnValue:OCMOCK_VALUE(web_state_impl)] webStateImpl]; |
| 180 web_controller_view_ = [[UIView alloc] init]; | 181 web_controller_view_ = [[UIView alloc] init]; |
| 181 [[[static_cast<OCMockObject*>(mock_web_controller_) stub] | 182 [[[static_cast<OCMockObject*>(mock_web_controller_) stub] |
| 182 andReturn:web_controller_view_] view]; | 183 andReturn:web_controller_view_] view]; |
| 184 TabIdTabHelper::CreateForWebState(web_state_impl_.get()); |
| 183 LegacyTabHelper::CreateForWebState(web_state_impl_.get()); | 185 LegacyTabHelper::CreateForWebState(web_state_impl_.get()); |
| 184 tab_ = LegacyTabHelper::GetTabForWebState(web_state_impl_.get()); | 186 tab_ = LegacyTabHelper::GetTabForWebState(web_state_impl_.get()); |
| 185 web::NavigationManager::WebLoadParams load_params( | 187 web::NavigationManager::WebLoadParams load_params( |
| 186 GURL("chrome://version/")); | 188 GURL("chrome://version/")); |
| 187 [tab_ navigationManager]->LoadURLWithParams(load_params); | 189 [tab_ navigationManager]->LoadURLWithParams(load_params); |
| 188 | 190 |
| 189 // There should be no entries in the history at this point. | 191 // There should be no entries in the history at this point. |
| 190 history::QueryResults results; | 192 history::QueryResults results; |
| 191 QueryAllHistory(&results); | 193 QueryAllHistory(&results); |
| 192 EXPECT_EQ(0UL, results.size()); | 194 EXPECT_EQ(0UL, results.size()); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 GURL url(kInvalidFilenameUrl); | 396 GURL url(kInvalidFilenameUrl); |
| 395 scoped_refptr<net::HttpResponseHeaders> headers = | 397 scoped_refptr<net::HttpResponseHeaders> headers = |
| 396 new net::HttpResponseHeaders("HTTP 1.1 200 OK"); | 398 new net::HttpResponseHeaders("HTTP 1.1 200 OK"); |
| 397 headers->AddHeader(base::StringPrintf("Content-Type: application/pdf")); | 399 headers->AddHeader(base::StringPrintf("Content-Type: application/pdf")); |
| 398 web_state_impl_->OnHttpResponseHeadersReceived(headers.get(), url); | 400 web_state_impl_->OnHttpResponseHeadersReceived(headers.get(), url); |
| 399 BrowseTo(url, url, [NSString string]); | 401 BrowseTo(url, url, [NSString string]); |
| 400 EXPECT_NSEQ(@"Document.pdf", [[tab_ openInController] suggestedFilename]); | 402 EXPECT_NSEQ(@"Document.pdf", [[tab_ openInController] suggestedFilename]); |
| 401 } | 403 } |
| 402 | 404 |
| 403 } // namespace | 405 } // namespace |
| OLD | NEW |