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

Side by Side Diff: net/test/url_request/url_request_mock_http_job.h

Issue 1893083002: Change scoped_ptr to std::unique_ptr in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-net-all: iwyu Created 4 years, 8 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 // A URLRequestJob class that pulls the net and http headers from disk. 5 // A URLRequestJob class that pulls the net and http headers from disk.
6 6
7 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ 7 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_
8 #define NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ 8 #define NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_
9 9
10 #include <memory>
10 #include <string> 11 #include <string>
11 12
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "net/url_request/url_request_file_job.h" 15 #include "net/url_request/url_request_file_job.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace base { 18 namespace base {
19 class FilePath; 19 class FilePath;
20 class SequencedWorkerPool; 20 class SequencedWorkerPool;
21 } 21 }
22 22
23 namespace net { 23 namespace net {
24 class URLRequestInterceptor; 24 class URLRequestInterceptor;
(...skipping 23 matching lines...) Expand all
48 48
49 // Given the path to a file relative to the path passed to AddUrlHandler(), 49 // Given the path to a file relative to the path passed to AddUrlHandler(),
50 // construct a mock URL. 50 // construct a mock URL.
51 static GURL GetMockUrl(const std::string& path); 51 static GURL GetMockUrl(const std::string& path);
52 static GURL GetMockHttpsUrl(const std::string& path); 52 static GURL GetMockHttpsUrl(const std::string& path);
53 53
54 // Returns a URLRequestJobFactory::ProtocolHandler that serves 54 // Returns a URLRequestJobFactory::ProtocolHandler that serves
55 // URLRequestMockHTTPJob's responding like an HTTP server. |base_path| is the 55 // URLRequestMockHTTPJob's responding like an HTTP server. |base_path| is the
56 // file path leading to the root of the directory to use as the root of the 56 // file path leading to the root of the directory to use as the root of the
57 // HTTP server. 57 // HTTP server.
58 static scoped_ptr<URLRequestInterceptor> CreateInterceptor( 58 static std::unique_ptr<URLRequestInterceptor> CreateInterceptor(
59 const base::FilePath& base_path, 59 const base::FilePath& base_path,
60 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); 60 const scoped_refptr<base::SequencedWorkerPool>& worker_pool);
61 61
62 // Returns a URLRequestJobFactory::ProtocolHandler that serves 62 // Returns a URLRequestJobFactory::ProtocolHandler that serves
63 // URLRequestMockHTTPJob's responding like an HTTP server. It responds to all 63 // URLRequestMockHTTPJob's responding like an HTTP server. It responds to all
64 // requests with the contents of |file|. 64 // requests with the contents of |file|.
65 static scoped_ptr<URLRequestInterceptor> CreateInterceptorForSingleFile( 65 static std::unique_ptr<URLRequestInterceptor> CreateInterceptorForSingleFile(
66 const base::FilePath& file, 66 const base::FilePath& file,
67 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); 67 const scoped_refptr<base::SequencedWorkerPool>& worker_pool);
68 68
69 protected: 69 protected:
70 ~URLRequestMockHTTPJob() override; 70 ~URLRequestMockHTTPJob() override;
71 71
72 private: 72 private:
73 void GetResponseInfoConst(HttpResponseInfo* info) const; 73 void GetResponseInfoConst(HttpResponseInfo* info) const;
74 void SetHeadersAndStart(const std::string& raw_headers); 74 void SetHeadersAndStart(const std::string& raw_headers);
75 75
76 std::string raw_headers_; 76 std::string raw_headers_;
77 const scoped_refptr<base::TaskRunner> task_runner_; 77 const scoped_refptr<base::TaskRunner> task_runner_;
78 78
79 base::WeakPtrFactory<URLRequestMockHTTPJob> weak_ptr_factory_; 79 base::WeakPtrFactory<URLRequestMockHTTPJob> weak_ptr_factory_;
80 80
81 DISALLOW_COPY_AND_ASSIGN(URLRequestMockHTTPJob); 81 DISALLOW_COPY_AND_ASSIGN(URLRequestMockHTTPJob);
82 }; 82 };
83 83
84 } // namespace net 84 } // namespace net
85 85
86 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_ 86 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_HTTP_JOB_H_
OLDNEW
« no previous file with comments | « net/test/url_request/url_request_mock_data_job.cc ('k') | net/test/url_request/url_request_mock_http_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698