| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/strings/string16.h" | 5 #include "base/strings/string16.h" |
| 6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/browser/frame_host/navigation_entry_impl.h" | 9 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 EXPECT_EQ(NULL, entry2_->GetBrowserInitiatedPostData()); | 200 EXPECT_EQ(NULL, entry2_->GetBrowserInitiatedPostData()); |
| 201 const int length = 11; | 201 const int length = 11; |
| 202 const unsigned char* raw_data = | 202 const unsigned char* raw_data = |
| 203 reinterpret_cast<const unsigned char*>("post\n\n\0data"); | 203 reinterpret_cast<const unsigned char*>("post\n\n\0data"); |
| 204 std::vector<unsigned char> post_data_vector(raw_data, raw_data+length); | 204 std::vector<unsigned char> post_data_vector(raw_data, raw_data+length); |
| 205 scoped_refptr<base::RefCountedBytes> post_data = | 205 scoped_refptr<base::RefCountedBytes> post_data = |
| 206 base::RefCountedBytes::TakeVector(&post_data_vector); | 206 base::RefCountedBytes::TakeVector(&post_data_vector); |
| 207 entry2_->SetBrowserInitiatedPostData(post_data.get()); | 207 entry2_->SetBrowserInitiatedPostData(post_data.get()); |
| 208 EXPECT_EQ(post_data->front(), | 208 EXPECT_EQ(post_data->front(), |
| 209 entry2_->GetBrowserInitiatedPostData()->front()); | 209 entry2_->GetBrowserInitiatedPostData()->front()); |
| 210 | |
| 211 // Frame to navigate. | |
| 212 EXPECT_TRUE(entry1_->GetFrameToNavigate().empty()); | |
| 213 EXPECT_TRUE(entry2_->GetFrameToNavigate().empty()); | |
| 214 } | 210 } |
| 215 | 211 |
| 216 // Test basic Clone behavior. | 212 // Test basic Clone behavior. |
| 217 TEST_F(NavigationEntryTest, NavigationEntryClone) { | 213 TEST_F(NavigationEntryTest, NavigationEntryClone) { |
| 218 // Set some additional values. | 214 // Set some additional values. |
| 219 entry2_->SetTransitionType(ui::PAGE_TRANSITION_RELOAD); | 215 entry2_->SetTransitionType(ui::PAGE_TRANSITION_RELOAD); |
| 220 entry2_->set_should_replace_entry(true); | 216 entry2_->set_should_replace_entry(true); |
| 221 | 217 |
| 222 scoped_ptr<NavigationEntryImpl> clone(entry2_->Clone()); | 218 scoped_ptr<NavigationEntryImpl> clone(entry2_->Clone()); |
| 223 | 219 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // Content in |output| is not modified if data is not present at the key. | 253 // Content in |output| is not modified if data is not present at the key. |
| 258 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output)); | 254 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output)); |
| 259 EXPECT_EQ(test_data, output); | 255 EXPECT_EQ(test_data, output); |
| 260 // Using an empty string shows that the data is not present in the map. | 256 // Using an empty string shows that the data is not present in the map. |
| 261 base::string16 output2; | 257 base::string16 output2; |
| 262 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output2)); | 258 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output2)); |
| 263 EXPECT_EQ(ASCIIToUTF16(""), output2); | 259 EXPECT_EQ(ASCIIToUTF16(""), output2); |
| 264 } | 260 } |
| 265 | 261 |
| 266 } // namespace content | 262 } // namespace content |
| OLD | NEW |