Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: content/test/render_view_fake_resources_test.cc

Issue 8680036: Move ResourceResponse struct into the Content API, since it's used in Chrome. While at it, I also... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: add gypi changes Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/public/common/resource_response.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/test/render_view_fake_resources_test.h" 5 #include "content/test/render_view_fake_resources_test.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "content/common/dom_storage_common.h" 12 #include "content/common/dom_storage_common.h"
13 #include "content/common/resource_messages.h" 13 #include "content/common/resource_messages.h"
14 #include "content/common/resource_response.h"
15 #include "content/common/view_messages.h" 14 #include "content/common/view_messages.h"
15 #include "content/public/common/resource_response.h"
16 #include "content/renderer/render_thread_impl.h" 16 #include "content/renderer/render_thread_impl.h"
17 #include "content/renderer/render_view_impl.h" 17 #include "content/renderer/render_view_impl.h"
18 #include "content/test/mock_render_process.h" 18 #include "content/test/mock_render_process.h"
19 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
20 #include "net/base/upload_data.h" 20 #include "net/base/upload_data.h"
21 #include "net/http/http_response_headers.h" 21 #include "net/http/http_response_headers.h"
22 #include "net/url_request/url_request_status.h" 22 #include "net/url_request/url_request_status.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 std::map<std::string, std::string>::const_iterator it = 143 std::map<std::string, std::string>::const_iterator it =
144 responses_.find(request_data.url.spec()); 144 responses_.find(request_data.url.spec());
145 if (it == responses_.end()) { 145 if (it == responses_.end()) {
146 headers = "HTTP/1.1 404 Not Found\0Content-Type:text/html\0\0"; 146 headers = "HTTP/1.1 404 Not Found\0Content-Type:text/html\0\0";
147 body = "content not found"; 147 body = "content not found";
148 } else { 148 } else {
149 headers = "HTTP/1.1 200 OK\0Content-Type:text/html\0\0"; 149 headers = "HTTP/1.1 200 OK\0Content-Type:text/html\0\0";
150 body = it->second; 150 body = it->second;
151 } 151 }
152 152
153 ResourceResponseHead response_head; 153 content::ResourceResponseHead response_head;
154 response_head.headers = new net::HttpResponseHeaders(headers); 154 response_head.headers = new net::HttpResponseHeaders(headers);
155 response_head.mime_type = "text/html"; 155 response_head.mime_type = "text/html";
156 ASSERT_TRUE(channel_->Send(new ResourceMsg_ReceivedResponse( 156 ASSERT_TRUE(channel_->Send(new ResourceMsg_ReceivedResponse(
157 message.routing_id(), request_id, response_head))); 157 message.routing_id(), request_id, response_head)));
158 158
159 base::SharedMemory shared_memory; 159 base::SharedMemory shared_memory;
160 ASSERT_TRUE(shared_memory.CreateAndMapAnonymous(body.size())); 160 ASSERT_TRUE(shared_memory.CreateAndMapAnonymous(body.size()));
161 memcpy(shared_memory.memory(), body.data(), body.size()); 161 memcpy(shared_memory.memory(), body.data(), body.size());
162 162
163 base::SharedMemoryHandle handle; 163 base::SharedMemoryHandle handle;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 params.current_history_list_length = (impl->historyBackListCount() + 198 params.current_history_list_length = (impl->historyBackListCount() +
199 impl->historyForwardListCount() + 1); 199 impl->historyForwardListCount() + 1);
200 params.url = GURL(history_item.urlString()); 200 params.url = GURL(history_item.urlString());
201 params.transition = content::PAGE_TRANSITION_FORWARD_BACK; 201 params.transition = content::PAGE_TRANSITION_FORWARD_BACK;
202 params.state = webkit_glue::HistoryItemToString(history_item); 202 params.state = webkit_glue::HistoryItemToString(history_item);
203 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; 203 params.navigation_type = ViewMsg_Navigate_Type::NORMAL;
204 params.request_time = base::Time::Now(); 204 params.request_time = base::Time::Now();
205 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); 205 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params));
206 message_loop_.Run(); 206 message_loop_.Run();
207 } 207 }
OLDNEW
« no previous file with comments | « content/public/common/resource_response.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698