OLD | NEW |
1 // Copyright (c) 2011 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" | |
10 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
| 10 #include "content/public/common/page_transition_types.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
12 #include "webkit/glue/webdropdata.h" | 12 #include "webkit/glue/webdropdata.h" |
13 | 13 |
14 class RenderViewHostTest : public RenderViewHostTestHarness { | 14 class RenderViewHostTest : public RenderViewHostTestHarness { |
15 }; | 15 }; |
16 | 16 |
17 // All about URLs reported by the renderer should get rewritten to about:blank. | 17 // All about URLs reported by the renderer should get rewritten to about:blank. |
18 // See RenderViewHost::OnMsgNavigate for a discussion. | 18 // See RenderViewHost::OnMsgNavigate for a discussion. |
19 TEST_F(RenderViewHostTest, FilterAbout) { | 19 TEST_F(RenderViewHostTest, FilterAbout) { |
20 rvh()->SendNavigate(1, GURL("about:cache")); | 20 rvh()->SendNavigate(1, GURL("about:cache")); |
(...skipping 20 matching lines...) Expand all Loading... |
41 // . go to a new page, preferably one that takes a while to resolve, such | 41 // . go to a new page, preferably one that takes a while to resolve, such |
42 // as one on a site that doesn't exist. | 42 // as one on a site that doesn't exist. |
43 // . After this step is_waiting_for_unload_ack_ has been set to true on | 43 // . After this step is_waiting_for_unload_ack_ has been set to true on |
44 // the first RVH. | 44 // the first RVH. |
45 // . click stop before the page has been commited. | 45 // . click stop before the page has been commited. |
46 // . click reload. | 46 // . click reload. |
47 // . is_waiting_for_unload_ack_ is still true, and the if the hang monitor | 47 // . is_waiting_for_unload_ack_ is still true, and the if the hang monitor |
48 // fires the tab gets closed. | 48 // fires the tab gets closed. |
49 | 49 |
50 NavigateAndCommit(url1); | 50 NavigateAndCommit(url1); |
51 controller().LoadURL(url2, GURL(), PageTransition::LINK, std::string()); | 51 controller().LoadURL( |
| 52 url2, GURL(), content::PAGE_TRANSITION_LINK, std::string()); |
52 // Simulate the ClosePage call which is normally sent by the net::URLRequest. | 53 // Simulate the ClosePage call which is normally sent by the net::URLRequest. |
53 rvh()->ClosePage(); | 54 rvh()->ClosePage(); |
54 // Needed so that navigations are not suspended on the RVH. | 55 // Needed so that navigations are not suspended on the RVH. |
55 rvh()->SendShouldCloseACK(true); | 56 rvh()->SendShouldCloseACK(true); |
56 contents()->Stop(); | 57 contents()->Stop(); |
57 controller().Reload(false); | 58 controller().Reload(false); |
58 EXPECT_FALSE(rvh()->is_waiting_for_unload_ack_for_testing()); | 59 EXPECT_FALSE(rvh()->is_waiting_for_unload_ack_for_testing()); |
59 } | 60 } |
60 | 61 |
61 class MockDraggingRenderViewHostDelegateView | 62 class MockDraggingRenderViewHostDelegateView |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // the code actually expects it to have at least one int para, this this | 177 // the code actually expects it to have at least one int para, this this |
177 // bogus message will not fail at de-serialization but should fail in | 178 // bogus message will not fail at de-serialization but should fail in |
178 // OnMsgInputEventAck() processing. | 179 // OnMsgInputEventAck() processing. |
179 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, | 180 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, |
180 IPC::Message::PRIORITY_NORMAL); | 181 IPC::Message::PRIORITY_NORMAL); |
181 rvh()->TestOnMessageReceived(message); | 182 rvh()->TestOnMessageReceived(message); |
182 EXPECT_EQ(1, process()->bad_msg_count()); | 183 EXPECT_EQ(1, process()->bad_msg_count()); |
183 } | 184 } |
184 | 185 |
185 #endif | 186 #endif |
OLD | NEW |