OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/test/test_render_view_host.h" | 5 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
6 #include "chrome/browser/tab_contents/navigation_entry.h" | 6 #include "chrome/browser/tab_contents/navigation_entry.h" |
7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
8 | 8 |
9 class RenderViewHostTest : public RenderViewHostTestHarness { | 9 class RenderViewHostTest : public RenderViewHostTestHarness { |
10 }; | 10 }; |
11 | 11 |
12 // All about URLs reported by the renderer should get rewritten to about:blank. | 12 // All about URLs reported by the renderer should get rewritten to about:blank. |
13 // See RenderViewHost::OnMsgNavigate for a discussion. | 13 // See RenderViewHost::OnMsgNavigate for a discussion. |
14 TEST_F(RenderViewHostTest, FilterAbout) { | 14 TEST_F(RenderViewHostTest, FilterAbout) { |
15 rvh()->SendNavigate(1, GURL("about:cache")); | 15 rvh()->SendNavigate(1, GURL("about:cache")); |
16 ASSERT_TRUE(controller().GetActiveEntry()); | 16 ASSERT_TRUE(controller().GetActiveEntry()); |
17 EXPECT_EQ(GURL("about:blank"), controller().GetActiveEntry()->url()); | 17 EXPECT_EQ(GURL("about:blank"), controller().GetActiveEntry()->url()); |
18 } | 18 } |
19 | 19 |
| 20 // Create a full screen popup RenderWidgetHost and View. |
| 21 TEST_F(RenderViewHostTest, CreateFullscreenWidget) { |
| 22 int routing_id = process()->GetNextRoutingID(); |
| 23 rvh()->CreateNewFullscreenWidget(routing_id, WebKit::WebPopupTypeNone); |
| 24 } |
| 25 |
20 // The test that follow trigger DCHECKS in debug build. | 26 // The test that follow trigger DCHECKS in debug build. |
21 #if defined(NDEBUG) | 27 #if defined(NDEBUG) |
22 | 28 |
23 // Test that when we fail to de-serialize a message, RenderViewHost calls the | 29 // Test that when we fail to de-serialize a message, RenderViewHost calls the |
24 // ReceivedBadMessage() handler. | 30 // ReceivedBadMessage() handler. |
25 TEST_F(RenderViewHostTest, BadMessageHandlerRenderViewHost) { | 31 TEST_F(RenderViewHostTest, BadMessageHandlerRenderViewHost) { |
26 EXPECT_EQ(0, process()->bad_msg_count()); | 32 EXPECT_EQ(0, process()->bad_msg_count()); |
27 // craft an incorrect ViewHostMsg_UpdateTargetURL message. The real one has | 33 // craft an incorrect ViewHostMsg_UpdateTargetURL message. The real one has |
28 // two payload items but the one we construct has none. | 34 // two payload items but the one we construct has none. |
29 IPC::Message message(0, ViewHostMsg_UpdateTargetURL::ID, | 35 IPC::Message message(0, ViewHostMsg_UpdateTargetURL::ID, |
(...skipping 21 matching lines...) Expand all Loading... |
51 // the code actually expects it to have at least one int para, this this | 57 // the code actually expects it to have at least one int para, this this |
52 // bogus message will not fail at de-serialization but should fail in | 58 // bogus message will not fail at de-serialization but should fail in |
53 // OnMsgInputEventAck() processing. | 59 // OnMsgInputEventAck() processing. |
54 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, | 60 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, |
55 IPC::Message::PRIORITY_NORMAL); | 61 IPC::Message::PRIORITY_NORMAL); |
56 rvh()->TestOnMessageReceived(message); | 62 rvh()->TestOnMessageReceived(message); |
57 EXPECT_EQ(1, process()->bad_msg_count()); | 63 EXPECT_EQ(1, process()->bad_msg_count()); |
58 } | 64 } |
59 | 65 |
60 #endif // NDEBUG | 66 #endif // NDEBUG |
OLD | NEW |