| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_SERVICES_HTML_VIEWER_MOCK_WEB_BLOB_REGISTRY_IMPL_H_ | |
| 6 #define MOJO_SERVICES_HTML_VIEWER_MOCK_WEB_BLOB_REGISTRY_IMPL_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/containers/scoped_ptr_hash_map.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/scoped_vector.h" | |
| 13 #include "third_party/WebKit/public/platform/WebBlobData.h" | |
| 14 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | |
| 15 #include "third_party/WebKit/public/platform/WebVector.h" | |
| 16 | |
| 17 namespace html_viewer { | |
| 18 | |
| 19 // TODO(erg): For now, this is a just a copy of content's testing | |
| 20 // mock. Eventually, this should be turned into a real implementation, but this | |
| 21 // at least lets us get github working. | |
| 22 class MockWebBlobRegistryImpl : public blink::WebBlobRegistry { | |
| 23 public: | |
| 24 MockWebBlobRegistryImpl(); | |
| 25 virtual ~MockWebBlobRegistryImpl(); | |
| 26 | |
| 27 virtual void registerBlobData(const blink::WebString& uuid, | |
| 28 const blink::WebBlobData& data); | |
| 29 virtual void addBlobDataRef(const blink::WebString& uuid); | |
| 30 virtual void removeBlobDataRef(const blink::WebString& uuid); | |
| 31 virtual void registerPublicBlobURL(const blink::WebURL&, | |
| 32 const blink::WebString& uuid); | |
| 33 virtual void revokePublicBlobURL(const blink::WebURL&); | |
| 34 | |
| 35 // Additional support for Streams. | |
| 36 virtual void registerStreamURL(const blink::WebURL& url, | |
| 37 const blink::WebString& content_type); | |
| 38 virtual void registerStreamURL(const blink::WebURL& url, | |
| 39 const blink::WebURL& src_url); | |
| 40 virtual void addDataToStream(const blink::WebURL& url, | |
| 41 const char* data, | |
| 42 size_t length); | |
| 43 virtual void flushStream(const blink::WebURL& url); | |
| 44 virtual void finalizeStream(const blink::WebURL& url); | |
| 45 virtual void abortStream(const blink::WebURL& url); | |
| 46 virtual void unregisterStreamURL(const blink::WebURL& url); | |
| 47 | |
| 48 bool GetUUIDForURL(const blink::WebURL& url, blink::WebString* uuid) const; | |
| 49 bool GetBlobItems(const blink::WebString& uuid, | |
| 50 blink::WebVector<blink::WebBlobData::Item*>* items) const; | |
| 51 | |
| 52 private: | |
| 53 base::ScopedPtrHashMap<std::string, ScopedVector<blink::WebBlobData::Item>> | |
| 54 blob_data_items_map_; | |
| 55 std::map<std::string, int> blob_ref_count_map_; | |
| 56 | |
| 57 std::map<std::string, blink::WebString> public_url_to_uuid_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(MockWebBlobRegistryImpl); | |
| 60 }; | |
| 61 | |
| 62 } // namespace html_viewer | |
| 63 | |
| 64 #endif // MOJO_SERVICES_HTML_VIEWER_MOCK_WEB_BLOB_REGISTRY_IMPL_H_ | |
| OLD | NEW |