| 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 "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 ASSERT_TRUE(file_systems_.find(key) != file_systems_.end()); | 29 ASSERT_TRUE(file_systems_.find(key) != file_systems_.end()); |
| 30 last_deleted_origin_ = origin; | 30 last_deleted_origin_ = origin; |
| 31 file_systems_[key] = false; | 31 file_systems_[key] = false; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void MockBrowsingDataFileSystemHelper::AddFileSystem( | 34 void MockBrowsingDataFileSystemHelper::AddFileSystem( |
| 35 const GURL& origin, bool has_persistent, bool has_temporary, | 35 const GURL& origin, bool has_persistent, bool has_temporary, |
| 36 bool has_syncable) { | 36 bool has_syncable) { |
| 37 BrowsingDataFileSystemHelper::FileSystemInfo info(origin); | 37 BrowsingDataFileSystemHelper::FileSystemInfo info(origin); |
| 38 if (has_persistent) | 38 if (has_persistent) |
| 39 info.usage_map[fileapi::kFileSystemTypePersistent] = 0; | 39 info.usage_map[storage::kFileSystemTypePersistent] = 0; |
| 40 if (has_temporary) | 40 if (has_temporary) |
| 41 info.usage_map[fileapi::kFileSystemTypeTemporary] = 0; | 41 info.usage_map[storage::kFileSystemTypeTemporary] = 0; |
| 42 if (has_syncable) | 42 if (has_syncable) |
| 43 info.usage_map[fileapi::kFileSystemTypeSyncable] = 0; | 43 info.usage_map[storage::kFileSystemTypeSyncable] = 0; |
| 44 response_.push_back(info); | 44 response_.push_back(info); |
| 45 file_systems_[origin.spec()] = true; | 45 file_systems_[origin.spec()] = true; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void MockBrowsingDataFileSystemHelper::AddFileSystemSamples() { | 48 void MockBrowsingDataFileSystemHelper::AddFileSystemSamples() { |
| 49 AddFileSystem(GURL("http://fshost1:1/"), false, true, false); | 49 AddFileSystem(GURL("http://fshost1:1/"), false, true, false); |
| 50 AddFileSystem(GURL("http://fshost2:2/"), true, false, true); | 50 AddFileSystem(GURL("http://fshost2:2/"), true, false, true); |
| 51 AddFileSystem(GURL("http://fshost3:3/"), true, true, true); | 51 AddFileSystem(GURL("http://fshost3:3/"), true, true, true); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void MockBrowsingDataFileSystemHelper::Notify() { | 54 void MockBrowsingDataFileSystemHelper::Notify() { |
| 55 callback_.Run(response_); | 55 callback_.Run(response_); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void MockBrowsingDataFileSystemHelper::Reset() { | 58 void MockBrowsingDataFileSystemHelper::Reset() { |
| 59 for (std::map<const std::string, bool>::iterator i = file_systems_.begin(); | 59 for (std::map<const std::string, bool>::iterator i = file_systems_.begin(); |
| 60 i != file_systems_.end(); ++i) | 60 i != file_systems_.end(); ++i) |
| 61 i->second = true; | 61 i->second = true; |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool MockBrowsingDataFileSystemHelper::AllDeleted() { | 64 bool MockBrowsingDataFileSystemHelper::AllDeleted() { |
| 65 for (std::map<const std::string, bool>::const_iterator i = | 65 for (std::map<const std::string, bool>::const_iterator i = |
| 66 file_systems_.begin(); | 66 file_systems_.begin(); |
| 67 i != file_systems_.end(); ++i) { | 67 i != file_systems_.end(); ++i) { |
| 68 if (i->second) | 68 if (i->second) |
| 69 return false; | 69 return false; |
| 70 } | 70 } |
| 71 return true; | 71 return true; |
| 72 } | 72 } |
| OLD | NEW |