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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/frame_host/cross_site_transferring_request.h" | 10 #include "content/browser/frame_host/cross_site_transferring_request.h" |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 EXPECT_TRUE(ntp_rfh->is_swapped_out()); | 543 EXPECT_TRUE(ntp_rfh->is_swapped_out()); |
544 { | 544 { |
545 PluginFaviconMessageObserver observer(contents()); | 545 PluginFaviconMessageObserver observer(contents()); |
546 EXPECT_TRUE( | 546 EXPECT_TRUE( |
547 ntp_rfh->GetRenderViewHost()->OnMessageReceived( | 547 ntp_rfh->GetRenderViewHost()->OnMessageReceived( |
548 ViewHostMsg_UpdateFaviconURL( | 548 ViewHostMsg_UpdateFaviconURL( |
549 dest_rfh->GetRenderViewHost()->GetRoutingID(), icons))); | 549 dest_rfh->GetRenderViewHost()->GetRoutingID(), icons))); |
550 EXPECT_FALSE(observer.favicon_received()); | 550 EXPECT_FALSE(observer.favicon_received()); |
551 } | 551 } |
552 | 552 |
| 553 #if defined(ENABLE_PLUGINS) |
553 // The same logic should apply to RenderFrameHosts as well and routing through | 554 // The same logic should apply to RenderFrameHosts as well and routing through |
554 // swapped out RFH shouldn't be allowed. Use a PluginCrashObserver to check | 555 // swapped out RFH shouldn't be allowed. Use a PluginCrashObserver to check |
555 // if the IPC message is allowed through or not. | 556 // if the IPC message is allowed through or not. |
556 { | 557 { |
557 PluginFaviconMessageObserver observer(contents()); | 558 PluginFaviconMessageObserver observer(contents()); |
558 EXPECT_TRUE(ntp_rfh->OnMessageReceived( | 559 EXPECT_TRUE(ntp_rfh->OnMessageReceived( |
559 FrameHostMsg_PluginCrashed( | 560 FrameHostMsg_PluginCrashed( |
560 ntp_rfh->GetRoutingID(), base::FilePath(), 0))); | 561 ntp_rfh->GetRoutingID(), base::FilePath(), 0))); |
561 EXPECT_FALSE(observer.plugin_crashed()); | 562 EXPECT_FALSE(observer.plugin_crashed()); |
562 } | 563 } |
| 564 #endif |
563 | 565 |
564 // We cannot filter out synchronous IPC messages, because the renderer would | 566 // We cannot filter out synchronous IPC messages, because the renderer would |
565 // be left waiting for a reply. We pick RunBeforeUnloadConfirm as an example | 567 // be left waiting for a reply. We pick RunBeforeUnloadConfirm as an example |
566 // that can run easily within a unit test, and that needs to receive a reply | 568 // that can run easily within a unit test, and that needs to receive a reply |
567 // without showing an actual dialog. | 569 // without showing an actual dialog. |
568 MockRenderProcessHost* ntp_process_host = | 570 MockRenderProcessHost* ntp_process_host = |
569 static_cast<MockRenderProcessHost*>(ntp_rfh->GetProcess()); | 571 static_cast<MockRenderProcessHost*>(ntp_rfh->GetProcess()); |
570 ntp_process_host->sink().ClearMessages(); | 572 ntp_process_host->sink().ClearMessages(); |
571 const base::string16 msg = base::ASCIIToUTF16("Message"); | 573 const base::string16 msg = base::ASCIIToUTF16("Message"); |
572 bool result = false; | 574 bool result = false; |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 pending_rfh->GetSiteInstance()->increment_active_frame_count(); | 1798 pending_rfh->GetSiteInstance()->increment_active_frame_count(); |
1797 | 1799 |
1798 contents()->GetMainFrame()->OnMessageReceived( | 1800 contents()->GetMainFrame()->OnMessageReceived( |
1799 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); | 1801 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); |
1800 EXPECT_FALSE(contents()->cross_navigation_pending()); | 1802 EXPECT_FALSE(contents()->cross_navigation_pending()); |
1801 EXPECT_FALSE(rfh_deleted_observer.deleted()); | 1803 EXPECT_FALSE(rfh_deleted_observer.deleted()); |
1802 } | 1804 } |
1803 } | 1805 } |
1804 | 1806 |
1805 } // namespace content | 1807 } // namespace content |
OLD | NEW |