Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Side by Side Diff: ios/chrome/browser/tabs/tab_unittest.mm

Issue 2921063002: Clean up CRWSessionController usage in TabTest and TabModelTest. (Closed)
Patch Set: rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/tabs/tab_model_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 #import "ios/chrome/browser/ui/open_in_controller_testing.h" 32 #import "ios/chrome/browser/ui/open_in_controller_testing.h"
33 #import "ios/chrome/browser/web/external_app_launcher.h" 33 #import "ios/chrome/browser/web/external_app_launcher.h"
34 #include "ios/chrome/test/block_cleanup_test.h" 34 #include "ios/chrome/test/block_cleanup_test.h"
35 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_provider.h" 35 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_provider.h"
36 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager .h" 36 #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager .h"
37 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" 37 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h"
38 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_ metadata.h" 38 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_ metadata.h"
39 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_ whitelist_manager.h" 39 #import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_ whitelist_manager.h"
40 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h" 40 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h"
41 #import "ios/testing/ocmock_complex_type_helper.h" 41 #import "ios/testing/ocmock_complex_type_helper.h"
42 #import "ios/web/navigation/crw_session_controller.h"
43 #import "ios/web/navigation/navigation_manager_impl.h" 42 #import "ios/web/navigation/navigation_manager_impl.h"
44 #include "ios/web/public/navigation_item.h" 43 #include "ios/web/public/navigation_item.h"
45 #import "ios/web/public/navigation_manager.h" 44 #import "ios/web/public/navigation_manager.h"
46 #include "ios/web/public/referrer.h" 45 #include "ios/web/public/referrer.h"
47 #include "ios/web/public/test/test_web_thread_bundle.h" 46 #include "ios/web/public/test/test_web_thread_bundle.h"
48 #import "ios/web/web_state/navigation_context_impl.h" 47 #import "ios/web/web_state/navigation_context_impl.h"
49 #import "ios/web/web_state/ui/crw_web_controller.h" 48 #import "ios/web/web_state/ui/crw_web_controller.h"
50 #import "ios/web/web_state/web_state_impl.h" 49 #import "ios/web/web_state/web_state_impl.h"
51 #import "net/base/mac/url_conversions.h" 50 #import "net/base/mac/url_conversions.h"
52 #include "net/http/http_response_headers.h" 51 #include "net/http/http_response_headers.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 [tab_ navigationManagerImpl]->AddPendingItem( 243 [tab_ navigationManagerImpl]->AddPendingItem(
245 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT, 244 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT,
246 web::NavigationInitiationType::RENDERER_INITIATED, 245 web::NavigationInitiationType::RENDERER_INITIATED,
247 web::NavigationManager::UserAgentOverrideOption::INHERIT); 246 web::NavigationManager::UserAgentOverrideOption::INHERIT);
248 247
249 std::unique_ptr<web::NavigationContext> context2 = 248 std::unique_ptr<web::NavigationContext> context2 =
250 web::NavigationContextImpl::CreateNavigationContext( 249 web::NavigationContextImpl::CreateNavigationContext(
251 web_state_impl_.get(), redirectUrl, 250 web_state_impl_.get(), redirectUrl,
252 ui::PageTransition::PAGE_TRANSITION_TYPED); 251 ui::PageTransition::PAGE_TRANSITION_TYPED);
253 web_state_impl_->OnNavigationStarted(context2.get()); 252 web_state_impl_->OnNavigationStarted(context2.get());
254 [[tab_ navigationManagerImpl]->GetSessionController() commitPendingItem]; 253 [tab_ navigationManagerImpl]->CommitPendingItem();
255 web_state_impl_->UpdateHttpResponseHeaders(redirectUrl); 254 web_state_impl_->UpdateHttpResponseHeaders(redirectUrl);
256 web_state_impl_->OnNavigationFinished(context2.get()); 255 web_state_impl_->OnNavigationFinished(context2.get());
257 256
258 base::string16 new_title = base::SysNSStringToUTF16(title); 257 base::string16 new_title = base::SysNSStringToUTF16(title);
259 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title); 258 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title);
260 259
261 web_state_impl_->OnTitleChanged(); 260 web_state_impl_->OnTitleChanged();
262 [[[(id)mock_web_controller_ expect] 261 [[[(id)mock_web_controller_ expect]
263 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; 262 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase];
264 web_state_impl_->OnPageLoaded(redirectUrl, true); 263 web_state_impl_->OnPageLoaded(redirectUrl, true);
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 FakeNativeAppMetadata* metadata = [[FakeNativeAppMetadata alloc] init]; 592 FakeNativeAppMetadata* metadata = [[FakeNativeAppMetadata alloc] init];
594 593
595 // Turn auto open on. 594 // Turn auto open on.
596 [metadata setShouldAutoOpenLinks:YES]; 595 [metadata setShouldAutoOpenLinks:YES];
597 int expectedCallCount = 2; 596 int expectedCallCount = 2;
598 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); 597 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO);
599 EXPECT_FALSE([metadata shouldAutoOpenLinks]); 598 EXPECT_FALSE([metadata shouldAutoOpenLinks]);
600 } 599 }
601 600
602 } // namespace 601 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab_model_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698