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

Side by Side Diff: chrome/common/resource_dispatcher_unittest.cc

Issue 20015: Make it easier to create new IPC channel types (i.e. renderer/plugin). Inste... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months 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 | « chrome/common/render_messages_internal.h ('k') | chrome/common/security_filter_peer.h » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/process.h" 8 #include "base/process.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "chrome/common/filter_policy.h" 10 #include "chrome/common/filter_policy.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return true; 77 return true;
78 } 78 }
79 79
80 // Emulates the browser process and processes the pending IPC messages, 80 // Emulates the browser process and processes the pending IPC messages,
81 // returning the hardcoded file contents. 81 // returning the hardcoded file contents.
82 void ProcessMessages() { 82 void ProcessMessages() {
83 while (!message_queue_.empty()) { 83 while (!message_queue_.empty()) {
84 void* iter = NULL; 84 void* iter = NULL;
85 85
86 int request_id; 86 int request_id;
87 ASSERT_TRUE(IPC::ReadParam(&message_queue_[0], &iter, &request_id)); 87 ASSERT_TRUE(ReadParam(&message_queue_[0], &iter, &request_id));
88 88
89 ViewHostMsg_Resource_Request request; 89 ViewHostMsg_Resource_Request request;
90 ASSERT_TRUE(IPC::ReadParam(&message_queue_[0], &iter, &request)); 90 ASSERT_TRUE(ReadParam(&message_queue_[0], &iter, &request));
91 91
92 // check values 92 // check values
93 EXPECT_EQ(test_page_url, request.url.spec()); 93 EXPECT_EQ(test_page_url, request.url.spec());
94 94
95 // received response message 95 // received response message
96 ViewMsg_Resource_ResponseHead response; 96 ViewMsg_Resource_ResponseHead response;
97 std::string raw_headers(test_page_headers); 97 std::string raw_headers(test_page_headers);
98 std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0'); 98 std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0');
99 response.headers = new net::HttpResponseHeaders(raw_headers); 99 response.headers = new net::HttpResponseHeaders(raw_headers);
100 response.mime_type = test_page_mime_type; 100 response.mime_type = test_page_mime_type;
(...skipping 11 matching lines...) Expand all
112 base::SharedMemoryHandle dup_handle; 112 base::SharedMemoryHandle dup_handle;
113 EXPECT_TRUE(shared_mem.GiveToProcess( 113 EXPECT_TRUE(shared_mem.GiveToProcess(
114 base::Process::Current().handle(), &dup_handle)); 114 base::Process::Current().handle(), &dup_handle));
115 dispatcher_->OnReceivedData(request_id, dup_handle, test_page_contents_len ); 115 dispatcher_->OnReceivedData(request_id, dup_handle, test_page_contents_len );
116 116
117 message_queue_.erase(message_queue_.begin()); 117 message_queue_.erase(message_queue_.begin());
118 118
119 // read the ack message. 119 // read the ack message.
120 iter = NULL; 120 iter = NULL;
121 int request_ack = -1; 121 int request_ack = -1;
122 ASSERT_TRUE(IPC::ReadParam(&message_queue_[0], &iter, &request_ack)); 122 ASSERT_TRUE(ReadParam(&message_queue_[0], &iter, &request_ack));
123 123
124 ASSERT_EQ(request_ack, request_id); 124 ASSERT_EQ(request_ack, request_id);
125 125
126 message_queue_.erase(message_queue_.begin()); 126 message_queue_.erase(message_queue_.begin());
127 } 127 }
128 } 128 }
129 129
130 protected: 130 protected:
131 static ResourceDispatcher* GetResourceDispatcher(WebFrame* unused) { 131 static ResourceDispatcher* GetResourceDispatcher(WebFrame* unused) {
132 return dispatcher_; 132 return dispatcher_;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 TEST_F(ResourceDispatcherTest, Cookies) { 180 TEST_F(ResourceDispatcherTest, Cookies) {
181 // FIXME 181 // FIXME
182 } 182 }
183 183
184 TEST_F(ResourceDispatcherTest, SerializedPostData) { 184 TEST_F(ResourceDispatcherTest, SerializedPostData) {
185 // FIXME 185 // FIXME
186 } 186 }
187 187
OLDNEW
« no previous file with comments | « chrome/common/render_messages_internal.h ('k') | chrome/common/security_filter_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698