Don't preload rarely seen large images
[chromium-blink-merge.git] / components / dom_distiller / core / dom_distiller_test_util.h
blob8d22a256024f8e1023fdb3132cf7641794daa22c
1 // Copyright 2013 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 COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_TEST_UTIL_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_TEST_UTIL_H_
8 #include <vector>
10 #include "components/dom_distiller/core/dom_distiller_observer.h"
11 #include "components/leveldb_proto/testing/fake_db.h"
12 #include "testing/gmock/include/gmock/gmock.h"
14 namespace dom_distiller {
16 class DomDistillerStore;
18 namespace test {
19 namespace util {
21 class ObserverUpdatesMatcher
22 : public testing::MatcherInterface<
23 const std::vector<DomDistillerObserver::ArticleUpdate>&> {
24 public:
25 explicit ObserverUpdatesMatcher(
26 const std::vector<DomDistillerObserver::ArticleUpdate>&);
28 // MatcherInterface overrides.
29 bool MatchAndExplain(
30 const std::vector<DomDistillerObserver::ArticleUpdate>& actual_updates,
31 testing::MatchResultListener* listener) const override;
32 void DescribeTo(std::ostream* os) const override;
33 void DescribeNegationTo(std::ostream* os) const override;
35 private:
36 void DescribeUpdates(std::ostream* os) const;
37 const std::vector<DomDistillerObserver::ArticleUpdate>& expected_updates_;
40 testing::Matcher<const std::vector<DomDistillerObserver::ArticleUpdate>&>
41 HasExpectedUpdates(const std::vector<DomDistillerObserver::ArticleUpdate>&);
43 // Creates a simple DomDistillerStore backed by |fake_db| and initialized
44 // with |store_model|.
45 DomDistillerStore* CreateStoreWithFakeDB(
46 leveldb_proto::test::FakeDB<ArticleEntry>* fake_db,
47 const leveldb_proto::test::FakeDB<ArticleEntry>::EntryMap& store_model);
49 } // namespace util
50 } // namespace test
51 } // namespace dom_distiller
53 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_TEST_UTIL_H_