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

Side by Side Diff: ios/web/navigation/crw_session_entry_unittest.mm

Issue 2672953005: Updated ownership of NavigationItems within CRWSessionController. (Closed)
Patch Set: fix unittests 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 | « ios/web/navigation/crw_session_entry.mm ('k') | ios/web/navigation/navigation_item_impl_list.h » ('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 "ios/web/navigation/crw_session_entry.h" 5 #import "ios/web/navigation/crw_session_entry.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 15 matching lines...) Expand all
26 public: 26 public:
27 static void expectEqualSessionEntries(CRWSessionEntry* entry1, 27 static void expectEqualSessionEntries(CRWSessionEntry* entry1,
28 CRWSessionEntry* entry2, 28 CRWSessionEntry* entry2,
29 ui::PageTransition transition); 29 ui::PageTransition transition);
30 30
31 protected: 31 protected:
32 void SetUp() override { 32 void SetUp() override {
33 GURL url("http://init.test"); 33 GURL url("http://init.test");
34 ui::PageTransition transition = 34 ui::PageTransition transition =
35 ui::PAGE_TRANSITION_AUTO_BOOKMARK; 35 ui::PAGE_TRANSITION_AUTO_BOOKMARK;
36 std::unique_ptr<web::NavigationItemImpl> item( 36 item_.reset(new web::NavigationItemImpl());
37 new web::NavigationItemImpl()); 37 item_->SetOriginalRequestURL(url);
38 item->SetOriginalRequestURL(url); 38 item_->SetURL(url);
39 item->SetURL(url); 39 item_->SetTransitionType(transition);
40 item->SetTransitionType(transition); 40 item_->SetTimestamp(base::Time::Now());
41 item->SetTimestamp(base::Time::Now()); 41 item_->SetPostData([@"Test data" dataUsingEncoding:NSUTF8StringEncoding]);
42 item->SetPostData([@"Test data" dataUsingEncoding:NSUTF8StringEncoding]);
43 session_entry_.reset( 42 session_entry_.reset(
44 [[CRWSessionEntry alloc] initWithNavigationItem:std::move(item)]); 43 [[CRWSessionEntry alloc] initWithNavigationItem:item_.get()]);
45 } 44 }
46 45
47 protected: 46 protected:
47 std::unique_ptr<web::NavigationItemImpl> item_;
48 base::scoped_nsobject<CRWSessionEntry> session_entry_; 48 base::scoped_nsobject<CRWSessionEntry> session_entry_;
49 }; 49 };
50 50
51 void CRWSessionEntryTest::expectEqualSessionEntries( 51 void CRWSessionEntryTest::expectEqualSessionEntries(
52 CRWSessionEntry* entry1, 52 CRWSessionEntry* entry1,
53 CRWSessionEntry* entry2, 53 CRWSessionEntry* entry2,
54 ui::PageTransition transition) { 54 ui::PageTransition transition) {
55 web::NavigationItemImpl* navItem1 = entry1.navigationItemImpl; 55 web::NavigationItemImpl* navItem1 = entry1.navigationItemImpl;
56 web::NavigationItemImpl* navItem2 = entry2.navigationItemImpl; 56 web::NavigationItemImpl* navItem2 = entry2.navigationItemImpl;
57 // url is not compared because it could differ after copy or archive. 57 // url is not compared because it could differ after copy or archive.
(...skipping 30 matching lines...) Expand all
88 TEST_F(CRWSessionEntryTest, NonEmptyVirtualUrl) { 88 TEST_F(CRWSessionEntryTest, NonEmptyVirtualUrl) {
89 web::NavigationItem* item = [session_entry_ navigationItem]; 89 web::NavigationItem* item = [session_entry_ navigationItem];
90 item->SetVirtualURL(GURL("http://user.friendly")); 90 item->SetVirtualURL(GURL("http://user.friendly"));
91 EXPECT_EQ(GURL("http://user.friendly/"), item->GetVirtualURL()); 91 EXPECT_EQ(GURL("http://user.friendly/"), item->GetVirtualURL());
92 EXPECT_EQ(GURL("http://init.test/"), item->GetURL()); 92 EXPECT_EQ(GURL("http://init.test/"), item->GetURL());
93 } 93 }
94 94
95 TEST_F(CRWSessionEntryTest, EmptyDescription) { 95 TEST_F(CRWSessionEntryTest, EmptyDescription) {
96 EXPECT_GT([[session_entry_ description] length], 0U); 96 EXPECT_GT([[session_entry_ description] length], 0U);
97 } 97 }
OLDNEW
« no previous file with comments | « ios/web/navigation/crw_session_entry.mm ('k') | ios/web/navigation/navigation_item_impl_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698