| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 } | 532 } |
| 533 | 533 |
| 534 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { | 534 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { |
| 535 // An http url will trigger a resource load so cannot be used here. | 535 // An http url will trigger a resource load so cannot be used here. |
| 536 CommonNavigationParams common_params; | 536 CommonNavigationParams common_params; |
| 537 StartNavigationParams start_params; | 537 StartNavigationParams start_params; |
| 538 RequestNavigationParams request_params; | 538 RequestNavigationParams request_params; |
| 539 common_params.url = GURL("data:text/html,<div>Page</div>"); | 539 common_params.url = GURL("data:text/html,<div>Page</div>"); |
| 540 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 540 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 541 common_params.transition = ui::PAGE_TRANSITION_TYPED; | 541 common_params.transition = ui::PAGE_TRANSITION_TYPED; |
| 542 common_params.method = "POST"; |
| 542 request_params.page_id = -1; | 543 request_params.page_id = -1; |
| 543 | 544 |
| 544 // Set up post data. | 545 // Set up post data. |
| 545 const unsigned char* raw_data = reinterpret_cast<const unsigned char*>( | 546 const unsigned char* raw_data = reinterpret_cast<const unsigned char*>( |
| 546 "post \0\ndata"); | 547 "post \0\ndata"); |
| 547 const unsigned int length = 11; | 548 const unsigned int length = 11; |
| 548 const std::vector<unsigned char> post_data(raw_data, raw_data + length); | 549 const std::vector<unsigned char> post_data(raw_data, raw_data + length); |
| 549 start_params.is_post = true; | |
| 550 start_params.browser_initiated_post_data = post_data; | 550 start_params.browser_initiated_post_data = post_data; |
| 551 | 551 |
| 552 frame()->Navigate(common_params, start_params, request_params); | 552 frame()->Navigate(common_params, start_params, request_params); |
| 553 ProcessPendingMessages(); | 553 ProcessPendingMessages(); |
| 554 | 554 |
| 555 const IPC::Message* frame_navigate_msg = | 555 const IPC::Message* frame_navigate_msg = |
| 556 render_thread_->sink().GetUniqueMessageMatching( | 556 render_thread_->sink().GetUniqueMessageMatching( |
| 557 FrameHostMsg_DidCommitProvisionalLoad::ID); | 557 FrameHostMsg_DidCommitProvisionalLoad::ID); |
| 558 EXPECT_TRUE(frame_navigate_msg); | 558 EXPECT_TRUE(frame_navigate_msg); |
| 559 | 559 |
| (...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2490 } | 2490 } |
| 2491 | 2491 |
| 2492 // Sanity check for the Navigation Timing API |navigationStart| override. We | 2492 // Sanity check for the Navigation Timing API |navigationStart| override. We |
| 2493 // are asserting only most basic constraints, as TimeTicks (passed as the | 2493 // are asserting only most basic constraints, as TimeTicks (passed as the |
| 2494 // override) are not comparable with the wall time (returned by the Blink API). | 2494 // override) are not comparable with the wall time (returned by the Blink API). |
| 2495 TEST_F(RenderViewImplTest, NavigationStartOverride) { | 2495 TEST_F(RenderViewImplTest, NavigationStartOverride) { |
| 2496 // Verify that a navigation that claims to have started in the future - 42 | 2496 // Verify that a navigation that claims to have started in the future - 42 |
| 2497 // days from now is *not* reported as one that starts in the future; as we | 2497 // days from now is *not* reported as one that starts in the future; as we |
| 2498 // sanitize the override allowing a maximum of ::Now(). | 2498 // sanitize the override allowing a maximum of ::Now(). |
| 2499 CommonNavigationParams late_common_params; | 2499 CommonNavigationParams late_common_params; |
| 2500 StartNavigationParams late_start_params; | |
| 2501 late_common_params.url = GURL("data:text/html,<div>Another page</div>"); | 2500 late_common_params.url = GURL("data:text/html,<div>Another page</div>"); |
| 2502 late_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2501 late_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 2503 late_common_params.transition = ui::PAGE_TRANSITION_TYPED; | 2502 late_common_params.transition = ui::PAGE_TRANSITION_TYPED; |
| 2504 late_common_params.navigation_start = | 2503 late_common_params.navigation_start = |
| 2505 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); | 2504 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); |
| 2506 late_start_params.is_post = true; | 2505 late_common_params.method = "POST"; |
| 2507 | 2506 |
| 2508 frame()->Navigate(late_common_params, late_start_params, | 2507 frame()->Navigate(late_common_params, StartNavigationParams(), |
| 2509 RequestNavigationParams()); | 2508 RequestNavigationParams()); |
| 2510 ProcessPendingMessages(); | 2509 ProcessPendingMessages(); |
| 2511 base::Time after_navigation = | 2510 base::Time after_navigation = |
| 2512 base::Time::Now() + base::TimeDelta::FromDays(1); | 2511 base::Time::Now() + base::TimeDelta::FromDays(1); |
| 2513 | 2512 |
| 2514 base::Time late_nav_reported_start = | 2513 base::Time late_nav_reported_start = |
| 2515 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | 2514 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); |
| 2516 EXPECT_LE(late_nav_reported_start, after_navigation); | 2515 EXPECT_LE(late_nav_reported_start, after_navigation); |
| 2517 } | 2516 } |
| 2518 | 2517 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2796 FROM_HERE, | 2795 FROM_HERE, |
| 2797 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2796 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2798 ExecuteJavaScriptForTests("debugger;"); | 2797 ExecuteJavaScriptForTests("debugger;"); |
| 2799 | 2798 |
| 2800 // CloseWhilePaused should resume execution and continue here. | 2799 // CloseWhilePaused should resume execution and continue here. |
| 2801 EXPECT_FALSE(IsPaused()); | 2800 EXPECT_FALSE(IsPaused()); |
| 2802 Detach(); | 2801 Detach(); |
| 2803 } | 2802 } |
| 2804 | 2803 |
| 2805 } // namespace content | 2804 } // namespace content |
| OLD | NEW |