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

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

Issue 2896623003: Added web::NavigationContext::GetPageTransition. (Closed)
Patch Set: Rebased Created 3 years, 7 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 | « no previous file | ios/web/public/test/fakes/crw_test_web_state_observer.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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 web_state_impl_.reset(); 227 web_state_impl_.reset();
228 BlockCleanupTest::TearDown(); 228 BlockCleanupTest::TearDown();
229 } 229 }
230 230
231 void BrowseTo(const GURL& userUrl, const GURL& redirectUrl, NSString* title) { 231 void BrowseTo(const GURL& userUrl, const GURL& redirectUrl, NSString* title) {
232 DCHECK_EQ(tab_.get().webState, web_state_impl_.get()); 232 DCHECK_EQ(tab_.get().webState, web_state_impl_.get());
233 233
234 [tab_ webWillAddPendingURL:userUrl transition:ui::PAGE_TRANSITION_TYPED]; 234 [tab_ webWillAddPendingURL:userUrl transition:ui::PAGE_TRANSITION_TYPED];
235 std::unique_ptr<web::NavigationContext> context1 = 235 std::unique_ptr<web::NavigationContext> context1 =
236 web::NavigationContextImpl::CreateNavigationContext( 236 web::NavigationContextImpl::CreateNavigationContext(
237 web_state_impl_.get(), userUrl); 237 web_state_impl_.get(), userUrl,
238 ui::PageTransition::PAGE_TRANSITION_TYPED);
238 web_state_impl_->OnNavigationStarted(context1.get()); 239 web_state_impl_->OnNavigationStarted(context1.get());
239 [tab_ webWillAddPendingURL:redirectUrl 240 [tab_ webWillAddPendingURL:redirectUrl
240 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT]; 241 transition:ui::PAGE_TRANSITION_CLIENT_REDIRECT];
241 242
242 web::Referrer empty_referrer; 243 web::Referrer empty_referrer;
243 [tab_ navigationManagerImpl]->AddPendingItem( 244 [tab_ navigationManagerImpl]->AddPendingItem(
244 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT, 245 redirectUrl, empty_referrer, ui::PAGE_TRANSITION_CLIENT_REDIRECT,
245 web::NavigationInitiationType::RENDERER_INITIATED, 246 web::NavigationInitiationType::RENDERER_INITIATED,
246 web::NavigationManager::UserAgentOverrideOption::INHERIT); 247 web::NavigationManager::UserAgentOverrideOption::INHERIT);
247 248
248 std::unique_ptr<web::NavigationContext> context2 = 249 std::unique_ptr<web::NavigationContext> context2 =
249 web::NavigationContextImpl::CreateNavigationContext( 250 web::NavigationContextImpl::CreateNavigationContext(
250 web_state_impl_.get(), redirectUrl); 251 web_state_impl_.get(), redirectUrl,
252 ui::PageTransition::PAGE_TRANSITION_TYPED);
251 web_state_impl_->OnNavigationStarted(context2.get()); 253 web_state_impl_->OnNavigationStarted(context2.get());
252 [[tab_ navigationManagerImpl]->GetSessionController() commitPendingItem]; 254 [[tab_ navigationManagerImpl]->GetSessionController() commitPendingItem];
253 web_state_impl_->UpdateHttpResponseHeaders(redirectUrl); 255 web_state_impl_->UpdateHttpResponseHeaders(redirectUrl);
254 web_state_impl_->OnNavigationFinished(context2.get()); 256 web_state_impl_->OnNavigationFinished(context2.get());
255 257
256 base::string16 new_title = base::SysNSStringToUTF16(title); 258 base::string16 new_title = base::SysNSStringToUTF16(title);
257 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title); 259 [tab_ navigationManager]->GetLastCommittedItem()->SetTitle(new_title);
258 260
259 web_state_impl_->OnTitleChanged(); 261 web_state_impl_->OnTitleChanged();
260 [[[(id)mock_web_controller_ expect] 262 [[[(id)mock_web_controller_ expect]
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 [[FakeNativeAppMetadata alloc] init]); 595 [[FakeNativeAppMetadata alloc] init]);
594 596
595 // Turn auto open on. 597 // Turn auto open on.
596 [metadata setShouldAutoOpenLinks:YES]; 598 [metadata setShouldAutoOpenLinks:YES];
597 int expectedCallCount = 2; 599 int expectedCallCount = 2;
598 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO); 600 TestOpenNativeAppURL(testURL, NO, expectedCallCount, NO);
599 EXPECT_FALSE([metadata shouldAutoOpenLinks]); 601 EXPECT_FALSE([metadata shouldAutoOpenLinks]);
600 } 602 }
601 603
602 } // namespace 604 } // namespace
OLDNEW
« no previous file with comments | « no previous file | ios/web/public/test/fakes/crw_test_web_state_observer.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698