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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_unittest.cc

Issue 11570038: Remove IPC::MessageIterator. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 8 years 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 | « no previous file | content/common/indexed_db/indexed_db_message_filter.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/pickle.h"
11 #include "base/process_util.h" 12 #include "base/process_util.h"
12 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
13 #include "base/string_split.h" 14 #include "base/string_split.h"
14 #include "content/browser/browser_thread_impl.h" 15 #include "content/browser/browser_thread_impl.h"
15 #include "content/browser/child_process_security_policy_impl.h" 16 #include "content/browser/child_process_security_policy_impl.h"
16 #include "content/browser/loader/resource_dispatcher_host_impl.h" 17 #include "content/browser/loader/resource_dispatcher_host_impl.h"
17 #include "content/browser/loader/resource_message_filter.h" 18 #include "content/browser/loader/resource_message_filter.h"
18 #include "content/common/child_process_host_impl.h" 19 #include "content/common/child_process_host_impl.h"
19 #include "content/common/resource_messages.h" 20 #include "content/common/resource_messages.h"
20 #include "content/common/view_messages.h" 21 #include "content/common/view_messages.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } // namespace 69 } // namespace
69 70
70 static int RequestIDForMessage(const IPC::Message& msg) { 71 static int RequestIDForMessage(const IPC::Message& msg) {
71 int request_id = -1; 72 int request_id = -1;
72 switch (msg.type()) { 73 switch (msg.type()) {
73 case ResourceMsg_UploadProgress::ID: 74 case ResourceMsg_UploadProgress::ID:
74 case ResourceMsg_ReceivedResponse::ID: 75 case ResourceMsg_ReceivedResponse::ID:
75 case ResourceMsg_ReceivedRedirect::ID: 76 case ResourceMsg_ReceivedRedirect::ID:
76 case ResourceMsg_SetDataBuffer::ID: 77 case ResourceMsg_SetDataBuffer::ID:
77 case ResourceMsg_DataReceived::ID: 78 case ResourceMsg_DataReceived::ID:
78 case ResourceMsg_RequestComplete::ID: 79 case ResourceMsg_RequestComplete::ID: {
79 request_id = IPC::MessageIterator(msg).NextInt(); 80 bool result = PickleIterator(msg).ReadInt(&request_id);
81 DCHECK(result);
80 break; 82 break;
83 }
81 } 84 }
82 return request_id; 85 return request_id;
83 } 86 }
84 87
85 static ResourceHostMsg_Request CreateResourceRequest( 88 static ResourceHostMsg_Request CreateResourceRequest(
86 const char* method, 89 const char* method,
87 ResourceType::Type type, 90 ResourceType::Type type,
88 const GURL& url) { 91 const GURL& url) {
89 ResourceHostMsg_Request request; 92 ResourceHostMsg_Request request;
90 request.method = std::string(method); 93 request.method = std::string(method);
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 delay_start_ = delay_job_start; 684 delay_start_ = delay_job_start;
682 } 685 }
683 686
684 void SetDelayedCompleteJobGeneration(bool delay_job_complete) { 687 void SetDelayedCompleteJobGeneration(bool delay_job_complete) {
685 delay_complete_ = delay_job_complete; 688 delay_complete_ = delay_job_complete;
686 } 689 }
687 690
688 void GenerateDataReceivedACK(const IPC::Message& msg) { 691 void GenerateDataReceivedACK(const IPC::Message& msg) {
689 EXPECT_EQ(ResourceMsg_DataReceived::ID, msg.type()); 692 EXPECT_EQ(ResourceMsg_DataReceived::ID, msg.type());
690 693
691 int request_id = IPC::MessageIterator(msg).NextInt(); 694 int request_id = -1;
695 bool result = PickleIterator(msg).ReadInt(&request_id);
696 DCHECK(result);
692 scoped_ptr<IPC::Message> ack( 697 scoped_ptr<IPC::Message> ack(
693 new ResourceHostMsg_DataReceived_ACK(msg.routing_id(), request_id)); 698 new ResourceHostMsg_DataReceived_ACK(msg.routing_id(), request_id));
694 699
695 MessageLoop::current()->PostTask( 700 MessageLoop::current()->PostTask(
696 FROM_HERE, 701 FROM_HERE,
697 base::Bind(&GenerateIPCMessage, filter_, base::Passed(&ack))); 702 base::Bind(&GenerateIPCMessage, filter_, base::Passed(&ack)));
698 } 703 }
699 704
700 MessageLoopForIO message_loop_; 705 MessageLoopForIO message_loop_;
701 BrowserThreadImpl ui_thread_; 706 BrowserThreadImpl ui_thread_;
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 } 1952 }
1948 1953
1949 MessageLoop::current()->RunUntilIdle(); 1954 MessageLoop::current()->RunUntilIdle();
1950 1955
1951 msgs.clear(); 1956 msgs.clear();
1952 accum_.GetClassifiedMessages(&msgs); 1957 accum_.GetClassifiedMessages(&msgs);
1953 } 1958 }
1954 } 1959 }
1955 1960
1956 } // namespace content 1961 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/indexed_db/indexed_db_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698