OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer_host/test_render_view_host.h" | 5 #include "content/browser/renderer_host/test_render_view_host.h" |
6 #include "content/browser/tab_contents/navigation_controller.h" | 6 #include "content/browser/tab_contents/navigation_controller.h" |
7 #include "content/browser/tab_contents/navigation_entry.h" | 7 #include "content/browser/tab_contents/navigation_entry.h" |
8 #include "content/browser/tab_contents/test_tab_contents.h" | 8 #include "content/browser/tab_contents/test_tab_contents.h" |
9 #include "content/common/page_transition_types.h" | 9 #include "content/common/page_transition_types.h" |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
11 | 11 |
(...skipping 29 matching lines...) Expand all Loading... |
41 // . After this step is_waiting_for_unload_ack_ has been set to true on | 41 // . After this step is_waiting_for_unload_ack_ has been set to true on |
42 // the first RVH. | 42 // the first RVH. |
43 // . click stop before the page has been commited. | 43 // . click stop before the page has been commited. |
44 // . click reload. | 44 // . click reload. |
45 // . is_waiting_for_unload_ack_ is still true, and the if the hang monitor | 45 // . is_waiting_for_unload_ack_ is still true, and the if the hang monitor |
46 // fires the tab gets closed. | 46 // fires the tab gets closed. |
47 | 47 |
48 NavigateAndCommit(url1); | 48 NavigateAndCommit(url1); |
49 controller().LoadURL(url2, GURL(), PageTransition::LINK); | 49 controller().LoadURL(url2, GURL(), PageTransition::LINK); |
50 // Simulate the ClosePage call which is normally sent by the net::URLRequest. | 50 // Simulate the ClosePage call which is normally sent by the net::URLRequest. |
51 rvh()->ClosePage(true, 0, 0); | 51 rvh()->ClosePage(); |
52 // Needed so that navigations are not suspended on the RVH. Normally handled | 52 // Needed so that navigations are not suspended on the RVH. |
53 // by way of ViewHostMsg_ShouldClose_ACK. | 53 rvh()->SendShouldCloseACK(true); |
54 contents()->render_manager()->ShouldClosePage(true, true); | |
55 contents()->Stop(); | 54 contents()->Stop(); |
56 controller().Reload(false); | 55 controller().Reload(false); |
57 EXPECT_FALSE(rvh()->is_waiting_for_unload_ack()); | 56 EXPECT_FALSE(rvh()->is_waiting_for_unload_ack()); |
58 } | 57 } |
59 | 58 |
60 // The test that follow trigger DCHECKS in debug build. | 59 // The test that follow trigger DCHECKS in debug build. |
61 #if defined(NDEBUG) | 60 #if defined(NDEBUG) |
62 | 61 |
63 // Test that when we fail to de-serialize a message, RenderViewHost calls the | 62 // Test that when we fail to de-serialize a message, RenderViewHost calls the |
64 // ReceivedBadMessage() handler. | 63 // ReceivedBadMessage() handler. |
(...skipping 26 matching lines...) Expand all Loading... |
91 // 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 |
92 // 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 |
93 // OnMsgInputEventAck() processing. | 92 // OnMsgInputEventAck() processing. |
94 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, | 93 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, |
95 IPC::Message::PRIORITY_NORMAL); | 94 IPC::Message::PRIORITY_NORMAL); |
96 rvh()->TestOnMessageReceived(message); | 95 rvh()->TestOnMessageReceived(message); |
97 EXPECT_EQ(1, process()->bad_msg_count()); | 96 EXPECT_EQ(1, process()->bad_msg_count()); |
98 } | 97 } |
99 | 98 |
100 #endif // NDEBUG | 99 #endif // NDEBUG |
OLD | NEW |