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

Side by Side Diff: chrome/browser/policy/cloud/test_request_interceptor.cc

Issue 2858073002: Use constexpr TaskTraits constructor in chrome. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « chrome/browser/platform_util.cc ('k') | chrome/browser/prefs/incognito_mode_prefs.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/browser/policy/cloud/test_request_interceptor.h" 5 #include "chrome/browser/policy/cloud/test_request_interceptor.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 net::NetworkDelegate* network_delegate) { 58 net::NetworkDelegate* network_delegate) {
59 return HttpErrorJobCallback("400 Bad request", request, network_delegate); 59 return HttpErrorJobCallback("400 Bad request", request, network_delegate);
60 } 60 }
61 61
62 net::URLRequestJob* FileJobCallback(const base::FilePath& file_path, 62 net::URLRequestJob* FileJobCallback(const base::FilePath& file_path,
63 net::URLRequest* request, 63 net::URLRequest* request,
64 net::NetworkDelegate* network_delegate) { 64 net::NetworkDelegate* network_delegate) {
65 return new net::URLRequestMockHTTPJob( 65 return new net::URLRequestMockHTTPJob(
66 request, network_delegate, file_path, 66 request, network_delegate, file_path,
67 base::CreateTaskRunnerWithTraits( 67 base::CreateTaskRunnerWithTraits(
68 base::TaskTraits() 68 {base::MayBlock(), base::TaskPriority::BACKGROUND,
69 .MayBlock() 69 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}));
70 .WithPriority(base::TaskPriority::BACKGROUND)
71 .WithShutdownBehavior(
72 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)));
73 } 70 }
74 71
75 // Parses the upload data in |request| into |request_msg|, and validates the 72 // Parses the upload data in |request| into |request_msg|, and validates the
76 // request. The query string in the URL must contain the |expected_type| for 73 // request. The query string in the URL must contain the |expected_type| for
77 // the "request" parameter. Returns true if all checks succeeded, and the 74 // the "request" parameter. Returns true if all checks succeeded, and the
78 // request data has been parsed into |request_msg|. 75 // request data has been parsed into |request_msg|.
79 bool ValidRequest(net::URLRequest* request, 76 bool ValidRequest(net::URLRequest* request,
80 const std::string& expected_type, 77 const std::string& expected_type,
81 em::DeviceManagementRequest* request_msg) { 78 em::DeviceManagementRequest* request_msg) {
82 if (request->method() != "POST") 79 if (request->method() != "POST")
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 io_task_runner_->PostTask(FROM_HERE, task); 341 io_task_runner_->PostTask(FROM_HERE, task);
345 base::RunLoop run_loop; 342 base::RunLoop run_loop;
346 io_task_runner_->PostTask( 343 io_task_runner_->PostTask(
347 FROM_HERE, base::BindOnce(base::IgnoreResult(&base::TaskRunner::PostTask), 344 FROM_HERE, base::BindOnce(base::IgnoreResult(&base::TaskRunner::PostTask),
348 base::ThreadTaskRunnerHandle::Get(), FROM_HERE, 345 base::ThreadTaskRunnerHandle::Get(), FROM_HERE,
349 run_loop.QuitClosure())); 346 run_loop.QuitClosure()));
350 run_loop.Run(); 347 run_loop.Run();
351 } 348 }
352 349
353 } // namespace policy 350 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/platform_util.cc ('k') | chrome/browser/prefs/incognito_mode_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698