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_controller.h" | 6 #include "chrome/browser/tab_contents/navigation_controller.h" |
7 #include "chrome/browser/tab_contents/navigation_entry.h" | 7 #include "chrome/browser/tab_contents/navigation_entry.h" |
8 #include "chrome/browser/tab_contents/test_tab_contents.h" | 8 #include "chrome/browser/tab_contents/test_tab_contents.h" |
9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
10 | 10 |
11 class RenderViewHostTest : public RenderViewHostTestHarness { | 11 class RenderViewHostTest : public RenderViewHostTestHarness { |
12 }; | 12 }; |
13 | 13 |
14 // All about URLs reported by the renderer should get rewritten to about:blank. | 14 // All about URLs reported by the renderer should get rewritten to about:blank. |
15 // See RenderViewHost::OnMsgNavigate for a discussion. | 15 // See RenderViewHost::OnMsgNavigate for a discussion. |
16 TEST_F(RenderViewHostTest, FilterAbout) { | 16 TEST_F(RenderViewHostTest, FilterAbout) { |
17 rvh()->SendNavigate(1, GURL("about:cache")); | 17 rvh()->SendNavigate(1, GURL("about:cache")); |
18 ASSERT_TRUE(controller().GetActiveEntry()); | 18 ASSERT_TRUE(controller().GetActiveEntry()); |
19 EXPECT_EQ(GURL("about:blank"), controller().GetActiveEntry()->url()); | 19 EXPECT_EQ(GURL("about:blank"), controller().GetActiveEntry()->url()); |
20 } | 20 } |
21 | 21 |
22 // Create a full screen popup RenderWidgetHost and View. | 22 // Create a full screen popup RenderWidgetHost and View. |
23 TEST_F(RenderViewHostTest, CreateFullscreenWidget) { | 23 TEST_F(RenderViewHostTest, CreateFullscreenWidget) { |
24 int routing_id = process()->GetNextRoutingID(); | 24 int routing_id = process()->GetNextRoutingID(); |
25 rvh()->CreateNewFullscreenWidget(routing_id, WebKit::WebPopupTypeNone); | 25 rvh()->CreateNewFullscreenWidget(routing_id); |
26 } | 26 } |
27 | 27 |
28 // Makes sure that RenderViewHost::is_waiting_for_unload_ack_ is false when | 28 // Makes sure that RenderViewHost::is_waiting_for_unload_ack_ is false when |
29 // reloading a page. If is_waiting_for_unload_ack_ is not false when reloading | 29 // reloading a page. If is_waiting_for_unload_ack_ is not false when reloading |
30 // the tab may get closed out even though the user pressed the reload button. | 30 // the tab may get closed out even though the user pressed the reload button. |
31 TEST_F(RenderViewHostTest, ResetUnloadOnReload) { | 31 TEST_F(RenderViewHostTest, ResetUnloadOnReload) { |
32 const GURL url1("http://foo1"); | 32 const GURL url1("http://foo1"); |
33 const GURL url2("http://foo2"); | 33 const GURL url2("http://foo2"); |
34 | 34 |
35 // This test is for a subtle timing bug. Here's the sequence that triggered | 35 // This test is for a subtle timing bug. Here's the sequence that triggered |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // the code actually expects it to have at least one int para, this this | 90 // the code actually expects it to have at least one int para, this this |
91 // bogus message will not fail at de-serialization but should fail in | 91 // bogus message will not fail at de-serialization but should fail in |
92 // OnMsgInputEventAck() processing. | 92 // OnMsgInputEventAck() processing. |
93 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, | 93 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, |
94 IPC::Message::PRIORITY_NORMAL); | 94 IPC::Message::PRIORITY_NORMAL); |
95 rvh()->TestOnMessageReceived(message); | 95 rvh()->TestOnMessageReceived(message); |
96 EXPECT_EQ(1, process()->bad_msg_count()); | 96 EXPECT_EQ(1, process()->bad_msg_count()); |
97 } | 97 } |
98 | 98 |
99 #endif // NDEBUG | 99 #endif // NDEBUG |
OLD | NEW |