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

Side by Side Diff: content/browser/frame_host/navigation_entry_impl_unittest.cc

Issue 1104603002: Pick frame to navigate in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test cases Created 5 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 | « content/browser/frame_host/navigation_entry_impl.cc ('k') | content/common/frame_messages.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 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
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
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
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_entry_impl.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698