| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h" | 5 #include "chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 MockBrowsingDataIndexedDBHelper::MockBrowsingDataIndexedDBHelper() { | 10 MockBrowsingDataIndexedDBHelper::MockBrowsingDataIndexedDBHelper() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 void MockBrowsingDataIndexedDBHelper::DeleteIndexedDB( | 22 void MockBrowsingDataIndexedDBHelper::DeleteIndexedDB( |
| 23 const GURL& origin) { | 23 const GURL& origin) { |
| 24 CHECK(origins_.find(origin) != origins_.end()); | 24 CHECK(origins_.find(origin) != origins_.end()); |
| 25 origins_[origin] = false; | 25 origins_[origin] = false; |
| 26 } | 26 } |
| 27 | 27 |
| 28 void MockBrowsingDataIndexedDBHelper::AddIndexedDBSamples() { | 28 void MockBrowsingDataIndexedDBHelper::AddIndexedDBSamples() { |
| 29 const GURL kOrigin1("http://idbhost1:1/"); | 29 const GURL kOrigin1("http://idbhost1:1/"); |
| 30 const GURL kOrigin2("http://idbhost2:2/"); | 30 const GURL kOrigin2("http://idbhost2:2/"); |
| 31 content::IndexedDBInfo info1(kOrigin1, 1, base::Time()); | 31 content::IndexedDBInfo info1(kOrigin1, 1, base::Time(), base::FilePath()); |
| 32 response_.push_back(info1); | 32 response_.push_back(info1); |
| 33 origins_[kOrigin1] = true; | 33 origins_[kOrigin1] = true; |
| 34 content::IndexedDBInfo info2(kOrigin2, 2, base::Time()); | 34 content::IndexedDBInfo info2(kOrigin2, 2, base::Time(), base::FilePath()); |
| 35 response_.push_back(info2); | 35 response_.push_back(info2); |
| 36 origins_[kOrigin2] = true; | 36 origins_[kOrigin2] = true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void MockBrowsingDataIndexedDBHelper::Notify() { | 39 void MockBrowsingDataIndexedDBHelper::Notify() { |
| 40 CHECK_EQ(false, callback_.is_null()); | 40 CHECK_EQ(false, callback_.is_null()); |
| 41 callback_.Run(response_); | 41 callback_.Run(response_); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void MockBrowsingDataIndexedDBHelper::Reset() { | 44 void MockBrowsingDataIndexedDBHelper::Reset() { |
| 45 for (std::map<GURL, bool>::iterator i = origins_.begin(); | 45 for (std::map<GURL, bool>::iterator i = origins_.begin(); |
| 46 i != origins_.end(); ++i) | 46 i != origins_.end(); ++i) |
| 47 i->second = true; | 47 i->second = true; |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool MockBrowsingDataIndexedDBHelper::AllDeleted() { | 50 bool MockBrowsingDataIndexedDBHelper::AllDeleted() { |
| 51 for (std::map<GURL, bool>::const_iterator i = origins_.begin(); | 51 for (std::map<GURL, bool>::const_iterator i = origins_.begin(); |
| 52 i != origins_.end(); ++i) | 52 i != origins_.end(); ++i) |
| 53 if (i->second) | 53 if (i->second) |
| 54 return false; | 54 return false; |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| OLD | NEW |