| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } | 506 } |
| 507 | 507 |
| 508 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { | 508 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { |
| 509 // An http url will trigger a resource load so cannot be used here. | 509 // An http url will trigger a resource load so cannot be used here. |
| 510 CommonNavigationParams common_params; | 510 CommonNavigationParams common_params; |
| 511 StartNavigationParams start_params; | 511 StartNavigationParams start_params; |
| 512 RequestNavigationParams request_params; | 512 RequestNavigationParams request_params; |
| 513 common_params.url = GURL("data:text/html,<div>Page</div>"); | 513 common_params.url = GURL("data:text/html,<div>Page</div>"); |
| 514 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 514 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 515 common_params.transition = ui::PAGE_TRANSITION_TYPED; | 515 common_params.transition = ui::PAGE_TRANSITION_TYPED; |
| 516 common_params.method = "POST"; |
| 516 request_params.page_id = -1; | 517 request_params.page_id = -1; |
| 517 | 518 |
| 518 // Set up post data. | 519 // Set up post data. |
| 519 const unsigned char* raw_data = reinterpret_cast<const unsigned char*>( | 520 const unsigned char* raw_data = reinterpret_cast<const unsigned char*>( |
| 520 "post \0\ndata"); | 521 "post \0\ndata"); |
| 521 const unsigned int length = 11; | 522 const unsigned int length = 11; |
| 522 const std::vector<unsigned char> post_data(raw_data, raw_data + length); | 523 const std::vector<unsigned char> post_data(raw_data, raw_data + length); |
| 523 start_params.is_post = true; | |
| 524 start_params.browser_initiated_post_data = post_data; | 524 start_params.browser_initiated_post_data = post_data; |
| 525 | 525 |
| 526 frame()->Navigate(common_params, start_params, request_params); | 526 frame()->Navigate(common_params, start_params, request_params); |
| 527 ProcessPendingMessages(); | 527 ProcessPendingMessages(); |
| 528 | 528 |
| 529 const IPC::Message* frame_navigate_msg = | 529 const IPC::Message* frame_navigate_msg = |
| 530 render_thread_->sink().GetUniqueMessageMatching( | 530 render_thread_->sink().GetUniqueMessageMatching( |
| 531 FrameHostMsg_DidCommitProvisionalLoad::ID); | 531 FrameHostMsg_DidCommitProvisionalLoad::ID); |
| 532 EXPECT_TRUE(frame_navigate_msg); | 532 EXPECT_TRUE(frame_navigate_msg); |
| 533 | 533 |
| (...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 } | 2451 } |
| 2452 | 2452 |
| 2453 // Sanity check for the Navigation Timing API |navigationStart| override. We | 2453 // Sanity check for the Navigation Timing API |navigationStart| override. We |
| 2454 // are asserting only most basic constraints, as TimeTicks (passed as the | 2454 // are asserting only most basic constraints, as TimeTicks (passed as the |
| 2455 // override) are not comparable with the wall time (returned by the Blink API). | 2455 // override) are not comparable with the wall time (returned by the Blink API). |
| 2456 TEST_F(RenderViewImplTest, NavigationStartOverride) { | 2456 TEST_F(RenderViewImplTest, NavigationStartOverride) { |
| 2457 // Verify that a navigation that claims to have started in the future - 42 | 2457 // Verify that a navigation that claims to have started in the future - 42 |
| 2458 // days from now is *not* reported as one that starts in the future; as we | 2458 // days from now is *not* reported as one that starts in the future; as we |
| 2459 // sanitize the override allowing a maximum of ::Now(). | 2459 // sanitize the override allowing a maximum of ::Now(). |
| 2460 CommonNavigationParams late_common_params; | 2460 CommonNavigationParams late_common_params; |
| 2461 StartNavigationParams late_start_params; | |
| 2462 late_common_params.url = GURL("data:text/html,<div>Another page</div>"); | 2461 late_common_params.url = GURL("data:text/html,<div>Another page</div>"); |
| 2463 late_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2462 late_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 2464 late_common_params.transition = ui::PAGE_TRANSITION_TYPED; | 2463 late_common_params.transition = ui::PAGE_TRANSITION_TYPED; |
| 2465 late_common_params.navigation_start = | 2464 late_common_params.navigation_start = |
| 2466 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); | 2465 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); |
| 2467 late_start_params.is_post = true; | 2466 late_common_params.method = "POST"; |
| 2468 | 2467 |
| 2469 frame()->Navigate(late_common_params, late_start_params, | 2468 frame()->Navigate(late_common_params, StartNavigationParams(), |
| 2470 RequestNavigationParams()); | 2469 RequestNavigationParams()); |
| 2471 ProcessPendingMessages(); | 2470 ProcessPendingMessages(); |
| 2472 base::Time after_navigation = | 2471 base::Time after_navigation = |
| 2473 base::Time::Now() + base::TimeDelta::FromDays(1); | 2472 base::Time::Now() + base::TimeDelta::FromDays(1); |
| 2474 | 2473 |
| 2475 base::Time late_nav_reported_start = | 2474 base::Time late_nav_reported_start = |
| 2476 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | 2475 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); |
| 2477 EXPECT_LE(late_nav_reported_start, after_navigation); | 2476 EXPECT_LE(late_nav_reported_start, after_navigation); |
| 2478 } | 2477 } |
| 2479 | 2478 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2754 FROM_HERE, | 2753 FROM_HERE, |
| 2755 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2754 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2756 ExecuteJavaScriptForTests("debugger;"); | 2755 ExecuteJavaScriptForTests("debugger;"); |
| 2757 | 2756 |
| 2758 // CloseWhilePaused should resume execution and continue here. | 2757 // CloseWhilePaused should resume execution and continue here. |
| 2759 EXPECT_FALSE(IsPaused()); | 2758 EXPECT_FALSE(IsPaused()); |
| 2760 Detach(); | 2759 Detach(); |
| 2761 } | 2760 } |
| 2762 | 2761 |
| 2763 } // namespace content | 2762 } // namespace content |
| OLD | NEW |