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 "chrome/renderer/safe_browsing/render_view_fake_resources_test.h" | 5 #include "chrome/renderer/safe_browsing/render_view_fake_resources_test.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/process.h" | 10 #include "base/process.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 message.routing_id(), request_id, response_head))); | 159 message.routing_id(), request_id, response_head))); |
160 | 160 |
161 base::SharedMemory shared_memory; | 161 base::SharedMemory shared_memory; |
162 ASSERT_TRUE(shared_memory.CreateAndMapAnonymous(body.size())); | 162 ASSERT_TRUE(shared_memory.CreateAndMapAnonymous(body.size())); |
163 memcpy(shared_memory.memory(), body.data(), body.size()); | 163 memcpy(shared_memory.memory(), body.data(), body.size()); |
164 | 164 |
165 base::SharedMemoryHandle handle; | 165 base::SharedMemoryHandle handle; |
166 ASSERT_TRUE(shared_memory.GiveToProcess(base::Process::Current().handle(), | 166 ASSERT_TRUE(shared_memory.GiveToProcess(base::Process::Current().handle(), |
167 &handle)); | 167 &handle)); |
168 ASSERT_TRUE(channel_->Send(new ResourceMsg_DataReceived( | 168 ASSERT_TRUE(channel_->Send(new ResourceMsg_DataReceived( |
169 message.routing_id(), request_id, handle, body.size()))); | 169 message.routing_id(), |
| 170 request_id, |
| 171 handle, |
| 172 body.size(), |
| 173 body.size()))); |
170 | 174 |
171 ASSERT_TRUE(channel_->Send(new ResourceMsg_RequestComplete( | 175 ASSERT_TRUE(channel_->Send(new ResourceMsg_RequestComplete( |
172 message.routing_id(), | 176 message.routing_id(), |
173 request_id, | 177 request_id, |
174 net::URLRequestStatus(), | 178 net::URLRequestStatus(), |
175 std::string(), | 179 std::string(), |
176 base::Time()))); | 180 base::Time()))); |
177 } | 181 } |
178 | 182 |
179 void RenderViewFakeResourcesTest::OnRenderViewReady() { | 183 void RenderViewFakeResourcesTest::OnRenderViewReady() { |
180 // Grab a pointer to the new view using RenderViewVisitor. | 184 // Grab a pointer to the new view using RenderViewVisitor. |
181 ASSERT_TRUE(!view_); | 185 ASSERT_TRUE(!view_); |
182 RenderView::ForEach(this); | 186 RenderView::ForEach(this); |
183 ASSERT_TRUE(view_); | 187 ASSERT_TRUE(view_); |
184 message_loop_.Quit(); | 188 message_loop_.Quit(); |
185 } | 189 } |
186 | 190 |
187 } // namespace safe_browsing | 191 } // namespace safe_browsing |
OLD | NEW |