| 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_database_helper.h" | 5 #include "chrome/browser/browsing_data/mock_browsing_data_database_helper.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 ASSERT_FALSE(callback.is_null()); | 21 ASSERT_FALSE(callback.is_null()); |
| 22 ASSERT_TRUE(callback_.is_null()); | 22 ASSERT_TRUE(callback_.is_null()); |
| 23 callback_ = callback; | 23 callback_ = callback; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void MockBrowsingDataDatabaseHelper::DeleteDatabase( | 26 void MockBrowsingDataDatabaseHelper::DeleteDatabase( |
| 27 const std::string& origin, | 27 const std::string& origin, |
| 28 const std::string& name) { | 28 const std::string& name) { |
| 29 ASSERT_FALSE(callback_.is_null()); | 29 ASSERT_FALSE(callback_.is_null()); |
| 30 std::string key = origin + ":" + name; | 30 std::string key = origin + ":" + name; |
| 31 ASSERT_TRUE(ContainsKey(databases_, key)); | 31 ASSERT_TRUE(base::ContainsKey(databases_, key)); |
| 32 last_deleted_origin_ = origin; | 32 last_deleted_origin_ = origin; |
| 33 last_deleted_db_ = name; | 33 last_deleted_db_ = name; |
| 34 databases_[key] = false; | 34 databases_[key] = false; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void MockBrowsingDataDatabaseHelper::AddDatabaseSamples() { | 37 void MockBrowsingDataDatabaseHelper::AddDatabaseSamples() { |
| 38 storage::DatabaseIdentifier id1 = | 38 storage::DatabaseIdentifier id1 = |
| 39 storage::DatabaseIdentifier::Parse("http_gdbhost1_1"); | 39 storage::DatabaseIdentifier::Parse("http_gdbhost1_1"); |
| 40 response_.push_back(BrowsingDataDatabaseHelper::DatabaseInfo( | 40 response_.push_back(BrowsingDataDatabaseHelper::DatabaseInfo( |
| 41 id1, "db1", "description 1", 1, base::Time())); | 41 id1, "db1", "description 1", 1, base::Time())); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 pair.second = true; | 56 pair.second = true; |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool MockBrowsingDataDatabaseHelper::AllDeleted() { | 59 bool MockBrowsingDataDatabaseHelper::AllDeleted() { |
| 60 for (const auto& pair : databases_) { | 60 for (const auto& pair : databases_) { |
| 61 if (pair.second) | 61 if (pair.second) |
| 62 return false; | 62 return false; |
| 63 } | 63 } |
| 64 return true; | 64 return true; |
| 65 } | 65 } |
| OLD | NEW |