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

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

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/location.h"
12 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
13 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
13 #include "base/message_loop/message_loop.h"
14 #include "base/pickle.h" 14 #include "base/pickle.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/single_thread_task_runner.h"
17 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_split.h" 17 #include "base/strings/string_split.h"
19 #include "base/thread_task_runner_handle.h"
20 #include "content/browser/browser_thread_impl.h" 18 #include "content/browser/browser_thread_impl.h"
21 #include "content/browser/child_process_security_policy_impl.h" 19 #include "content/browser/child_process_security_policy_impl.h"
22 #include "content/browser/loader/cross_site_resource_handler.h" 20 #include "content/browser/loader/cross_site_resource_handler.h"
23 #include "content/browser/loader/detachable_resource_handler.h" 21 #include "content/browser/loader/detachable_resource_handler.h"
24 #include "content/browser/loader/resource_dispatcher_host_impl.h" 22 #include "content/browser/loader/resource_dispatcher_host_impl.h"
25 #include "content/browser/loader/resource_loader.h" 23 #include "content/browser/loader/resource_loader.h"
26 #include "content/browser/loader/resource_message_filter.h" 24 #include "content/browser/loader/resource_message_filter.h"
27 #include "content/browser/loader/resource_request_info_impl.h" 25 #include "content/browser/loader/resource_request_info_impl.h"
28 #include "content/common/appcache_interfaces.h" 26 #include "content/common/appcache_interfaces.h"
29 #include "content/common/child_process_host_impl.h" 27 #include "content/common/child_process_host_impl.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 return net::ERR_INVALID_URL; 435 return net::ERR_INVALID_URL;
438 436
439 data->reserve(text.size() * count); 437 data->reserve(text.size() * count);
440 for (int i = 0; i < count; ++i) 438 for (int i = 0; i < count; ++i)
441 data->append(text); 439 data->append(text);
442 440
443 return net::OK; 441 return net::OK;
444 } 442 }
445 443
446 base::TaskRunner* GetTaskRunner() const override { 444 base::TaskRunner* GetTaskRunner() const override {
447 return base::ThreadTaskRunnerHandle::Get().get(); 445 return base::MessageLoopProxy::current().get();
448 } 446 }
449 447
450 private: 448 private:
451 ~URLRequestBigJob() override {} 449 ~URLRequestBigJob() override {}
452 450
453 // big-job:substring,N 451 // big-job:substring,N
454 static bool ParseURL(const GURL& url, std::string* text, int* count) { 452 static bool ParseURL(const GURL& url, std::string* text, int* count) {
455 std::vector<std::string> parts; 453 std::vector<std::string> parts;
456 base::SplitString(url.path(), ',', &parts); 454 base::SplitString(url.path(), ',', &parts);
457 455
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 915
918 void GenerateDataReceivedACK(const IPC::Message& msg) { 916 void GenerateDataReceivedACK(const IPC::Message& msg) {
919 EXPECT_EQ(ResourceMsg_DataReceived::ID, msg.type()); 917 EXPECT_EQ(ResourceMsg_DataReceived::ID, msg.type());
920 918
921 int request_id = -1; 919 int request_id = -1;
922 bool result = base::PickleIterator(msg).ReadInt(&request_id); 920 bool result = base::PickleIterator(msg).ReadInt(&request_id);
923 DCHECK(result); 921 DCHECK(result);
924 scoped_ptr<IPC::Message> ack( 922 scoped_ptr<IPC::Message> ack(
925 new ResourceHostMsg_DataReceived_ACK(request_id)); 923 new ResourceHostMsg_DataReceived_ACK(request_id));
926 924
927 base::ThreadTaskRunnerHandle::Get()->PostTask( 925 base::MessageLoop::current()->PostTask(
928 FROM_HERE, 926 FROM_HERE,
929 base::Bind(&GenerateIPCMessage, filter_, base::Passed(&ack))); 927 base::Bind(&GenerateIPCMessage, filter_, base::Passed(&ack)));
930 } 928 }
931 929
932 // Setting filters for testing renderer messages. 930 // Setting filters for testing renderer messages.
933 // Returns the previous filter. 931 // Returns the previous filter.
934 ResourceMessageFilter* SetFilter(ResourceMessageFilter* new_filter) { 932 ResourceMessageFilter* SetFilter(ResourceMessageFilter* new_filter) {
935 ResourceMessageFilter* old_filter = host_.filter_; 933 ResourceMessageFilter* old_filter = host_.filter_;
936 host_.filter_ = new_filter; 934 host_.filter_ = new_filter;
937 return old_filter; 935 return old_filter;
(...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after
3244 return nullptr; 3242 return nullptr;
3245 } 3243 }
3246 3244
3247 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( 3245 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse(
3248 net::URLRequest* request, 3246 net::URLRequest* request,
3249 net::NetworkDelegate* network_delegate) const { 3247 net::NetworkDelegate* network_delegate) const {
3250 return nullptr; 3248 return nullptr;
3251 } 3249 }
3252 3250
3253 } // namespace content 3251 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/buffered_resource_handler.cc ('k') | content/browser/loader/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698