Home | History | Annotate | Download | only in media_galleries
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_TEST_UTIL_H_
      6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_TEST_UTIL_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/files/scoped_temp_dir.h"
     10 #include "base/memory/ref_counted.h"
     11 #include "base/memory/scoped_ptr.h"
     12 #include "base/test/scoped_path_override.h"
     13 
     14 #if defined(OS_WIN)
     15 #include "base/test/test_reg_util_win.h"
     16 #endif
     17 
     18 namespace extensions {
     19 class Extension;
     20 }
     21 
     22 namespace registry_util {
     23 class RegistryOverrideManager;
     24 }
     25 
     26 class Profile;
     27 
     28 #if defined(OS_MACOSX)
     29 class MockPreferences;
     30 #endif
     31 
     32 scoped_refptr<extensions::Extension> AddMediaGalleriesApp(
     33     const std::string& name,
     34     const std::vector<std::string>& media_galleries_permissions,
     35     Profile* profile);
     36 
     37 class EnsureMediaDirectoriesExists {
     38  public:
     39   EnsureMediaDirectoriesExists();
     40   ~EnsureMediaDirectoriesExists();
     41 
     42   int num_galleries() const { return num_galleries_; }
     43 
     44   base::FilePath GetFakeAppDataPath() const;
     45 #if defined(OS_WIN)
     46   base::FilePath GetFakeLocalAppDataPath() const;
     47 #endif
     48 #if defined(OS_WIN) || defined(OS_MACOSX)
     49   void SetCustomPicasaAppDataPath(const base::FilePath& path);
     50   base::FilePath GetFakePicasaFoldersRootPath() const;
     51 #endif
     52 
     53 #if defined(OS_MACOSX)
     54   base::FilePath GetFakeITunesRootPath() const;
     55   base::FilePath GetFakeIPhotoRootPath() const;
     56 #endif
     57 
     58  private:
     59   void Init();
     60 
     61   base::ScopedTempDir fake_dir_;
     62 
     63   int num_galleries_;
     64 
     65   scoped_ptr<base::ScopedPathOverride> app_data_override_;
     66   scoped_ptr<base::ScopedPathOverride> music_override_;
     67   scoped_ptr<base::ScopedPathOverride> pictures_override_;
     68   scoped_ptr<base::ScopedPathOverride> video_override_;
     69 #if defined(OS_WIN)
     70   scoped_ptr<base::ScopedPathOverride> local_app_data_override_;
     71 
     72   registry_util::RegistryOverrideManager registry_override_;
     73 #endif
     74 #if defined(OS_MACOSX)
     75   scoped_ptr<MockPreferences> mac_preferences_;
     76 #endif
     77 
     78   DISALLOW_COPY_AND_ASSIGN(EnsureMediaDirectoriesExists);
     79 };
     80 
     81 extern base::FilePath MakeMediaGalleriesTestingPath(const std::string& dir);
     82 
     83 #endif  // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_TEST_UTIL_H_
     84