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_
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"
19 class MockWebBlobRegistryImpl
: public blink::WebBlobRegistry
{
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;
48 base::ScopedPtrHashMap
<std::string
,
49 scoped_ptr
<ScopedVector
<blink::WebBlobData::Item
>>>
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_