OLD | NEW |
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 WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ | 5 #ifndef WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ |
6 #define WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ | 6 #define WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ |
7 | 7 |
8 #include "net/url_request/url_request_context.h" | 8 #include "net/url_request/url_request_context.h" |
9 #include "net/url_request/url_request_job.h" | 9 #include "net/url_request/url_request_job.h" |
10 #include "net/url_request/url_request_job_factory_impl.h" | 10 #include "net/url_request/url_request_job_factory_impl.h" |
11 | 11 |
12 namespace fileapi { | 12 namespace fileapi { |
13 class FileSystemContext; | 13 class FileSystemContext; |
14 } | 14 } |
15 | 15 |
16 namespace webkit_blob { | 16 namespace webkit_blob { |
17 | 17 |
18 class BlobStorageController; | 18 class BlobDataHandle; |
| 19 class BlobStorageContext; |
19 | 20 |
20 class MockBlobURLRequestContext : public net::URLRequestContext { | 21 class MockBlobURLRequestContext : public net::URLRequestContext { |
21 public: | 22 public: |
22 MockBlobURLRequestContext(fileapi::FileSystemContext* file_system_context); | 23 MockBlobURLRequestContext(fileapi::FileSystemContext* file_system_context); |
23 virtual ~MockBlobURLRequestContext(); | 24 virtual ~MockBlobURLRequestContext(); |
24 | 25 |
25 BlobStorageController* blob_storage_controller() const { | 26 BlobStorageContext* blob_storage_context() const { |
26 return blob_storage_controller_.get(); | 27 return blob_storage_context_.get(); |
27 } | 28 } |
28 | 29 |
29 private: | 30 private: |
30 net::URLRequestJobFactoryImpl job_factory_; | 31 net::URLRequestJobFactoryImpl job_factory_; |
31 scoped_ptr<BlobStorageController> blob_storage_controller_; | 32 scoped_ptr<BlobStorageContext> blob_storage_context_; |
32 | 33 |
33 DISALLOW_COPY_AND_ASSIGN(MockBlobURLRequestContext); | 34 DISALLOW_COPY_AND_ASSIGN(MockBlobURLRequestContext); |
34 }; | 35 }; |
35 | 36 |
36 class ScopedTextBlob { | 37 class ScopedTextBlob { |
37 public: | 38 public: |
| 39 // Registers a blob with the given |id| that contains |data|. |
38 ScopedTextBlob(const MockBlobURLRequestContext& request_context, | 40 ScopedTextBlob(const MockBlobURLRequestContext& request_context, |
39 const GURL& blob_url, | 41 const std::string& blob_id, |
40 const std::string& data); | 42 const std::string& data); |
41 ~ScopedTextBlob(); | 43 ~ScopedTextBlob(); |
42 | 44 |
| 45 // Returns a BlobDataHandle referring to the scoped blob. |
| 46 scoped_ptr<BlobDataHandle> GetBlobDataHandle(); |
| 47 |
43 private: | 48 private: |
44 const GURL blob_url_; | 49 const std::string blob_id_; |
45 BlobStorageController* blob_storage_controller_; | 50 BlobStorageContext* blob_storage_context_; |
46 | 51 |
47 DISALLOW_COPY_AND_ASSIGN(ScopedTextBlob); | 52 DISALLOW_COPY_AND_ASSIGN(ScopedTextBlob); |
48 }; | 53 }; |
49 | 54 |
50 } // namespace webkit_blob | 55 } // namespace webkit_blob |
51 | 56 |
52 #endif // WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ | 57 #endif // WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |