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

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

Issue 11193051: To fix the cross-site post submission bug. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Android API, Helper Function and Include_rules Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "base/string16.h" 5 #include "base/string16.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "content/browser/site_instance_impl.h" 9 #include "content/browser/site_instance_impl.h"
10 #include "content/browser/web_contents/navigation_entry_impl.h" 10 #include "content/browser/web_contents/navigation_entry_impl.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 entry2_->SetOriginalRequestURL(GURL("original_url")); 185 entry2_->SetOriginalRequestURL(GURL("original_url"));
186 EXPECT_EQ(GURL("original_url"), entry2_->GetOriginalRequestURL()); 186 EXPECT_EQ(GURL("original_url"), entry2_->GetOriginalRequestURL());
187 187
188 // User agent override 188 // User agent override
189 EXPECT_FALSE(entry1_->GetIsOverridingUserAgent()); 189 EXPECT_FALSE(entry1_->GetIsOverridingUserAgent());
190 EXPECT_FALSE(entry2_->GetIsOverridingUserAgent()); 190 EXPECT_FALSE(entry2_->GetIsOverridingUserAgent());
191 entry2_->SetIsOverridingUserAgent(true); 191 entry2_->SetIsOverridingUserAgent(true);
192 EXPECT_TRUE(entry2_->GetIsOverridingUserAgent()); 192 EXPECT_TRUE(entry2_->GetIsOverridingUserAgent());
193 193
194 // Browser initiated post data 194 // Browser initiated post data
195 EXPECT_EQ(NULL, entry1_->GetBrowserInitiatedPostData()); 195 EXPECT_FALSE(entry1_->GetBrowserInitiatedPostData().get());
196 EXPECT_EQ(NULL, entry2_->GetBrowserInitiatedPostData()); 196 EXPECT_FALSE(entry2_->GetBrowserInitiatedPostData().get());
197 const int length = 11; 197 const char* raw_data = "post\n\n\0data";
198 const unsigned char* raw_data = 198 const unsigned int length = 11;
199 reinterpret_cast<const unsigned char*>("post\n\n\0data"); 199 scoped_refptr<webkit_glue::ResourceRequestBody> post_data =
200 std::vector<unsigned char> post_data_vector(raw_data, raw_data+length); 200 new webkit_glue::ResourceRequestBody;
201 scoped_refptr<base::RefCountedBytes> post_data = 201 post_data->AppendBytes(raw_data, length);
202 base::RefCountedBytes::TakeVector(&post_data_vector); 202 entry2_->SetBrowserInitiatedPostData(post_data);
203 entry2_->SetBrowserInitiatedPostData(post_data.get()); 203 EXPECT_EQ(post_data, entry2_->GetBrowserInitiatedPostData());
204 EXPECT_EQ(post_data->front(),
205 entry2_->GetBrowserInitiatedPostData()->front());
206 } 204 }
207 205
208 // Test timestamps. 206 // Test timestamps.
209 TEST_F(NavigationEntryTest, NavigationEntryTimestamps) { 207 TEST_F(NavigationEntryTest, NavigationEntryTimestamps) {
210 EXPECT_EQ(base::Time(), entry1_->GetTimestamp()); 208 EXPECT_EQ(base::Time(), entry1_->GetTimestamp());
211 const base::Time now = base::Time::Now(); 209 const base::Time now = base::Time::Now();
212 entry1_->SetTimestamp(now); 210 entry1_->SetTimestamp(now);
213 EXPECT_EQ(now, entry1_->GetTimestamp()); 211 EXPECT_EQ(now, entry1_->GetTimestamp());
214 } 212 }
215 213
216 } // namespace content 214 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/navigation_entry_impl.cc ('k') | content/browser/web_contents/render_view_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698