| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_TEST_UTIL_H_ |
| 6 #define CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_TEST_UTIL_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/scoped_temp_dir.h" |
| 11 #include "chrome/browser/privacy_blacklist/blacklist_manager.h" |
| 12 #include "chrome/test/testing_profile.h" |
| 13 |
| 14 class FilePath; |
| 15 |
| 16 // Testing profile which uses a temporary directory. |
| 17 class BlacklistTestingProfile : public TestingProfile { |
| 18 public: |
| 19 BlacklistTestingProfile(); |
| 20 |
| 21 BlacklistManager* GetBlacklistManager() { return blacklist_manager_; } |
| 22 void set_blacklist_manager(BlacklistManager* manager) { |
| 23 blacklist_manager_ = manager; |
| 24 } |
| 25 |
| 26 private: |
| 27 ScopedTempDir temp_dir_; |
| 28 |
| 29 BlacklistManager* blacklist_manager_; |
| 30 |
| 31 DISALLOW_COPY_AND_ASSIGN(BlacklistTestingProfile); |
| 32 }; |
| 33 |
| 34 // Path provider which allows easy updates from the outside and sends |
| 35 // notifications for each change. |
| 36 class TestBlacklistPathProvider : public BlacklistPathProvider { |
| 37 public: |
| 38 explicit TestBlacklistPathProvider(Profile* profile); |
| 39 |
| 40 // BlacklistPathProvider: |
| 41 virtual bool AreBlacklistPathsReady() const; |
| 42 virtual std::vector<FilePath> GetPersistentBlacklistPaths(); |
| 43 virtual std::vector<FilePath> GetTransientBlacklistPaths(); |
| 44 |
| 45 // Adds a path to the provder and sends an update notification. |
| 46 void AddPersistentPath(const FilePath& path); |
| 47 void AddTransientPath(const FilePath& path); |
| 48 |
| 49 // Removes all paths from the provider and send an update notification. |
| 50 void clear(); |
| 51 |
| 52 private: |
| 53 void SendUpdateNotification(); |
| 54 |
| 55 Profile* profile_; |
| 56 |
| 57 // Keep track of added paths. |
| 58 std::vector<FilePath> persistent_paths_; |
| 59 std::vector<FilePath> transient_paths_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(TestBlacklistPathProvider); |
| 62 }; |
| 63 |
| 64 #endif // CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_TEST_UTIL_H_ |
| OLD | NEW |