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

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

Issue 2724383003: Removed -[CRWWebDelegate webDidStartLoadingURL:updateHistory:]. (Closed)
Patch Set: Fixed ios_web_unittests Created 3 years, 9 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.mm ('k') | ios/web/navigation/crw_session_controller.mm » ('j') | 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 [tab_ webWillAddPendingURL:redirectUrl 232 [tab_ webWillAddPendingURL:redirectUrl
233 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT]; 233 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT];
234 234
235 web::Referrer empty_referrer; 235 web::Referrer empty_referrer;
236 [tab_ navigationManagerImpl]->AddPendingItem( 236 [tab_ navigationManagerImpl]->AddPendingItem(
237 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT, 237 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT,
238 web::NavigationInitiationType::RENDERER_INITIATED); 238 web::NavigationInitiationType::RENDERER_INITIATED);
239 239
240 web_state_impl_->OnProvisionalNavigationStarted(redirectUrl); 240 web_state_impl_->OnProvisionalNavigationStarted(redirectUrl);
241 [[tab_ navigationManagerImpl]->GetSessionController() commitPendingItem]; 241 [[tab_ navigationManagerImpl]->GetSessionController() commitPendingItem];
242 [[tab_ webController] webStateImpl]->UpdateHttpResponseHeaders(redirectUrl);
242 [[tab_ webController] webStateImpl]->OnNavigationCommitted(redirectUrl); 243 [[tab_ webController] webStateImpl]->OnNavigationCommitted(redirectUrl);
243 [tab_ webDidStartLoadingURL:redirectUrl shouldUpdateHistory:YES];
244 244
245 base::string16 new_title = base::SysNSStringToUTF16(title); 245 base::string16 new_title = base::SysNSStringToUTF16(title);
246 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title); 246 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title);
247 247
248 web_state_impl_->OnTitleChanged(); 248 web_state_impl_->OnTitleChanged();
249 [[[(id)mock_web_controller_ expect] 249 [[[(id)mock_web_controller_ expect]
250 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; 250 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase];
251 web_state_impl_->OnPageLoaded(redirectUrl, true); 251 web_state_impl_->OnPageLoaded(redirectUrl, true);
252 } 252 }
253 253
254 void BrowseToNewTab() { 254 void BrowseToNewTab() {
255 DCHECK_EQ(tab_.get().webState, web_state_impl_); 255 DCHECK_EQ(tab_.get().webState, web_state_impl_);
256 const GURL url(kNewTabUrl); 256 const GURL url(kNewTabUrl);
257 // TODO(crbug.com/661992): This will not work with a mock CRWWebController. 257 // TODO(crbug.com/661992): This will not work with a mock CRWWebController.
258 // The only test that uses it is currently disabled. 258 // The only test that uses it is currently disabled.
259 web::NavigationManager::WebLoadParams params(url); 259 web::NavigationManager::WebLoadParams params(url);
260 params.transition_type = ui::PAGE_TRANSITION_TYPED; 260 params.transition_type = ui::PAGE_TRANSITION_TYPED;
261 [[tab_ webController] loadWithParams:params]; 261 [[tab_ webController] loadWithParams:params];
262 [[[(id)mock_web_controller_ expect] 262 [[[(id)mock_web_controller_ expect]
263 andReturnValue:OCMOCK_VALUE(kPageLoading)] loadPhase]; 263 andReturnValue:OCMOCK_VALUE(kPageLoading)] loadPhase];
264 [tab_ webDidStartLoadingURL:url shouldUpdateHistory:YES];
265 [[[(id)mock_web_controller_ expect] 264 [[[(id)mock_web_controller_ expect]
266 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase]; 265 andReturnValue:OCMOCK_VALUE(kPageLoaded)] loadPhase];
267 web_state_impl_->OnPageLoaded(url, true); 266 web_state_impl_->OnPageLoaded(url, true);
268 web_state_impl_->OnTitleChanged(); 267 web_state_impl_->OnTitleChanged();
269 } 268 }
270 269
271 void QueryAllHistory(history::QueryResults* results) { 270 void QueryAllHistory(history::QueryResults* results) {
272 base::CancelableTaskTracker tracker; 271 base::CancelableTaskTracker tracker;
273 base::RunLoop run_loop; 272 base::RunLoop run_loop;
274 scoped_refptr<HistoryQueryResultsObserver> observer( 273 scoped_refptr<HistoryQueryResultsObserver> observer(
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 [[FakeNativeAppMetadata alloc] init]); 549 [[FakeNativeAppMetadata alloc] init]);
551 550
552 // Turn auto open on. 551 // Turn auto open on.
553 [metadata setShouldAutoOpenLinks:YES]; 552 [metadata setShouldAutoOpenLinks:YES];
554 int expectedCallCount = 2; 553 int expectedCallCount = 2;
555 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); 554 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO);
556 EXPECT_FALSE([metadata shouldAutoOpenLinks]); 555 EXPECT_FALSE([metadata shouldAutoOpenLinks]);
557 } 556 }
558 557
559 } // namespace 558 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab.mm ('k') | ios/web/navigation/crw_session_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698