OLD | NEW |
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 "content/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 EXPECT_FALSE(observer.plugin_crashed()); | 662 EXPECT_FALSE(observer.plugin_crashed()); |
663 } | 663 } |
664 #endif | 664 #endif |
665 | 665 |
666 // We cannot filter out synchronous IPC messages, because the renderer would | 666 // We cannot filter out synchronous IPC messages, because the renderer would |
667 // be left waiting for a reply. We pick RunBeforeUnloadConfirm as an example | 667 // be left waiting for a reply. We pick RunBeforeUnloadConfirm as an example |
668 // that can run easily within a unit test, and that needs to receive a reply | 668 // that can run easily within a unit test, and that needs to receive a reply |
669 // without showing an actual dialog. | 669 // without showing an actual dialog. |
670 MockRenderProcessHost* ntp_process_host = ntp_rfh->GetProcess(); | 670 MockRenderProcessHost* ntp_process_host = ntp_rfh->GetProcess(); |
671 ntp_process_host->sink().ClearMessages(); | 671 ntp_process_host->sink().ClearMessages(); |
672 const base::string16 msg = base::ASCIIToUTF16("Message"); | |
673 bool result = false; | 672 bool result = false; |
674 base::string16 unused; | 673 base::string16 unused; |
675 FrameHostMsg_RunBeforeUnloadConfirm before_unload_msg( | 674 FrameHostMsg_RunBeforeUnloadConfirm before_unload_msg( |
676 ntp_rfh->GetRoutingID(), kChromeURL, msg, false, &result, &unused); | 675 ntp_rfh->GetRoutingID(), kChromeURL, false, &result, &unused); |
677 EXPECT_TRUE(ntp_rfh->OnMessageReceived(before_unload_msg)); | 676 EXPECT_TRUE(ntp_rfh->OnMessageReceived(before_unload_msg)); |
678 EXPECT_TRUE(ntp_process_host->sink().GetUniqueMessageMatching(IPC_REPLY_ID)); | 677 EXPECT_TRUE(ntp_process_host->sink().GetUniqueMessageMatching(IPC_REPLY_ID)); |
679 | 678 |
680 // Also test RunJavaScriptMessage. | 679 // Also test RunJavaScriptMessage. |
681 ntp_process_host->sink().ClearMessages(); | 680 ntp_process_host->sink().ClearMessages(); |
| 681 const base::string16 msg = base::ASCIIToUTF16("Message"); |
682 FrameHostMsg_RunJavaScriptMessage js_msg( | 682 FrameHostMsg_RunJavaScriptMessage js_msg( |
683 ntp_rfh->GetRoutingID(), msg, msg, kChromeURL, | 683 ntp_rfh->GetRoutingID(), msg, msg, kChromeURL, |
684 JAVASCRIPT_MESSAGE_TYPE_CONFIRM, &result, &unused); | 684 JAVASCRIPT_MESSAGE_TYPE_CONFIRM, &result, &unused); |
685 js_msg.EnableMessagePumping(); | 685 js_msg.EnableMessagePumping(); |
686 EXPECT_TRUE(ntp_rfh->OnMessageReceived(js_msg)); | 686 EXPECT_TRUE(ntp_rfh->OnMessageReceived(js_msg)); |
687 EXPECT_TRUE(ntp_process_host->sink().GetUniqueMessageMatching(IPC_REPLY_ID)); | 687 EXPECT_TRUE(ntp_process_host->sink().GetUniqueMessageMatching(IPC_REPLY_ID)); |
688 } | 688 } |
689 | 689 |
690 // Test that the ViewHostMsg_UpdateFaviconURL IPC message is ignored if the | 690 // Test that the ViewHostMsg_UpdateFaviconURL IPC message is ignored if the |
691 // renderer is in the STATE_PENDING_SWAP_OUT_STATE. The favicon code assumes | 691 // renderer is in the STATE_PENDING_SWAP_OUT_STATE. The favicon code assumes |
(...skipping 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3303 commit_params.should_enforce_strict_mixed_content_checking = false; | 3303 commit_params.should_enforce_strict_mixed_content_checking = false; |
3304 child_host->SendNavigateWithParams(&commit_params); | 3304 child_host->SendNavigateWithParams(&commit_params); |
3305 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( | 3305 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( |
3306 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); | 3306 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); |
3307 EXPECT_FALSE(root->child_at(0) | 3307 EXPECT_FALSE(root->child_at(0) |
3308 ->current_replication_state() | 3308 ->current_replication_state() |
3309 .should_enforce_strict_mixed_content_checking); | 3309 .should_enforce_strict_mixed_content_checking); |
3310 } | 3310 } |
3311 | 3311 |
3312 } // namespace content | 3312 } // namespace content |
OLD | NEW |