| 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_file_system_helper.h" | 5 #include "chrome/browser/browsing_data/mock_browsing_data_file_system_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 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 MockBrowsingDataFileSystemHelper::MockBrowsingDataFileSystemHelper( | 12 MockBrowsingDataFileSystemHelper::MockBrowsingDataFileSystemHelper( |
| 13 Profile* profile) { | 13 Profile* profile) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 MockBrowsingDataFileSystemHelper::~MockBrowsingDataFileSystemHelper() { | 16 MockBrowsingDataFileSystemHelper::~MockBrowsingDataFileSystemHelper() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 void MockBrowsingDataFileSystemHelper::StartFetching( | 19 void MockBrowsingDataFileSystemHelper::StartFetching( |
| 20 const FetchCallback& callback) { | 20 const FetchCallback& callback) { |
| 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 MockBrowsingDataFileSystemHelper::DeleteFileSystemOrigin( | 26 void MockBrowsingDataFileSystemHelper::DeleteFileSystemOrigin( |
| 27 const GURL& origin) { | 27 const GURL& origin) { |
| 28 ASSERT_FALSE(callback_.is_null()); | 28 ASSERT_FALSE(callback_.is_null()); |
| 29 std::string key = origin.spec(); | 29 std::string key = origin.spec(); |
| 30 ASSERT_TRUE(ContainsKey(file_systems_, key)); | 30 ASSERT_TRUE(base::ContainsKey(file_systems_, key)); |
| 31 last_deleted_origin_ = origin; | 31 last_deleted_origin_ = origin; |
| 32 file_systems_[key] = false; | 32 file_systems_[key] = false; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void MockBrowsingDataFileSystemHelper::AddFileSystem( | 35 void MockBrowsingDataFileSystemHelper::AddFileSystem( |
| 36 const GURL& origin, bool has_persistent, bool has_temporary, | 36 const GURL& origin, bool has_persistent, bool has_temporary, |
| 37 bool has_syncable, int64_t size_persistent, int64_t size_temporary, | 37 bool has_syncable, int64_t size_persistent, int64_t size_temporary, |
| 38 int64_t size_syncable) { | 38 int64_t size_syncable) { |
| 39 BrowsingDataFileSystemHelper::FileSystemInfo info(origin); | 39 BrowsingDataFileSystemHelper::FileSystemInfo info(origin); |
| 40 if (has_persistent) | 40 if (has_persistent) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 62 pair.second = true; | 62 pair.second = true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool MockBrowsingDataFileSystemHelper::AllDeleted() { | 65 bool MockBrowsingDataFileSystemHelper::AllDeleted() { |
| 66 for (const auto& pair : file_systems_) { | 66 for (const auto& pair : file_systems_) { |
| 67 if (pair.second) | 67 if (pair.second) |
| 68 return false; | 68 return false; |
| 69 } | 69 } |
| 70 return true; | 70 return true; |
| 71 } | 71 } |
| OLD | NEW |