OLD | NEW |
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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 TEST_F(NavigationControllerTest, LoadURLWithExtraParams_HttpPost) { | 460 TEST_F(NavigationControllerTest, LoadURLWithExtraParams_HttpPost) { |
461 NavigationControllerImpl& controller = controller_impl(); | 461 NavigationControllerImpl& controller = controller_impl(); |
462 | 462 |
463 NavigationController::LoadURLParams load_params(GURL("https://posturl")); | 463 NavigationController::LoadURLParams load_params(GURL("https://posturl")); |
464 load_params.transition_type = PAGE_TRANSITION_TYPED; | 464 load_params.transition_type = PAGE_TRANSITION_TYPED; |
465 load_params.load_type = | 465 load_params.load_type = |
466 NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST; | 466 NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST; |
467 load_params.override_user_agent = NavigationController::UA_OVERRIDE_TRUE; | 467 load_params.override_user_agent = NavigationController::UA_OVERRIDE_TRUE; |
468 | 468 |
469 | 469 |
470 const unsigned char* raw_data = | 470 const char* raw_data = "d\n\0a2"; |
471 reinterpret_cast<const unsigned char*>("d\n\0a2"); | |
472 const int length = 5; | 471 const int length = 5; |
473 std::vector<unsigned char> post_data_vector(raw_data, raw_data+length); | 472 scoped_refptr<webkit_glue::ResourceRequestBody> data = |
474 scoped_refptr<base::RefCountedBytes> data = | 473 new webkit_glue::ResourceRequestBody(); |
475 base::RefCountedBytes::TakeVector(&post_data_vector); | 474 data->AppendBytes(raw_data, length); |
476 load_params.browser_initiated_post_data = data.get(); | 475 load_params.browser_initiated_post_data = data; |
477 | 476 |
478 controller.LoadURLWithParams(load_params); | 477 controller.LoadURLWithParams(load_params); |
479 NavigationEntryImpl* entry = | 478 NavigationEntryImpl* entry = |
480 NavigationEntryImpl::FromNavigationEntry( | 479 NavigationEntryImpl::FromNavigationEntry( |
481 controller.GetPendingEntry()); | 480 controller.GetPendingEntry()); |
482 | 481 |
483 CheckNavigationEntryMatchLoadParams(load_params, entry); | 482 CheckNavigationEntryMatchLoadParams(load_params, entry); |
484 } | 483 } |
485 | 484 |
486 // Tests what happens when the same page is loaded again. Should not create a | 485 // Tests what happens when the same page is loaded again. Should not create a |
(...skipping 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3181 PAGE_TRANSITION_LINK); | 3180 PAGE_TRANSITION_LINK); |
3182 session_helper_.AssertNavigationEquals(nav, | 3181 session_helper_.AssertNavigationEquals(nav, |
3183 windows_[0]->tabs[0]->navigations[0]); | 3182 windows_[0]->tabs[0]->navigations[0]); |
3184 nav.set_url(url2); | 3183 nav.set_url(url2); |
3185 session_helper_.AssertNavigationEquals(nav, | 3184 session_helper_.AssertNavigationEquals(nav, |
3186 windows_[0]->tabs[0]->navigations[1]); | 3185 windows_[0]->tabs[0]->navigations[1]); |
3187 } | 3186 } |
3188 */ | 3187 */ |
3189 | 3188 |
3190 } // namespace content | 3189 } // namespace content |
OLD | NEW |