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

Side by Side Diff: chrome_frame/test/test_server.h

Issue 12321062: base: Move MemoryMappedFile out of file_util.h and into its own header file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chrome_frame Created 7 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
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 #ifndef CHROME_FRAME_TEST_TEST_SERVER_H_ 5 #ifndef CHROME_FRAME_TEST_TEST_SERVER_H_
6 #define CHROME_FRAME_TEST_TEST_SERVER_H_ 6 #define CHROME_FRAME_TEST_TEST_SERVER_H_
7 7
8 // Implementation of an HTTP server for tests. 8 // Implementation of an HTTP server for tests.
9 // To instantiate the server, make sure you have a message loop on the 9 // To instantiate the server, make sure you have a message loop on the
10 // current thread and then create an instance of the SimpleWebServer class. 10 // current thread and then create an instance of the SimpleWebServer class.
(...skipping 21 matching lines...) Expand all
32 // To implement a custom response object (e.g. to match against a request 32 // To implement a custom response object (e.g. to match against a request
33 // based on some data, serve up dynamic content or take some action on the 33 // based on some data, serve up dynamic content or take some action on the
34 // server), just inherit from one of the response classes or directly from the 34 // server), just inherit from one of the response classes or directly from the
35 // Response interface and add your response object to the server's list of 35 // Response interface and add your response object to the server's list of
36 // response objects. 36 // response objects.
37 37
38 #include <list> 38 #include <list>
39 #include <string> 39 #include <string>
40 40
41 #include "base/basictypes.h" 41 #include "base/basictypes.h"
42 #include "base/file_util.h"
43 #include "base/message_loop.h" 42 #include "base/message_loop.h"
44 #include "net/base/stream_listen_socket.h" 43 #include "net/base/stream_listen_socket.h"
45 44
45 namespace base {
46 class MemoryMappedFile;
47 }
48
46 namespace test_server { 49 namespace test_server {
47 50
48 class Request { 51 class Request {
49 public: 52 public:
50 Request() : content_length_(0) { 53 Request() : content_length_(0) {
51 } 54 }
52 55
53 void ParseHeaders(const std::string& headers); 56 void ParseHeaders(const std::string& headers);
54 57
55 const std::string& method() const { 58 const std::string& method() const {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 FileResponse(const char* request_path, const base::FilePath& file_path) 247 FileResponse(const char* request_path, const base::FilePath& file_path)
245 : ResponseForPath(request_path), file_path_(file_path) { 248 : ResponseForPath(request_path), file_path_(file_path) {
246 } 249 }
247 250
248 virtual bool GetContentType(std::string* content_type) const; 251 virtual bool GetContentType(std::string* content_type) const;
249 virtual void WriteContents(net::StreamListenSocket* socket) const; 252 virtual void WriteContents(net::StreamListenSocket* socket) const;
250 virtual size_t ContentLength() const; 253 virtual size_t ContentLength() const;
251 254
252 protected: 255 protected:
253 base::FilePath file_path_; 256 base::FilePath file_path_;
254 mutable scoped_ptr<file_util::MemoryMappedFile> file_; 257 mutable scoped_ptr<base::MemoryMappedFile> file_;
255 258
256 private: 259 private:
257 DISALLOW_COPY_AND_ASSIGN(FileResponse); 260 DISALLOW_COPY_AND_ASSIGN(FileResponse);
258 }; 261 };
259 262
260 // Returns a 302 (temporary redirect) to redirect the client from a path 263 // Returns a 302 (temporary redirect) to redirect the client from a path
261 // on the test server to a different URL. 264 // on the test server to a different URL.
262 class RedirectResponse : public ResponseForPath { 265 class RedirectResponse : public ResponseForPath {
263 public: 266 public:
264 RedirectResponse(const char* request_path, const std::string& redirect_url) 267 RedirectResponse(const char* request_path, const std::string& redirect_url)
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 441
439 scoped_refptr<net::StreamListenSocket> server_; 442 scoped_refptr<net::StreamListenSocket> server_;
440 ConnectionList connection_list_; 443 ConnectionList connection_list_;
441 444
442 DISALLOW_COPY_AND_ASSIGN(HTTPTestServer); 445 DISALLOW_COPY_AND_ASSIGN(HTTPTestServer);
443 }; 446 };
444 447
445 } // namespace test_server 448 } // namespace test_server
446 449
447 #endif // CHROME_FRAME_TEST_TEST_SERVER_H_ 450 #endif // CHROME_FRAME_TEST_TEST_SERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698