Further cleanup of some assets
[chromium-blink-merge.git] / content / test / mock_webblob_registry_impl.h
blobb8e5926bff090fff2b33a0e5a1ff2266be4b50a2
1 // Copyright 2014 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.
5 #ifndef CONTENT_TEST_MOCK_WEBBLOB_REGISTRY_IMPL_H_
6 #define CONTENT_TEST_MOCK_WEBBLOB_REGISTRY_IMPL_H_
8 #include <map>
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"
17 namespace content {
19 class MockWebBlobRegistryImpl : public blink::WebBlobRegistry {
20 public:
21 MockWebBlobRegistryImpl();
22 virtual ~MockWebBlobRegistryImpl();
24 virtual void registerBlobData(const blink::WebString& uuid,
25 const blink::WebBlobData& data);
26 virtual void addBlobDataRef(const blink::WebString& uuid);
27 virtual void removeBlobDataRef(const blink::WebString& uuid);
28 virtual void registerPublicBlobURL(const blink::WebURL&,
29 const blink::WebString& uuid);
30 virtual void revokePublicBlobURL(const blink::WebURL&);
32 // Additional support for Streams.
33 virtual void registerStreamURL(const blink::WebURL& url,
34 const blink::WebString& content_type);
35 virtual void registerStreamURL(const blink::WebURL& url,
36 const blink::WebURL& src_url);
37 virtual void addDataToStream(const blink::WebURL& url,
38 const char* data, size_t length);
39 virtual void flushStream(const blink::WebURL& url);
40 virtual void finalizeStream(const blink::WebURL& url);
41 virtual void abortStream(const blink::WebURL& url);
42 virtual void unregisterStreamURL(const blink::WebURL& url);
44 bool GetBlobItems(const blink::WebString& uuid,
45 blink::WebVector<blink::WebBlobData::Item*>* items) const;
47 private:
48 base::ScopedPtrHashMap<std::string,
49 scoped_ptr<ScopedVector<blink::WebBlobData::Item>>>
50 blob_data_items_map_;
51 std::map<std::string, int> blob_ref_count_map_;
53 DISALLOW_COPY_AND_ASSIGN(MockWebBlobRegistryImpl);
56 } // namespace content
58 #endif // CONTENT_TEST_MOCK_WEBBLOB_REGISTRY_IMPL_H_