1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// found in the LICENSE file. 4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#ifndef COMPONENTS_ENHANCED_BOOKMARKS_TEST_IMAGE_STORE_H_ 6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#define COMPONENTS_ENHANCED_BOOKMARKS_TEST_IMAGE_STORE_H_ 7cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "components/enhanced_bookmarks/image_store.h" 9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// The TestImageStore is an implementation of ImageStore that keeps all its 11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// data in memory. When deallocated all the associations are lost. 12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Used in tests. 13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class TestImageStore : public ImageStore { 14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) public: 15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) TestImageStore(); 16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool HasKey(const GURL& page_url) OVERRIDE; 17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Insert(const GURL& page_url, 18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const GURL& image_url, 19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const gfx::Image& image) OVERRIDE; 20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Erase(const GURL& page_url) OVERRIDE; 21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual std::pair<gfx::Image, GURL> Get(const GURL& page_url) OVERRIDE; 22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::Size GetSize(const GURL& page_url) OVERRIDE; 23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void GetAllPageUrls(std::set<GURL>* urls) OVERRIDE; 24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ClearAll() OVERRIDE; 2546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) virtual int64 GetStoreSizeInBytes() OVERRIDE; 26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) protected: 28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ~TestImageStore(); 29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) private: 31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) typedef std::map<const GURL, std::pair<gfx::Image, const GURL> > ImageMap; 32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) ImageMap store_; 33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(TestImageStore); 35cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}; 36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 37cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#endif // COMPONENTS_ENHANCED_BOOKMARKS_TEST_IMAGE_STORE_H_ 38