OLD | NEW |
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 <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
| 6 #include <stdint.h> |
6 | 7 |
7 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
8 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
9 #import "ios/testing/ocmock_complex_type_helper.h" | 10 #import "ios/testing/ocmock_complex_type_helper.h" |
10 #import "ios/web/navigation/crw_session_entry.h" | 11 #import "ios/web/navigation/crw_session_entry.h" |
11 #include "ios/web/navigation/navigation_item_impl.h" | 12 #include "ios/web/navigation/navigation_item_impl.h" |
12 #include "ios/web/public/referrer.h" | 13 #include "ios/web/public/referrer.h" |
13 #import "net/base/mac/url_conversions.h" | 14 #import "net/base/mac/url_conversions.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "testing/gtest_mac.h" | 16 #include "testing/gtest_mac.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 expectEqualSessionEntries(sessionEntry_, newSessionEntry, | 159 expectEqualSessionEntries(sessionEntry_, newSessionEntry, |
159 ui::PAGE_TRANSITION_RELOAD); | 160 ui::PAGE_TRANSITION_RELOAD); |
160 EXPECT_NE(item->GetURL(), newItem->GetURL()); | 161 EXPECT_NE(item->GetURL(), newItem->GetURL()); |
161 EXPECT_EQ(item->GetVirtualURL(), newItem->GetURL()); | 162 EXPECT_EQ(item->GetVirtualURL(), newItem->GetURL()); |
162 } | 163 } |
163 | 164 |
164 TEST_F(CRWSessionEntryTest, InitWithCoderNewStyle) { | 165 TEST_F(CRWSessionEntryTest, InitWithCoderNewStyle) { |
165 web::NavigationItem* item = [sessionEntry_ navigationItem]; | 166 web::NavigationItem* item = [sessionEntry_ navigationItem]; |
166 item->SetVirtualURL(GURL("http://user.friendly")); | 167 item->SetVirtualURL(GURL("http://user.friendly")); |
167 item->SetTitle(base::SysNSStringToUTF16(@"Title")); | 168 item->SetTitle(base::SysNSStringToUTF16(@"Title")); |
168 int64 timestamp = item->GetTimestamp().ToInternalValue(); | 169 int64_t timestamp = item->GetTimestamp().ToInternalValue(); |
169 | 170 |
170 std::string virtualUrl = item->GetVirtualURL().spec(); | 171 std::string virtualUrl = item->GetVirtualURL().spec(); |
171 std::string referrerUrl = item->GetReferrer().url.spec(); | 172 std::string referrerUrl = item->GetReferrer().url.spec(); |
172 NSString* title = base::SysUTF16ToNSString(item->GetTitle()); | 173 NSString* title = base::SysUTF16ToNSString(item->GetTitle()); |
173 base::scoped_nsobject<id> decoder([[OCMockComplexTypeHelper alloc] | 174 base::scoped_nsobject<id> decoder([[OCMockComplexTypeHelper alloc] |
174 initWithRepresentedObject:[OCMockObject mockForClass:[NSCoder class]]]); | 175 initWithRepresentedObject:[OCMockObject mockForClass:[NSCoder class]]]); |
175 | 176 |
176 const std::string emptyString; | 177 const std::string emptyString; |
177 decodeBytesForKeyBlock block = ^ const uint8_t* (NSString* key, | 178 decodeBytesForKeyBlock block = ^ const uint8_t* (NSString* key, |
178 NSUInteger* length) { | 179 NSUInteger* length) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 TEST_F(CRWSessionEntryTest, NonEmptyVirtualUrl) { | 324 TEST_F(CRWSessionEntryTest, NonEmptyVirtualUrl) { |
324 web::NavigationItem* item = [sessionEntry_ navigationItem]; | 325 web::NavigationItem* item = [sessionEntry_ navigationItem]; |
325 item->SetVirtualURL(GURL("http://user.friendly")); | 326 item->SetVirtualURL(GURL("http://user.friendly")); |
326 EXPECT_EQ(GURL("http://user.friendly/"), item->GetVirtualURL()); | 327 EXPECT_EQ(GURL("http://user.friendly/"), item->GetVirtualURL()); |
327 EXPECT_EQ(GURL("http://init.test/"), item->GetURL()); | 328 EXPECT_EQ(GURL("http://init.test/"), item->GetURL()); |
328 } | 329 } |
329 | 330 |
330 TEST_F(CRWSessionEntryTest, EmptyDescription) { | 331 TEST_F(CRWSessionEntryTest, EmptyDescription) { |
331 EXPECT_GT([[sessionEntry_ description] length], 0U); | 332 EXPECT_GT([[sessionEntry_ description] length], 0U); |
332 } | 333 } |
OLD | NEW |