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

Side by Side Diff: ios/chrome/browser/native_app_launcher/native_app_navigation_util_unittest.mm

Issue 2672723003: Converted CRWSessionController to use NavigationItems. (Closed)
Patch Set: test fixes, self review Created 3 years, 10 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/chrome/browser/tabs/tab.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #include "ios/chrome/browser/native_app_launcher/native_app_navigation_util.h" 5 #include "ios/chrome/browser/native_app_launcher/native_app_navigation_util.h"
6 6
7 #import "ios/web/navigation/crw_session_controller.h" 7 #import "ios/web/navigation/crw_session_controller.h"
8 #import "ios/web/navigation/navigation_manager_impl.h" 8 #import "ios/web/navigation/navigation_manager_impl.h"
9 #include "ios/web/public/referrer.h" 9 #include "ios/web/public/referrer.h"
10 #include "ios/web/public/test/web_test.h" 10 #include "ios/web/public/test/web_test.h"
(...skipping 19 matching lines...) Expand all
30 void TearDown() override { 30 void TearDown() override {
31 web_state_.reset(); 31 web_state_.reset();
32 web::WebTest::TearDown(); 32 web::WebTest::TearDown();
33 } 33 }
34 34
35 web::WebState* web_state() { return web_state_->GetWebState(); } 35 web::WebState* web_state() { return web_state_->GetWebState(); }
36 36
37 void AddItem(const std::string& url_spec, ui::PageTransition transition) { 37 void AddItem(const std::string& url_spec, ui::PageTransition transition) {
38 CRWSessionController* session_controller = 38 CRWSessionController* session_controller =
39 web_state_->GetNavigationManagerImpl().GetSessionController(); 39 web_state_->GetNavigationManagerImpl().GetSessionController();
40 [session_controller addPendingEntry:GURL(url_spec) 40 [session_controller addPendingItem:GURL(url_spec)
41 referrer:web::Referrer() 41 referrer:web::Referrer()
42 transition:transition 42 transition:transition
43 rendererInitiated:NO]; 43 rendererInitiated:NO];
44 [session_controller commitPendingEntry]; 44 [session_controller commitPendingItem];
45 } 45 }
46 46
47 private: 47 private:
48 std::unique_ptr<web::WebStateImpl> web_state_; 48 std::unique_ptr<web::WebStateImpl> web_state_;
49 }; 49 };
50 50
51 // Tests that default state is not a link click. 51 // Tests that default state is not a link click.
52 TEST_F(NativeAppNavigationUtilsTest, TestEmpty) { 52 TEST_F(NativeAppNavigationUtilsTest, TestEmpty) {
53 EXPECT_FALSE(native_app_launcher::IsLinkNavigation(web_state())); 53 EXPECT_FALSE(native_app_launcher::IsLinkNavigation(web_state()));
54 } 54 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 // The first non-redirect entry is tested. Earlier redirects do not matter. 92 // The first non-redirect entry is tested. Earlier redirects do not matter.
93 TEST_F(NativeAppNavigationUtilsTest, TestTypedUrlWithRedirectEarlier) { 93 TEST_F(NativeAppNavigationUtilsTest, TestTypedUrlWithRedirectEarlier) {
94 AddItem("http://foo.com/page0", ui::PAGE_TRANSITION_LINK); 94 AddItem("http://foo.com/page0", ui::PAGE_TRANSITION_LINK);
95 AddItem("http://bar.com/page1", ui::PAGE_TRANSITION_SERVER_REDIRECT); 95 AddItem("http://bar.com/page1", ui::PAGE_TRANSITION_SERVER_REDIRECT);
96 AddItem("http://blah.com/page2", ui::PAGE_TRANSITION_TYPED); 96 AddItem("http://blah.com/page2", ui::PAGE_TRANSITION_TYPED);
97 EXPECT_FALSE(native_app_launcher::IsLinkNavigation(web_state())); 97 EXPECT_FALSE(native_app_launcher::IsLinkNavigation(web_state()));
98 } 98 }
99 99
100 } // namespace 100 } // namespace
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/tabs/tab.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698