| 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" | 9 #include "content/common/page_transition_types.h" |
| 10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 GURL javascript_url = GURL("javascript:alert('I am a bookmarklet')"); | 137 GURL javascript_url = GURL("javascript:alert('I am a bookmarklet')"); |
| 138 drop_data.url = javascript_url; | 138 drop_data.url = javascript_url; |
| 139 drop_data.html_base_url = http_url; | 139 drop_data.html_base_url = http_url; |
| 140 rvh()->TestOnMsgStartDragging(drop_data); | 140 rvh()->TestOnMsgStartDragging(drop_data); |
| 141 EXPECT_EQ(javascript_url, view_delegate.drag_url()); | 141 EXPECT_EQ(javascript_url, view_delegate.drag_url()); |
| 142 EXPECT_EQ(http_url, view_delegate.html_base_url()); | 142 EXPECT_EQ(http_url, view_delegate.html_base_url()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // The test that follow trigger DCHECKS in debug build. | 145 // The test that follow trigger DCHECKS in debug build. |
| 146 #if defined(NDEBUG) | 146 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) |
| 147 | 147 |
| 148 // Test that when we fail to de-serialize a message, RenderViewHost calls the | 148 // Test that when we fail to de-serialize a message, RenderViewHost calls the |
| 149 // ReceivedBadMessage() handler. | 149 // ReceivedBadMessage() handler. |
| 150 TEST_F(RenderViewHostTest, BadMessageHandlerRenderViewHost) { | 150 TEST_F(RenderViewHostTest, BadMessageHandlerRenderViewHost) { |
| 151 EXPECT_EQ(0, process()->bad_msg_count()); | 151 EXPECT_EQ(0, process()->bad_msg_count()); |
| 152 // craft an incorrect ViewHostMsg_UpdateTargetURL message. The real one has | 152 // craft an incorrect ViewHostMsg_UpdateTargetURL message. The real one has |
| 153 // two payload items but the one we construct has none. | 153 // two payload items but the one we construct has none. |
| 154 IPC::Message message(0, ViewHostMsg_UpdateTargetURL::ID, | 154 IPC::Message message(0, ViewHostMsg_UpdateTargetURL::ID, |
| 155 IPC::Message::PRIORITY_NORMAL); | 155 IPC::Message::PRIORITY_NORMAL); |
| 156 rvh()->TestOnMessageReceived(message); | 156 rvh()->TestOnMessageReceived(message); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 175 // ViewHostMsg_HandleInputEvent_ACK is defined taking 0 params but | 175 // ViewHostMsg_HandleInputEvent_ACK is defined taking 0 params but |
| 176 // the code actually expects it to have at least one int para, this this | 176 // 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 | 177 // bogus message will not fail at de-serialization but should fail in |
| 178 // OnMsgInputEventAck() processing. | 178 // OnMsgInputEventAck() processing. |
| 179 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, | 179 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, |
| 180 IPC::Message::PRIORITY_NORMAL); | 180 IPC::Message::PRIORITY_NORMAL); |
| 181 rvh()->TestOnMessageReceived(message); | 181 rvh()->TestOnMessageReceived(message); |
| 182 EXPECT_EQ(1, process()->bad_msg_count()); | 182 EXPECT_EQ(1, process()->bad_msg_count()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 #endif // NDEBUG | 185 #endif |
| OLD | NEW |