Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / browsing_data / mock_browsing_data_indexed_db_helper.cc
blob7448b493cb7044611cd7f42cea30e15d610f6f54
1 // Copyright (c) 2012 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 "chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h"
7 #include "base/callback.h"
8 #include "base/logging.h"
9 #include "base/stl_util.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "content/public/browser/browser_context.h"
12 #include "content/public/browser/storage_partition.h"
13 #include "testing/gtest/include/gtest/gtest.h"
15 MockBrowsingDataIndexedDBHelper::MockBrowsingDataIndexedDBHelper(
16 Profile* profile)
17 : BrowsingDataIndexedDBHelper(
18 content::BrowserContext::GetDefaultStoragePartition(profile)->
19 GetIndexedDBContext()) {
22 MockBrowsingDataIndexedDBHelper::~MockBrowsingDataIndexedDBHelper() {
25 void MockBrowsingDataIndexedDBHelper::StartFetching(
26 const base::Callback<void(const std::list<content::IndexedDBInfo>&)>&
27 callback) {
28 ASSERT_FALSE(callback.is_null());
29 ASSERT_TRUE(callback_.is_null());
30 callback_ = callback;
33 void MockBrowsingDataIndexedDBHelper::DeleteIndexedDB(
34 const GURL& origin) {
35 ASSERT_FALSE(callback_.is_null());
36 ASSERT_TRUE(ContainsKey(origins_, origin));
37 origins_[origin] = false;
40 void MockBrowsingDataIndexedDBHelper::AddIndexedDBSamples() {
41 const GURL kOrigin1("http://idbhost1:1/");
42 const GURL kOrigin2("http://idbhost2:2/");
43 content::IndexedDBInfo info1(kOrigin1, 1, base::Time(), 0);
44 response_.push_back(info1);
45 origins_[kOrigin1] = true;
46 content::IndexedDBInfo info2(kOrigin2, 2, base::Time(), 0);
47 response_.push_back(info2);
48 origins_[kOrigin2] = true;
51 void MockBrowsingDataIndexedDBHelper::Notify() {
52 callback_.Run(response_);
55 void MockBrowsingDataIndexedDBHelper::Reset() {
56 for (auto& pair : origins_)
57 pair.second = true;
60 bool MockBrowsingDataIndexedDBHelper::AllDeleted() {
61 for (const auto& pair : origins_) {
62 if (pair.second)
63 return false;
65 return true;