Remove unused code calling WebMediaPlayerClient::requestFullscreen()
[chromium-blink-merge.git] / content / test / mock_webblob_registry_impl.cc
blob08d9063c3125e07e8329b73e5ca0ffb4097c28f8
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 #include "content/test/mock_webblob_registry_impl.h"
7 #include "third_party/WebKit/public/platform/WebBlobData.h"
8 #include "third_party/WebKit/public/platform/WebString.h"
9 #include "third_party/WebKit/public/platform/WebURL.h"
10 #include "third_party/WebKit/public/platform/WebVector.h"
12 using blink::WebBlobData;
13 using blink::WebString;
14 using blink::WebURL;
15 using blink::WebVector;
17 namespace content {
19 MockWebBlobRegistryImpl::MockWebBlobRegistryImpl() {
22 MockWebBlobRegistryImpl::~MockWebBlobRegistryImpl() {
25 void MockWebBlobRegistryImpl::registerBlobData(const WebString& uuid,
26 const WebBlobData& data) {
27 const std::string uuid_str(uuid.utf8());
28 blob_ref_count_map_[uuid_str] = 1;
29 scoped_ptr<ScopedVector<blink::WebBlobData::Item>> items(
30 new ScopedVector<blink::WebBlobData::Item>);
31 items->reserve(data.itemCount());
32 for (size_t i = 0; i < data.itemCount(); ++i) {
33 scoped_ptr<blink::WebBlobData::Item> item(new blink::WebBlobData::Item);
34 data.itemAt(i, *item);
35 items->push_back(item.release());
37 blob_data_items_map_.set(uuid_str, items.Pass());
40 void MockWebBlobRegistryImpl::addBlobDataRef(const WebString& uuid) {
41 blob_ref_count_map_[uuid.utf8()]++;
44 void MockWebBlobRegistryImpl::removeBlobDataRef(const WebString& uuid) {
45 const std::string uuid_str(uuid.utf8());
46 auto it = blob_ref_count_map_.find(uuid_str);
47 if (it != blob_ref_count_map_.end() && !--it->second) {
48 blob_data_items_map_.erase(uuid_str);
49 blob_ref_count_map_.erase(it);
53 void MockWebBlobRegistryImpl::registerPublicBlobURL(const WebURL& url,
54 const WebString& uuid) {
57 void MockWebBlobRegistryImpl::revokePublicBlobURL(const WebURL& url) {
60 void MockWebBlobRegistryImpl::registerStreamURL(const WebURL& url,
61 const WebString& content_type) {
64 void MockWebBlobRegistryImpl::registerStreamURL(const WebURL& url,
65 const blink::WebURL& src_url) {
68 void MockWebBlobRegistryImpl::addDataToStream(const WebURL& url,
69 const char* data,
70 size_t length) {
73 void MockWebBlobRegistryImpl::flushStream(const WebURL& url) {
76 void MockWebBlobRegistryImpl::finalizeStream(const WebURL& url) {
79 void MockWebBlobRegistryImpl::abortStream(const WebURL& url) {
82 void MockWebBlobRegistryImpl::unregisterStreamURL(const WebURL& url) {
85 bool MockWebBlobRegistryImpl::GetBlobItems(
86 const WebString& uuid,
87 WebVector<WebBlobData::Item*>* items) const {
88 ScopedVector<WebBlobData::Item>* item_vector =
89 blob_data_items_map_.get(uuid.utf8());
90 if (!item_vector)
91 return false;
92 *items = item_vector->get();
93 return true;
96 } // namespace content